On Jul 11, 2013 1:28 AM, "H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote:
>
> On Tue, Jul 09, 2013 at 05:07:59PM -0700, H. S. Teoh wrote:
> [...]
> > I forked GDMD on github and took a first stab at D-ifying it:
> >
> >       https://github.com/quickfur/GDMD/tree/dport
> [...]
>
> Update:
> - Fixed the path issues raised earlier (thanks for all the feedback!)
>
> - I've added a whole bunch more code now, and a good number of dmd
>   options are now understood. Most of the common ones are now supported,
>   like -c, -inline, -O, and a few others. There's still a lot left to
>   do, though. It never truly dawned on me before just how many options
>   dmd has!  (Fortunately it's nowhere near the sheer number in gcc/gdc.
>   ;-))
>
> - Unittests were added!! Now I can feel less shameful. :-P
>
> - Now gdmd can handle -of, -od, and -op. However, dmd appears to be
>   extremely quirky in this area (esp. when these options are used
>   together). Apparently, if the argument to -of contains '/', it
>   implicitly sets -od as well. Gdmd still doesn't quite match dmd in
>   this area.  One particularly problematic case is:
>
>   Given this directory structure:
>         ./src
>         ./src/test.d
>
>   Running dmd -ofbin/prog produces:
>         ./bin
>         ./bin/prog
>         ./prog.o        <-- problem
>
>   The trouble with this case is that currently gdmd always compiles each
>   source file separately (following the behaviour of the old Perl

Are you sure on that?  :-)

My memory might be bad in this respect, but I seem to recall the script explicitly set the output program / object file name. (See below for why that matters ).

>   script), so we can't just rename the default test.o to prog.o. Also,
>   IME, running gdc with too many .d files at once can sometimes cause
>   memory problems, so doing it one at a time seems preferable.
>

Running dmd with too many .d files causes the same memory problems, but they tend to be short lived due to the speed of the compilation.

The difference between single and multiple file compilation is very subtle in gdc since the switch to LTO.

gdc foo.d bar.d.   # compiled separately.
gdc foo.d bar.d -o exe   # compiled together.

People from a dmd background I found expected the latter, and separate compilation also comes with its own quirks that don't occur during single compilation of all sources (the most common suggested work around for this being -femit-templates, though should give the switch -fonly some lovin' someday).

Regards
--
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';