www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24862] New: cStd cRuntimeLibrary in __traits(getTargetInfo)?

https://issues.dlang.org/show_bug.cgi?id=24862

          Issue ID: 24862
           Summary: cStd cRuntimeLibrary in __traits(getTargetInfo)?
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

__traits(getTargetInfo) can report "cppRuntimeLibrary" and "cppStd" (the
complementary C++ compiler's language version)...

Can we also add "cRuntimeLibrary" and "cStd"? Since C has its own language
standard revisions and runtime libs...

Particularly, this needs support from LDC and GDC too.

The runtime library is straightforward; just return the name of the native
runtime library (or the name of the specified CRT if an override lib was given
on the command line).

cStd to report the language standard version is possibly as little more tricky.
It doesn't affect the binary in any way I know of like the cppStd does, but the
language standard does affect what symbols the program can expect to find in
the C runtime library.

GDC knows what crt it was built for and the complementary gcc build will also
match the reported values by default.
LDC similarly, although it doesn't assume a complementary compiler; it should
probably report the language expressed by the crt library.
DMD has platform specific behaviour.

It's a shame that C++ uses the build option `extern-std`, because it doesn't
make it easy to select a similar name to control what C language standard we
plan to link against...

--
Nov 16