Commit c691145a by Neil Booth Committed by Neil Booth

cpp.texi: Update.

        * cpp.texi: Update.
        * cppexp.c (parse_number): Update.
        * cpplex.c (parse_string): Pedwarn if multiline string does not
        result from a system header's macro.
        * cpplib.h (sys_objmacro_p): Rename sys_macro_p.
        * cppmacro.c (sys_objmacro_p): Rename sys_macro_p.  Return true
        for function-like macros too.
	* c-lex.c (parse_number): Update.

From-SVN: r40211
parent 4073aad5
2001-03-03 Neil Booth <neil@daikokuya.demon.co.uk>
* cpp.texi: Update.
* cppexp.c (parse_number): Update.
* cpplex.c (parse_string): Pedwarn if multiline string does not
result from a system header's macro.
* cpplib.h (sys_objmacro_p): Rename sys_macro_p.
* cppmacro.c (sys_objmacro_p): Rename sys_macro_p. Return true
for function-like macros too.
* c-lex.c (lex_number): Update.
2001-03-03 Richard Henderson <rth@redhat.com> 2001-03-03 Richard Henderson <rth@redhat.com>
* dwarf2out.c (output_call_frame_info): Fix augmentation length. * dwarf2out.c (output_call_frame_info): Fix augmentation length.
......
...@@ -1227,7 +1227,7 @@ lex_number (str, len) ...@@ -1227,7 +1227,7 @@ lex_number (str, len)
if (fflag) if (fflag)
ERROR ("more than one 'f' suffix on floating constant"); ERROR ("more than one 'f' suffix on floating constant");
else if (warn_traditional && !in_system_header else if (warn_traditional && !in_system_header
&& ! cpp_sys_objmacro_p (parse_in)) && ! cpp_sys_macro_p (parse_in))
warning ("traditional C rejects the 'f' suffix"); warning ("traditional C rejects the 'f' suffix");
fflag = 1; fflag = 1;
...@@ -1237,7 +1237,7 @@ lex_number (str, len) ...@@ -1237,7 +1237,7 @@ lex_number (str, len)
if (lflag) if (lflag)
ERROR ("more than one 'l' suffix on floating constant"); ERROR ("more than one 'l' suffix on floating constant");
else if (warn_traditional && !in_system_header else if (warn_traditional && !in_system_header
&& ! cpp_sys_objmacro_p (parse_in)) && ! cpp_sys_macro_p (parse_in))
warning ("traditional C rejects the 'l' suffix"); warning ("traditional C rejects the 'l' suffix");
lflag = 1; lflag = 1;
...@@ -1313,7 +1313,7 @@ lex_number (str, len) ...@@ -1313,7 +1313,7 @@ lex_number (str, len)
if (spec_unsigned) if (spec_unsigned)
error ("two 'u' suffixes on integer constant"); error ("two 'u' suffixes on integer constant");
else if (warn_traditional && !in_system_header else if (warn_traditional && !in_system_header
&& ! cpp_sys_objmacro_p (parse_in)) && ! cpp_sys_macro_p (parse_in))
warning ("traditional C rejects the 'u' suffix"); warning ("traditional C rejects the 'u' suffix");
spec_unsigned = 1; spec_unsigned = 1;
......
...@@ -170,9 +170,9 @@ spaces, horizontal and vertical tabs, and form feeds between the ...@@ -170,9 +170,9 @@ spaces, horizontal and vertical tabs, and form feeds between the
backslash and the subsequent newline. The preprocessor issues a backslash and the subsequent newline. The preprocessor issues a
warning, but treats it as a valid escaped newline and combines the two warning, but treats it as a valid escaped newline and combines the two
lines to form a single logical line. This works within comments and lines to form a single logical line. This works within comments and
tokens, including multi-line strings, as well as between tokens. tokens, as well as between tokens. Comments are @emph{not} treated as
Comments are @emph{not} treated as whitespace for the purposes of this whitespace for the purposes of this relaxation, since they have not yet
relaxation, since they have not yet been replaced with spaces. been replaced with spaces.
@item @item
All comments are replaced with single spaces. All comments are replaced with single spaces.
...@@ -216,8 +216,9 @@ bar" ...@@ -216,8 +216,9 @@ bar"
@end example @end example
is equivalent to @code{"foo\bar"}, not to @code{"foo\\bar"}. To avoid is equivalent to @code{"foo\bar"}, not to @code{"foo\\bar"}. To avoid
having to worry about this, do not use the GNU extension which permits having to worry about this, do not use the deprecated GNU extension
multi-line strings. Instead, use string constant concatenation: which permits multi-line strings. Instead, use string literal
concatenation:
@example @example
"foo\\" "foo\\"
...@@ -3053,12 +3054,15 @@ used at all. ...@@ -3053,12 +3054,15 @@ used at all.
This pragma has been superseded by @samp{#pragma GCC poison}. This pragma has been superseded by @samp{#pragma GCC poison}.
@xref{Poisoning}. @xref{Poisoning}.
@item Multi-line string literals in directives @item Multi-line string literals
The GNU C preprocessor currently allows newlines in string literals The preprocessor currently allows raw newlines in string literals. This
within a directive. This is forbidden by the C standard and will extension is deprecated and will be removed in a future version of GCC.
eventually be removed. (Multi-line string literals in open text are The preprocessor already forbids such string literals in all directives
still supported.) apart from #define.
Instead, make use of ISO C concatenation of adjacent string literals, or
use @samp{\n} followed by an escaped newline.
@item Preprocessing things which are not C @item Preprocessing things which are not C
......
...@@ -205,7 +205,7 @@ parse_number (pfile, tok) ...@@ -205,7 +205,7 @@ parse_number (pfile, tok)
if (CPP_WTRADITIONAL (pfile) if (CPP_WTRADITIONAL (pfile)
&& sufftab[i].u && sufftab[i].u
&& ! cpp_sys_objmacro_p (pfile)) && ! cpp_sys_macro_p (pfile))
cpp_warning (pfile, "traditional C rejects the `U' suffix"); cpp_warning (pfile, "traditional C rejects the `U' suffix");
if (sufftab[i].l == 2 && CPP_OPTION (pfile, pedantic) if (sufftab[i].l == 2 && CPP_OPTION (pfile, pedantic)
&& ! CPP_OPTION (pfile, c99)) && ! CPP_OPTION (pfile, c99))
......
...@@ -686,12 +686,10 @@ parse_string (pfile, token, terminator) ...@@ -686,12 +686,10 @@ parse_string (pfile, token, terminator)
break; break;
} }
if (! cpp_sys_macro_p (pfile))
cpp_pedwarn (pfile, "multi-line string constants are deprecated");
if (pfile->mlstring_pos.line == 0) if (pfile->mlstring_pos.line == 0)
{ pfile->mlstring_pos = pfile->lexer_pos;
pfile->mlstring_pos = pfile->lexer_pos;
if (CPP_PEDANTIC (pfile))
cpp_pedwarn (pfile, "multi-line string constant");
}
handle_newline (buffer, c); /* Stores to read_ahead. */ handle_newline (buffer, c); /* Stores to read_ahead. */
c = '\n'; c = '\n';
......
...@@ -605,7 +605,7 @@ extern void cpp_forall_identifiers PARAMS ((cpp_reader *, ...@@ -605,7 +605,7 @@ extern void cpp_forall_identifiers PARAMS ((cpp_reader *,
extern void cpp_scan_buffer_nooutput PARAMS ((cpp_reader *, int)); extern void cpp_scan_buffer_nooutput PARAMS ((cpp_reader *, int));
extern void cpp_start_lookahead PARAMS ((cpp_reader *)); extern void cpp_start_lookahead PARAMS ((cpp_reader *));
extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int)); extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int));
extern int cpp_sys_objmacro_p PARAMS ((cpp_reader *)); extern int cpp_sys_macro_p PARAMS ((cpp_reader *));
/* In cppfiles.c */ /* In cppfiles.c */
extern int cpp_included PARAMS ((cpp_reader *, const char *)); extern int cpp_included PARAMS ((cpp_reader *, const char *));
......
...@@ -988,12 +988,12 @@ cpp_get_token (pfile, token) ...@@ -988,12 +988,12 @@ cpp_get_token (pfile, token)
defined in a system header. Just checks the macro at the top of defined in a system header. Just checks the macro at the top of
the stack. Used for diagnostic suppression. */ the stack. Used for diagnostic suppression. */
int int
cpp_sys_objmacro_p (pfile) cpp_sys_macro_p (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
cpp_macro *macro = pfile->context->macro; cpp_macro *macro = pfile->context->macro;
return macro && ! macro->fun_like && macro->syshdr; return macro && macro->syshdr;
} }
/* Read each token in, until EOF. Directives are transparently /* Read each token in, until EOF. Directives are transparently
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment