diff --git a/source/lex.tex b/source/lex.tex index 28ce23f2b8..4d20520281 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -480,10 +480,7 @@ characters \tcode{*/}. These comments do not nest. \indextext{comment!\tcode{//}}% The characters \tcode{//} start a comment, which terminates immediately before the -next new-line character. If there is a form-feed or a vertical-tab -character in such a comment, only whitespace characters shall appear -between it and the new-line that terminates the comment; no diagnostic -is required. +next new-line character. \begin{note} The comment characters \tcode{//}, \tcode{/*}, and \tcode{*/} have no special meaning within a \tcode{//} comment and diff --git a/source/lib-intro.tex b/source/lib-intro.tex index ea7a21b782..5393b91bce 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -3269,16 +3269,6 @@ \tcode{\#define} or \tcode{\#undef} names declared in any standard library header. -\pnum -\indextext{unit!translation}% -A translation unit shall not \tcode{\#define} or \tcode{\#undef} -names lexically identical -to keywords, -to the identifiers listed in \tref{lex.name.special}, or -to the \grammarterm{attribute-token}{s} described in~\ref{dcl.attr}, -except that the names \tcode{likely} and \tcode{unlikely} may be -defined as function-like macros~\iref{cpp.replace}. - \rSec4[extern.names]{External linkage} \pnum diff --git a/source/preprocessor.tex b/source/preprocessor.tex index d5f6e0ba7d..ea8542c537 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -532,7 +532,7 @@ \tcode{defined} unary operator does not match one of the two specified forms prior to macro replacement, -the behavior is undefined. +the program is ill-formed, no diagnostic required. \pnum After all replacements due to macro expansion and @@ -746,8 +746,8 @@ (i.e., each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens). If the directive resulting after all replacements does not match -one of the two previous forms, the behavior is -undefined. +one of the two previous forms, the program is ill-formed, no diagnostic required. + \begin{note} Adjacent \grammarterm{string-literal}s are not concatenated into a single \grammarterm{string-literal} @@ -1500,6 +1500,16 @@ replacement list of preprocessing tokens are not considered part of the replacement list for either form of macro. +\pnum +\indextext{unit!translation}% +A translation unit shall not \tcode{\#define} or \tcode{\#undef} +names lexically identical +to keywords, +to the identifiers listed in \tref{lex.name.special}, or +to the \grammarterm{attribute-token}{s} described in~\ref{dcl.attr}, +except that the names \tcode{likely} and \tcode{unlikely} may be +defined as function-like macros. + \pnum If a \indextext{\#\#0 operator@\tcode{\#} operator} @@ -1589,7 +1599,7 @@ \begin{footnote} A \grammarterm{conditionally-supported-directive} is a preprocessing directive regardless of whether the implementation supports it. \end{footnote} -the behavior is undefined. +the program is ill-formed. \pnum \begin{example} @@ -1783,19 +1793,17 @@ Otherwise, the original spelling of each preprocessing token in the stringizing argument is retained in the character string literal, except for special handling for producing the spelling of -\grammarterm{string-literal}s and \grammarterm{character-literal}s: -a -\tcode{\textbackslash} -character is inserted before each -\tcode{"} -and -\tcode{\textbackslash} -character of a \grammarterm{character-literal} or \grammarterm{string-literal} -(including the delimiting -\tcode{"} -characters). +\grammarterm{character-literal}s and \grammarterm{string-literal}s +(including the delimiting \unicode{0022}{quotation mark} (\tcode{"})) +contained within the preprocessing token: +a \unicode{005c}{reverse solidus} character (\tcode{\textbackslash}) +is inserted before each \unicode{0022}{quotation mark} and +\unicode{005c}{reverse solidus} character, +and each new-line character is +replaced by the two-character sequence \tcode{\textbackslash n}. If the replacement that results is not a valid character string literal, -the behavior is undefined. The character string literal corresponding to +the program is ill-formed. +The character string literal corresponding to an empty stringizing argument is \tcode{""}. The order of evaluation of \tcode{\#} @@ -1844,7 +1852,7 @@ a \grammarterm{universal-character-name}\iref{lex.charset}. \end{note} If the result is not a valid preprocessing token, -the behavior is undefined. +the program is ill-formed. The resulting preprocessing token is available for further macro replacement. The order of evaluation of \tcode{\#\#} @@ -2055,7 +2063,7 @@ by the digit sequence (interpreted as a decimal integer). If the digit sequence specifies zero or a number greater than 2147483647, -the behavior is undefined. +the program is ill-formed. \pnum A preprocessing directive of the form @@ -2079,7 +2087,7 @@ (each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens). If the directive resulting after all replacements does not match -one of the two previous forms, the behavior is undefined; +one of the two previous forms, the program is ill-formed; otherwise, the result is processed as appropriate. \rSec1[cpp.error]{Diagnostic directives}% @@ -2420,7 +2428,7 @@ or a \tcode{\#undef} preprocessing directive, -the behavior is undefined. +the program is ill-formed. Any other predefined macro names shall begin with a leading underscore followed by an uppercase letter or a second underscore.