-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Document which options are required to be enabled/disabled for conformance and strict conformance of a program to a given language standard #57987
Comments
This claim is not false and documentation will not be modified in that way. However, the thrust of the request here is valid: it would be nice to tell users "if you want the most strictly conforming mode of the compiler, here's how you get it". For example, Clang does not enable So while the request is easy to spell out, the execution of that request is likely to be labor intensive and require oversight to keep from bit rotting as diagnostic behavior changes. |
You said there is no known way to get Clang to try to act as a conforming C90 implementation. I cannot see this as compatible with the claim that "Clang implements all of the ISO 9899:1990 (C89) standard." One or the other has to be false. |
Clang implements the standard (modulo bugs, of course). That you need to pass different warning flags to get problematic code to compile does not impact conformance. There is no requirement that the default set of options for the implementation results in a conforming C or C++ compiler. There is no documentation that we provide that says the default set of options will give you a conforming C or C++ compiler. You are assuming that |
That isn't what I've said. I never said there is any requirement for Clang to be conforming in its default mode. I am only saying there is a requirement for Clang to be conforming in some mode, and if that mode exists at all, it is not a mode that you are aware of, it is not a mode that I am aware of, and I strongly suspect it is not a mode anyone is aware of.
This too is not what I am assuming and given how explicitly I have already stated that this is not true, I cannot see how you can think this. Clang is free to warn about any and all code in conforming mode, it's only not free to error on valid code in conforming mode. As for which flags are needed to get into a conforming mode, it does not matter what they are, so long as it is documented. I was expecting If no one can get Clang to try to conform to C90, it does not conform to C90. Note that all of this is only a horrible hassle for documentation because you decided that Clang's (Edit: PS:
The C standard does not require a diagnostic for UB. If a diagnostic is useful, it may be a worthwhile addition, but to leave it off does not affect conformance.) |
Thank you for clarifying, sorry for my misunderstanding! Just because I don't know the full set of flags required to put the compiler into a conforming mode for a given language standard does not mean the set does not exist.
As discussed plenty already, that is not correct.
This is also not correct. Clause 4 goes into details on this, but in C2x Clause 4, it says (p5): p6: p8: Therefore, using something described as undefined behavior in the standard is not a conforming program unless we've defined the behavior for our implementation to be an extension. C2x 6.4.2.1p7 and 8 go on to say: If the program declares or defines an identifier in a context in which it is reserved (other than as So |
I thought you had already agreed that it was correct. There is code that we agree is valid C99, code that is rejected by You quote for the other point, "A conforming hosted implementation shall accept any strictly conforming program."
It is. There is no dispute that a program that uses reserved identifiers is not strictly conforming, but the C standard distinguishes between syntax errors, constraint violations, and undefined behaviour. Syntax errors and constraint violations require a diagnostic from a conforming implementation, undefined behaviour does not.
|
I realise now it's worse: the same analysis for the previously given program also applies to struct A { int x; };
struct B { int x; };
void f(a) struct A a; {} /* never called */
void g(b) struct B b; { f(b); } /* never called */
int main() { return 0; } This is a strictly conforming C99/C11/C17 program. (C90, possibly not based on what you quoted, though I've not yet checked to be sure.) GCC silently accepts it with |
@llvm/issue-subscribers-c |
Per the discussion at https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213 with @AaronBallman, there is no way that anyone knows of to invoke Clang in C-conforming mode, the option documented at https://clang.llvm.org/c_status.html is said by him to not be intended to do so, does not do so, and what options (if any) do is not only not documented anywhere but also not known and no work on fixing this is planned. As such, I am filing a ticket to remove the false claim that "Clang implements the following published and upcoming ISO C standards:"
The text was updated successfully, but these errors were encountered: