Skip to content

rdmd doesn't respect DFLAGS for its cache hash #424

@dlang-bugzilla-migration

Description

Transferred from: https://issues.dlang.org/show_bug.cgi?id=18433

User @marler8997 reported (2018-Feb-13 16:41:59):

rdmd currently ignores DFLAGS. These flags should be treated like all the other compiler flags.

User @wilzbach responded (2018-Mar-27 22:48:04):

Hmm I think the problem is more in DMD not respecting everything from DFLAGS:
However, this has been in master:

$ cat > foo.d << EOF
void main(){
    import std.stdio;
    version(Foo)
    {
        "foo".writeln;
    }
    else
    {
        "bar".writeln;
    }
}
EOF
$ dmd -version=Foo foo.d && ./foo
foo
$ DFLAGS="-version=Foo" dmd foo.d && ./foo
bar
$ DFLAGS="-version=Foo" rdmd --force foo.d
bar

(with ~master this correctly yields foo for all commands)

But it looks like rdmd's caching doesn't include a hash of DFLAGS.

$ DFLAGS="-version=Foo" rdmddev foo.d
foo
$ DFLAGS="-version=Bar" rdmddev foo.d
foo

(so I'm renaming this)

User @wilzbach responded (2018-Mar-27 23:16:22):

Argh, apparently this hasn't been fixed in master and DFLAGS is only looked at when -conf= is set:

$ DFLAGS="-version=Foo" ../dmd/generated/linux/release/64/dmd -v foo.d && ./foo
predefs   DigitalMars Posix linux ELFv1 LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 CRuntime_Glibc D_LP64 D_PIC assert D_HardFloat
binary    ../dmd/generated/linux/release/64/dmd
version   v2.079.0-284-g23b2e2e0d
config    ../dmd/generated/linux/release/64/dmd.conf
DFLAGS    -I../dmd/generated/linux/release/64/../../../../../druntime/import -I../dmd/generated/linux/release/64/../../../../../phobos -L-L../dmd/generated/linux/release/64/../../../../../phobos/generated/linux/release/64 -L--export-dynamic -fPIC
$ DFLAGS="-version=Foo" dmd -conf= -I~/dlang/phobos -I~/dlang/druntime/import -c -v foo.d
predefs   Foo DigitalMars Posix linux ELFv1 LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 CRuntime_Glibc D_LP64 D_PIC assert D_HardFloat
binary    /home/seb/dlang/dmd/generated/linux/release/64/dmd
version   v2.079.0-284-g23b2e2e0d
config
DFLAGS    -version=Foo

User @wilzbach responded (2018-Mar-27 23:31:42):

#343

Metadata

Metadata

Assignees

No one assigned

    Labels

    Prio.3.NormalA bug that is neither a blocker nor a regressionT.RDMDIssues that apply only to rdmdType.BugThings don't work as they were intended to, or the way they were intended to work doesn't make sense

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions