Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cStd cRuntimeLibrary in __traits(getTargetInfo)? #20546

Open
dlangBugzillaToGithub opened this issue Nov 16, 2024 · 0 comments
Open

cStd cRuntimeLibrary in __traits(getTargetInfo)? #20546

dlangBugzillaToGithub opened this issue Nov 16, 2024 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Manu reported this on 2024-11-16T12:24:34Z

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

Description

__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...
@thewilsonator thewilsonator added the Feature:traits Relating to __traits label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants