Kenneth said:
Tim Rentsch wrote: [...]
My reading is that
#DEFINE <pp-tokens> <new-line>
(which presumably is what was there) is legal, and should not
have been rejected.
Based on what? Section 6.10 clearly shows several varations on "#define",
but all are listed with lowercase "define", and I see nothing which states
or implies case insignificance.
Based upon 6.10p1, the production covering "# non-directive". Since
DEFINE satisfies the requirements for a pp-token, "DEFINE pp-tokens
new-line" matches the requirements for a "non-directive". The only
requirement imposed upon a non-directive is that it "shall not begin
with any of the directive names appearing in the syntax." (6.10p3).
DEFINE is definitely not one of those directive names.
It might seem that the standard defines no behaviour for non-
directives; if that were the case, then the behaviour would be
undefined by reason of the absence of a definition.
However, there's a tricky argument that can be made that the behavior
IS defined, though in a very minimalist way. The only other thing the
standard says about non-directives is to point out, in footnote 150,
that "Despite the name, a non-directive is a preprocessing
directive.". While non-normative, that note merely confirms what can
already be inferred from the normative grammar productions in 6.10p1.
Because a non-directive is a preprocessing directive, 5.1.1.2p4
applies, which says that at the end of translation phase 4 "All
preprocessing directives are then deleted." Arguably, this defines the
behaviour of non-directives: they exist, like comments, solely for the
purpose of being removed without having any actual effect on the
translation of the program.
I'm not happy with this argument; I'd prefer a direct statement that
non-directives are simply to be ignored.