www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [Suggestion] Command line option: List defined version identifiers

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
It would be useful to have a command line option that displays the 
version identifiers that are set.  Maybe -versionlist or something.  For 
example, for DMD on Win32:

C:\>dmd -versionlist
D_InlineAsm
D_InlineAsm_X86
DigitalMars
LittleEndian
X86
Windows
Win32
all

If nothing else is on the command line, it would just print this and 
then exit.  If any other command line options are set, then the list 
will be adjusted accordingly.  If the name of a D file has also been 
given, it would parse the file and output the full list of versions that 
are set for the module as a result of predefined versions, -version 
switches, other command line switches and version assignments in the 
code file.

Having it in DMD might encourage developers of other D compilers 
(particularly those that mimic DMD's CLUI, but potentially any) to 
implement such a facility; and then when this happens, it will become 
even more useful.  It would provide an easy way to:

- determine the name by which a compiler vendor identifies itself
- determine which optional D features a given implementation supports
- check which version blocks will be tested - may be useful for testing 
the portability of code
- debug version manipulation within a module

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-  C++  a->--- UB  P+ L E  W++  N+++ o K-  w++  O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
Sep 14 2006
next sibling parent "Chris Miller" <chris dprogramming.com> writes:
On Thu, 14 Sep 2006 20:08:21 -0400, Stewart Gordon <smjg_1998 yahoo.com>  
wrote:

 It would be useful to have a command line option that displays the  
 version identifiers that are set.  Maybe -versionlist or something.

Sounds good to me.
Sep 14 2006
prev sibling next sibling parent reply Gregor Richards <Richards codu.org> writes:
Stewart Gordon wrote:
 It would be useful to have a command line option that displays the 
 version identifiers that are set.  Maybe -versionlist or something.  For 
 example, for DMD on Win32:
 
 C:\>dmd -versionlist
 D_InlineAsm
 D_InlineAsm_X86
 DigitalMars
 LittleEndian
 X86
 Windows
 Win32
 all
 
 If nothing else is on the command line, it would just print this and 
 then exit.  If any other command line options are set, then the list 
 will be adjusted accordingly.  If the name of a D file has also been 
 given, it would parse the file and output the full list of versions that 
 are set for the module as a result of predefined versions, -version 
 switches, other command line switches and version assignments in the 
 code file.
 
 Having it in DMD might encourage developers of other D compilers 
 (particularly those that mimic DMD's CLUI, but potentially any) to 
 implement such a facility; and then when this happens, it will become 
 even more useful.  It would provide an easy way to:
 
 - determine the name by which a compiler vendor identifies itself
 - determine which optional D features a given implementation supports
 - check which version blocks will be tested - may be useful for testing 
 the portability of code
 - debug version manipulation within a module
 
 Stewart.
 

Agreed. - Gregor Richards
Sep 14 2006
parent reply Georg Wrede <georg.wrede nospam.org> writes:
Gregor Richards wrote:
 Stewart Gordon wrote:
 
 It would be useful to have a command line option that displays the 
 version identifiers that are set.  Maybe -versionlist or something.  
 For example, for DMD on Win32:

 C:\>dmd -versionlist
 D_InlineAsm
 D_InlineAsm_X86
 DigitalMars
 LittleEndian
 X86
 Windows
 Win32
 all


An excellent idea! I wish the compiler version number would be included. And it should naturally also be one of the identifiers like any other.
Sep 15 2006
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Georg Wrede wrote:
<snip>
 I wish the compiler version number would be included. And it should 
 naturally also be one of the identifiers like any other.

I'm not entirely sure what you mean by this. If you want the compiler version number, for CC purposes or otherwise, use std.compiler. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Sep 15 2006
next sibling parent Georg Wrede <georg.wrede nospam.org> writes:
Stewart Gordon wrote:
 Georg Wrede wrote:
 <snip>
 
 I wish the compiler version number would be included. And it should 
 naturally also be one of the identifiers like any other.

I'm not entirely sure what you mean by this. If you want the compiler version number, for CC purposes or otherwise, use std.compiler. Stewart.

A compiler option that outputs these values will of course be used by external utilities, such as batch files, shell scripts, and other actors. But std.compiler is foremost targeted at in-code use.
Sep 16 2006
prev sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Stewart Gordon wrote:

 I'm not entirely sure what you mean by this.  If you want the compiler 
 version number, for CC purposes or otherwise, use std.compiler.

I don't think std.compiler is being updated, though ? DMD 0.166 says it is "0.0" and supports D spec 0.134 --anders
Sep 17 2006
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Anders F Björklund wrote:
 Stewart Gordon wrote:
 
 I'm not entirely sure what you mean by this.  If you want the compiler 
 version number, for CC purposes or otherwise, use std.compiler.

I don't think std.compiler is being updated, though ? DMD 0.166 says it is "0.0" and supports D spec 0.134 --anders

That's a problem with the current std.compiler 'implementation'. It makes no sense to add features to the language or compiler to get around this. How would such features stay up to date if this can't, anyway? Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Sep 18 2006
prev sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Stewart Gordon wrote:
 It would be useful to have a command line option that displays the 
 version identifiers that are set.  Maybe -versionlist or something.  For 
 example, for DMD on Win32:
 
 C:\>dmd -versionlist
 D_InlineAsm
 D_InlineAsm_X86
 DigitalMars
 LittleEndian
 X86
 Windows
 Win32
 all

Good idea, on Mac OS X 10.3 it would be: $ gdmd -versionlist GNU_BitsPerPointer32 GNU BigEndian PPC Unix darwin all --anders
Sep 15 2006