Issue 24862 - cStd cRuntimeLibrary in __traits(getTargetInfo)?
Summary: cStd cRuntimeLibrary in __traits(getTargetInfo)?
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 enhancement
Assignee: No Owner
URL: http://dlang.org/
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-16 12:24 UTC by Manu
Modified: 2024-11-16 12:24 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Manu 2024-11-16 12:24:34 UTC
__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...