[Issue 12116] dmd -op -od broken

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jan 7 18:19:10 PST 2017


https://issues.dlang.org/show_bug.cgi?id=12116

Timothee Cour <timothee.cour2 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timothee.cour2 at gmail.com

--- Comment #3 from Timothee Cour <timothee.cour2 at gmail.com> ---
still completely broken:

dmd --version
DMD64 D Compiler v2.073.0-devel-a2b772f
rdmd | grep build
rdmd build 20170107

fun.d:
void main(){}

# with absolute path_to_file.d:
dmd -op -od/tmp/d01 /path/bug_12116/fun.d
creates ./fun and /path/bug_12116/fun.o (BUG: /tmp/d01 is ignored)

dmd -c -op -od/tmp/d01 /path/bug_12116/fun.d
creates /path/bug_12116/fun.o (BUG: /tmp/d01 is ignored)

rdmd -c -op -od/tmp/d01 /path/bug_12116/fun.d
creates /tmp/d01/fun.o (BUG: inconsistent with dmd)

# with .. in path_to_file.d:
mkdir temp && cd temp
dmd -op -od/tmp/d01 ../bug_12116/fun.d
creates ./fun and /tmp/bug_12116/fun.o (BUG: expected: something under
/tmp/d01)

rdmd -op -od/tmp/d01 ../bug_12116/fun.d
creates /tmp/d01/fun (BUG: inconsistent with dmd) and the .o under
*/.rdmd-501/* (OK)


# with -c:
dmd -c -op -od/tmp/d01 ../bug_12116/fun.d
/tmp/bug_12116/fun.o (BUG)

rdmd -c -op -od/tmp/d01 ../bug_12116/fun.d
creates /tmp/d01/fun.o (BUG: inconsistent with dmd)


# with no absolute path and not .. in file.d:
dmd -c -op -od/tmp/d01 bug_12116/fun.d
creates /tmp/d01/bug_12116/fun.o (OK)

rdmd -c -op -od/tmp/d01 bug_12116/fun.d
creates /tmp/d01/fun.o (BUG:inconsistent with dmd)

Other argument why -op is much less useful compared to -oq:
* forces you be at the root of module import paths
* if you have multiple module roots, it can't work:

dmd -c -op -od/tmp/d01/ -Iroot1/import -Ipath2/root2/import/
root1/import/std/path.d path2/root2/import/core/stdio.d

=> will create:
/tmp/d01/root1/import/std/path.o
/tmp/d01/path2/root2/import/core/stdio.o

with -oq semantics are a lots easier, predictable, no weird edge cases, and
easy to implement:
/tmp/d01/std.path.o
/tmp/d01/core.stdio.o

--


More information about the Digitalmars-d-bugs mailing list