www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1210] New: Special Token for Compiler and Version

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

           Summary: Special Token for Compiler and Version
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: StefanLiebig web.de


Similar as the special tokens __FILE__, __LINE__,.. I would like to have a
token telling me what compiler has been used and what version the compiler had.
This could than be included in the log of the application and may help tracking
or finding problems.
Maybe __COMPILER__? Resulting in e.g. "DMD 1.014"


-- 
May 02 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1210


daniel.keep+d.puremagic.com gmail.com changed:

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





-------
See std.compiler.


-- 
May 02 2007
prev sibling next sibling parent Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
 Similar as the special tokens __FILE__, __LINE__,.. I would like to have a
 token telling me what compiler has been used and what version the compiler had.
Theoretically, you could use the constants defined in std.compiler. In practice, they're typically out-of-date. (case in point: they're currently at version 1.002 for DMD 1.014 :( ) Also, it seems the version distributed with GDC wasn't modified to reflect that fact, it claims to be "Digital Mars D 1.002" (like DMD 1.002 to 1.014, apparently)...
 This could than be included in the log of the application and may help tracking
 or finding problems.
 Maybe __COMPILER__? Resulting in e.g. "DMD 1.014"
If std.compiler was properly updated, you could use something like --- import std.compiler; import std.stdio; void main() { writefln("%s %d.%03d", std.compiler.name, std.compiler.version_major, std.compiler.version_minor); } --- to get a string representation.
May 02 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1210






Oh, I am sorry! I should have found that. I guess I was expecting something
different within std.compiler.


-- 
May 02 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1210


StefanLiebig web.de changed:

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





That is too bad. So, why not the special token?
Within mars.c there is already:
    copyright = "Copyright (c) 1999-2007 by Digital Mars";
    written = "written by Walter Bright";
    version = "v1.014";
That looks fine to me and it seems to be up-to-date.
Information that is not up-to-date but should be is confusingly.


-- 
May 02 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1210


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com





That std.compiler is out of date is a bug.  Adding extra language features to
get around this bug wouldn't make sense - if Walter can't keep std.compiler up
to date, how would he be able to keep the workaround up to date?


-- 
May 02 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1210






Yes, std.compiler is out-of-date.
However, the information in mars.c is correct. I have scanned all my dmd
downloads   (32) and they where all correct.
I don´t know how the version gets into mars.c. Manually or automatically
(build process)? If manually than there is the tedious job of maintaining two
locations.  If automatically than the automatism has to be extended so that
both locations are in sync.

I don´t care from where I get the information, but it must be correct and I
need to trust that information.


-- 
May 02 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1210







 I don´t care from where I get the information, but it must be correct and I
 need to trust that information.
Indeed. But that we can't trust the information in std.compiler makes it as bad as non-existent, if not worse. I've just filed issue 1218, which aims at fixing this problem rather than working around it. --
May 07 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1210


davidl 126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED





resolved in d1.017 / d2.001


-- 
Jun 27 2007