Bug 18433 – rdmd doesn't respect DFLAGS for its cache hash
Status
RESOLVED
Resolution
MOVED
Severity
enhancement
Priority
P1
Component
tools
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-02-13T16:41:59Z
Last change time
2021-01-09T11:16:59Z
Assigned to
No Owner
Creator
Jonathan Marler
Comments
Comment #0 by johnnymarler — 2018-02-13T16:41:59Z
rdmd currently ignores DFLAGS. These flags should be treated like all the other compiler flags.
Comment #1 by greensunny12 — 2018-03-27T22:48:04Z
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)
Comment #2 by greensunny12 — 2018-03-27T23:16:22Z
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
```