Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -fno-druntime to GDC BuildOptions; it is the betterC flag. #2185

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions source/dub/commandline.d
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import std.encoding;
import std.exception;
import std.file;
import std.getopt;
import std.path : absolutePath, buildNormalizedPath;
import std.path : expandTilde, absolutePath, buildNormalizedPath;
import std.process;
import std.stdio;
import std.string;
Expand Down Expand Up @@ -161,7 +161,7 @@ struct CommandLineHandler
}
else
{
options.root_path = options.root_path.absolutePath.buildNormalizedPath;
options.root_path = options.root_path.expandTilde.absolutePath.buildNormalizedPath;
}
}

Expand Down Expand Up @@ -2280,6 +2280,9 @@ class DustmiteCommand : PackageBuildCommand {
string m_testPackage;
bool m_combined;
bool m_noRedirect;
string m_strategy;
uint m_jobCount; // zero means not specified
bool m_trace;
}

this() @safe pure nothrow
Expand Down Expand Up @@ -2308,6 +2311,9 @@ class DustmiteCommand : PackageBuildCommand {
args.getopt("test-package", &m_testPackage, ["Perform a test run - usually only used internally"]);
args.getopt("combined", &m_combined, ["Builds multiple packages with one compiler run"]);
args.getopt("no-redirect", &m_noRedirect, ["Don't redirect stdout/stderr streams of the test command"]);
args.getopt("strategy", &m_strategy, ["Set strategy (careful/lookback/pingpong/indepth/inbreadth)"]);
args.getopt("j", &m_jobCount, ["Set number of look-ahead processes"]);
args.getopt("trace", &m_trace, ["Save all attempted reductions to DIR.trace"]);
super.prepare(args);

// speed up loading when in test mode
Expand Down Expand Up @@ -2445,6 +2451,10 @@ class DustmiteCommand : PackageBuildCommand {

string[] extraArgs;
if (m_noRedirect) extraArgs ~= "--no-redirect";
if (m_strategy.length) extraArgs ~= "--strategy=" ~ m_strategy;
if (m_jobCount) extraArgs ~= "-j" ~ m_jobCount.to!string;
if (m_trace) extraArgs ~= "--trace";

const cmd = "dustmite" ~ extraArgs ~ [path.toNativeString(), testcmd.data];
auto dmpid = spawnProcess(cmd);
return dmpid.wait();
Expand Down
1 change: 1 addition & 0 deletions source/dub/compilers/gdc.d
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class GDCCompiler : Compiler {
tuple(BuildOption.deprecationErrors, ["-Werror", "-Wdeprecated"]),
tuple(BuildOption.property, ["-fproperty"]),
//tuple(BuildOption.profileGC, ["-?"]),
tuple(BuildOption.betterC, ["-fno-druntime"]),

tuple(BuildOption._docs, ["-fdoc-dir=docs"]),
tuple(BuildOption._ddox, ["-fXf=docs.json", "-fdoc-file=__dummy.html"]),
Expand Down
2 changes: 1 addition & 1 deletion source/dub/dependency.d
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ struct Repository
*/
@property string remote() @nogc nothrow pure @safe
in { assert(m_remote !is null); }
body
do
{
return m_remote;
}
Expand Down
30 changes: 15 additions & 15 deletions source/dub/internal/undead/xml.d
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class Document : Element
*/
override bool opEquals(scope const Object o) const
{
const doc = toType!(const Document)(o);
const scope doc = toType!(const Document)(o);
return prolog == doc.prolog
&& (cast(const) this).Element.opEquals(cast(const) doc)
&& epilog == doc.epilog;
Expand All @@ -611,7 +611,7 @@ class Document : Element
*/
override int opCmp(scope const Object o) scope const
{
const doc = toType!(const Document)(o);
const scope doc = toType!(const Document)(o);
if (prolog != doc.prolog)
return prolog < doc.prolog ? -1 : 1;
if (int cmp = this.Element.opCmp(doc))
Expand Down Expand Up @@ -842,7 +842,7 @@ class Element : Item
*/
override bool opEquals(scope const Object o) const
{
const element = toType!(const Element)(o);
const scope element = toType!(const Element)(o);
immutable len = items.length;
if (len != element.items.length) return false;
foreach (i; 0 .. len)
Expand All @@ -866,7 +866,7 @@ class Element : Item
*/
override int opCmp(scope const Object o) @safe const
{
const element = toType!(const Element)(o);
const scope element = toType!(const Element)(o);
for (uint i=0; ; ++i)
{
if (i == items.length && i == element.items.length) return 0;
Expand Down Expand Up @@ -1277,7 +1277,7 @@ class Comment : Item
*/
override bool opEquals(scope const Object o) const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const Comment) item;
return t !is null && content == t.content;
}
Expand All @@ -1296,7 +1296,7 @@ class Comment : Item
*/
override int opCmp(scope const Object o) scope const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const Comment) item;
return t !is null && (content != t.content
? (content < t.content ? -1 : 1 ) : 0 );
Expand Down Expand Up @@ -1365,7 +1365,7 @@ class CData : Item
*/
override bool opEquals(scope const Object o) const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const CData) item;
return t !is null && content == t.content;
}
Expand All @@ -1384,7 +1384,7 @@ class CData : Item
*/
override int opCmp(scope const Object o) scope const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const CData) item;
return t !is null && (content != t.content
? (content < t.content ? -1 : 1 ) : 0 );
Expand Down Expand Up @@ -1442,7 +1442,7 @@ class Text : Item
*/
override bool opEquals(scope const Object o) const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const Text) item;
return t !is null && content == t.content;
}
Expand All @@ -1461,7 +1461,7 @@ class Text : Item
*/
override int opCmp(scope const Object o) scope const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const Text) item;
return t !is null
&& (content != t.content ? (content < t.content ? -1 : 1 ) : 0 );
Expand Down Expand Up @@ -1525,7 +1525,7 @@ class XMLInstruction : Item
*/
override bool opEquals(scope const Object o) const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const XMLInstruction) item;
return t !is null && content == t.content;
}
Expand All @@ -1544,7 +1544,7 @@ class XMLInstruction : Item
*/
override int opCmp(scope const Object o) scope const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const XMLInstruction) item;
return t !is null
&& (content != t.content ? (content < t.content ? -1 : 1 ) : 0 );
Expand Down Expand Up @@ -1605,7 +1605,7 @@ class ProcessingInstruction : Item
*/
override bool opEquals(scope const Object o) const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const ProcessingInstruction) item;
return t !is null && content == t.content;
}
Expand All @@ -1624,7 +1624,7 @@ class ProcessingInstruction : Item
*/
override int opCmp(scope const Object o) scope const
{
const item = toType!(const Item)(o);
const scope item = toType!(const Item)(o);
const t = cast(const ProcessingInstruction) item;
return t !is null
&& (content != t.content ? (content < t.content ? -1 : 1 ) : 0 );
Expand Down Expand Up @@ -2955,7 +2955,7 @@ private alias Err = CheckException;

private
{
inout(T) toType(T)(inout Object o)
inout(T) toType(T)(scope return inout Object o)
{
T t = cast(T)(o);
if (t is null)
Expand Down
10 changes: 4 additions & 6 deletions source/dub/package_.d
Original file line number Diff line number Diff line change
Expand Up @@ -402,19 +402,17 @@ class Package {
*/
void addBuildTypeSettings(ref BuildSettings settings, in BuildPlatform platform, string build_type)
const {
if (build_type == "$DFLAGS") {
import std.process;
string dflags = environment.get("DFLAGS");
settings.addDFlags(dflags.split());
return;
}
import std.process;
string dflags = environment.get("DFLAGS", "");
settings.addDFlags(dflags.split());

if (auto pbt = build_type in m_info.buildTypes) {
logDiagnostic("Using custom build type '%s'.", build_type);
pbt.getPlatformSettings(settings, platform, this.path);
} else {
with(BuildOption) switch (build_type) {
default: throw new Exception(format("Unknown build type for %s: '%s'", this.name, build_type));
case "$DFLAGS": break;
case "plain": break;
case "debug": settings.addOptions(debugMode, debugInfo); break;
case "release": settings.addOptions(releaseMode, optimize, inline); break;
Expand Down
2 changes: 1 addition & 1 deletion source/dub/packagemanager.d
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class PackageManager {
*/
Package loadSCMPackage(string name, Dependency dependency)
in { assert(!dependency.repository.empty); }
body {
do {
Package pack;

with (dependency.repository) final switch (kind)
Expand Down
2 changes: 1 addition & 1 deletion source/dub/semver.d
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ unittest {
*/
bool isPreReleaseVersion(string ver) pure @nogc
in { assert(isValidVersion(ver)); }
body {
do {
foreach (i; 0 .. 2) {
auto di = ver.indexOf('.');
assert(di > 0);
Expand Down
11 changes: 11 additions & 0 deletions test/issue1645-dflags-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e

# If DFLAGS are not processed, dub for library would fail
DFLAGS="-w" $DUB build --root="$CURR_DIR"/1-staticLib-simple --build=plain
if DFLAGS="-asfdsf" $DUB build --root="$CURR_DIR"/1-staticLib-simple --build=plain 2>/dev/null; then
echo "Should not accept this DFLAGS";
false # fail
fi
$DUB build --root="$CURR_DIR"/1-staticLib-simple --build=plain --build=plain