www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3541] New: Add -oq to dmd (use fully qualified module name as object filename)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541

           Summary: Add -oq to dmd (use fully qualified module name as
                    object filename)
           Product: D
           Version: 1.051
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: patch
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: nfxjfg gmail.com



Created an attachment (id=514)
patch for dmd 1.051 to add -oq

This patch adds the -oq option to dmd. When dmd is invoked with -oq, it uses
the fully qualified module name for the filename. E.g. when a module contains
the module declaration "module foo.moo.huh;", the file is output as
"foo.moo.huh.o".

Why is -oq a good idea? Right now, build tools can use -od, but if there are
modules with the same names in different packages, clashes occur. You could use
-op to avoid this, but then object files will be all over the user's source
tree (which sucks, especially if dmd and/or the build tool crash, and leave the
object files everywhere).

LDC had this option since ages, and I think it's time that dmd also knows it.

Further remarks:
- The option respects the -od option.
- An error is raised when a module doesn't contain a ModuleDeclaration (this is
intentionally).
- dmd creates the filenames in the Module ctor; this is a problem because the
module declaration is needed to compute the object filename. I had to change it
and move the code to somewhere after Module.parse() is invoked.
- As a result, I'm not quite sure if I introduced regressions with the plenty
of other output methods.
- I hope the option is LDC compatible (xfbuild was able to use the patched dmd
with -oq).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 21 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541




Created an attachment (id=541)
updated patch

Updated to dmd 1.054, if anyone cares.
Apply with "patch -p1 < patchfile" in dmd source directory.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 01 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


Leandro Lucarella <llucax gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------

          mime type|                            |

              patch|                            |



PST ---
(From update of attachment 541)
Marked as patch

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 01 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


mpiepk gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------

           obsolete|                            |



Created an attachment (id=547)
Updated patch

The old patch contained inconsistent line endings and crashed patch (at least
on Win32). 

This also removes the "feature" that dmd strips the ".lib"/".obj" file
extension when building the linker command line (link.c), because it would fail
for filenames like "package.module.obj"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541




What do I have to do to make dmd support -oq ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 29 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541




Created an attachment (id=618)
updated patch for dmd 1.059 beta (~ svn 461)

this probably still crashes with win32 patch => not obsoleting mpiepk's patch

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 01 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------

          mime type|                            |

              patch|                            |


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 01 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541




For dmd 1.062, watch out for the comment "// Bugzilla 3547" in module.c: you
have to move my changes into the indented new indented else branch.

Not bothering with a real updated patch, line ending issues make this kind of
infeasible, and Walter probably applies patches manually anyway. (Plus he
obviously isn't interested in this.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 13 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541




I'm updating this patch to new dmd versions all the time, just mail me if
you're actually interested in it lol.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 02 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |braddr puremagic.com
         Resolution|INVALID                     |


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


Jacob Carlborg <doob me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob me.com



Pull request available: https://github.com/D-Programming-Language/dmd/pull/11

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



17:05:48 PDT ---
Interesting. Currently I have a very superficial D build script which simply
creates a ./cache folder, recreates the folder structure of the source tree
inside this cache folder, and puts object files and library files there by
simply using -of via DMD.

So for example the source tree is:
./main.d
./bar/all.d
./bar/barclass.d
./foo/utils.d

And the generated files would be:
./cache/bar/bar.lib
./cache/bar/all.obj
./cache/bar/barclass.obj
./cache/foo/foo.lib
./cache/foo/utils.obj

Then I have no conflicts. But its very artificial as the build script was done
in one afternoon.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 26 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



12:27:44 PDT ---
The patch crashes on line 254 of module.c when compiling druntime with the
line:

..\dmd.exe -c -d -o- -Isrc -Iimport -Hfimport\core\atomic.di src\core\atomic.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541




11:13:12 PST ---
See also https://github.com/D-Programming-Language/dmd/pull/169

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 14 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541




New pull request: https://github.com/D-Programming-Language/dmd/pull/563

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 16 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3541


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



06:39:14 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1871

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 08 2013