Actually what I wanted was the reference to the standard,
and I found it (surprisingly, it's where "diagnostic"is
defined). I have always thought that syntax extensions are
allowed, that's why I insisted on "why?". E.g. I was sure
that gcc doesn't have to warn about __attribute__ even in
conforming mode. Now I have a question about conformance
of one unnamed compiler [which does not complain about a
translation unit consisting entirely of the one line]
__attribute__((unused)) static int a;
Is this unnamed compiler non-conforming?
Not from this example. The reason is that names prefixed with
various kinds of underscores (including single underscores followed
by uppercase, and double underscores) are reserved to the
implementation, and once you use an "implementation keyword", the
entire "contract", as it were, that the Standard provides to the
C programmer is terminated, at least in principle.
Thus, the following does not require a diagnostic:
#pragma comment !
! hi there.
static int a;
because "#pragma" can also do pretty much anything (although in
C99 there are now standardized #pragma operations). (Perhaps, as
in this case, the "#pragma" turns "!" into a comment-to-end-of-line
character. "#pragma fortran" might be used to switch to Fortran
code, which would change the syntax even more.)
This is, of course, the danger of doing anything that departs from
Standard C: the moment you abandon the standard, even for an instant,
the standard can abandon you, possibly "forever".
Of course,
real, reasonable C implementations do not do so: they disable
"complete standard-ness" long enough for you to useful work, while
retaining "enough standard-ness" long enough for you to, well, do
useful work. However, for reasons both good and bad, these may
lure you into doing things that, in effect, "capture" you into
staying with that particular compiler-vendor "forever". This in
turn may be good (lets you get your work done in a reasonable way
and timely fashion, for instance) or bad (costs you a million
dollars every five minutes, for instance), or possibly both.