Is there an implementation that allows you to disable the diagnostics required by the standard standard?

Consider the following:

typedef int; int main () { return 0; } 

If I compile this with clang without any warnings, I get

 warning: typedef requires a name [-Wmissing-declarations] typedef int; 

What to expect; typedef int is illegal in section 6.7 of the C11 standard and in section 5.1.1.3,

The corresponding implementation should produce at least one diagnostic message if the translation unit or translation unit contains a violation of any syntax rule or restriction.

If I compile this with clang -Wno-missing-declarations , it compiles clean, without any diagnostic messages.

My question is:
Is this label as an inappropriate implementation, or is it normal to provide the ability to disable what would otherwise be a mandatory diagnostic?

+4
source share
1 answer

From the standard section of the project C11 4 Compliance, we see that it is not strictly relevant:

A strictly appropriate program should use only those language and library functions specified in this International Standard. 3) should not produce output depending on any unspecified, undefined, or behavior defined by the implementation, and should not exceed the minimum implementation limit.

but this is a compatible implementation, since the corresponding implementation allows extensions if they do not violate a strictly relevant program:

[...] The corresponding implementation may have extensions (including additional library functions), provided that they do not change the behavior of any strictly relevant program. 4)

C-FAQ says :

[...] There are very few realistic, useful, strictly relevant programs. On the other hand, just the appropriate program can use any extension for the compiler that it wants.

+3
source

All Articles