www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15447] New: DMD should clean up intermediate .o files it


          Issue ID: 15447
           Summary: DMD should clean up intermediate .o files it creates
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: samjnaa gmail.com


$ ls *.d
$ dmd usage.d
$ ls usage*
usage  usage.d  usage.o

DMD has left over the intermediate .o file. So I try whether it will clean it
up if I use -of, but no:

$ rm *.o
$ dmd -ofusage usage.d
$ ls usage*
usage  usage.d  usage.o

OK then I find that the DMD man page says:

-o-    Suppress generation of object file

So I try that:

$ rm usage{,.o}
$ dmd -o- usage.d
$ ls usage*

Wha'?! No output at all. Apparently using -o- actually causes DMD to suppress
all binary output, which is not what is advertised. (Yeah OK one could argue
that the executable is also an object file in some sense of the word, but
AFAICS that is not what is generally understood by "object file".)

On the forum, it was said
(http://forum.dlang.org/post/smlcnyfnxbdazkgfnhdw forum.dlang.org) that the
reason for the .o files is that the compiler and linker are two different
programs, but IIUC even with GCC/Clang for C/C++, the same is true, and on long
compile runs with GCC/Clang I have observed temporary .o files being created in
my /tmp dir and disappearing after a short while.

Surely DMD knows what .o files it is creating for the linker so that it should
not be a problem for it to clean them up after having done with them. Somehow
DMD not cleaning up after itself seems very unprofessional and doesn't
contribute to D's image especially to those migrating from C/C++.

Please make it so that DMD doesn't litter my directory with .o files when I
haven't specifically requested that using -c. Thanks!

I'm using latest DMD on Kubuntu Trusty 64 bit.

Dec 14 2015