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
This commit is contained in:
parent
4073aad5b5
commit
c691145a65
@ -1,3 +1,14 @@
|
||||
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>
|
||||
|
||||
* dwarf2out.c (output_call_frame_info): Fix augmentation length.
|
||||
|
@ -1227,7 +1227,7 @@ lex_number (str, len)
|
||||
if (fflag)
|
||||
ERROR ("more than one 'f' suffix on floating constant");
|
||||
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");
|
||||
|
||||
fflag = 1;
|
||||
@ -1237,7 +1237,7 @@ lex_number (str, len)
|
||||
if (lflag)
|
||||
ERROR ("more than one 'l' suffix on floating constant");
|
||||
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");
|
||||
|
||||
lflag = 1;
|
||||
@ -1313,7 +1313,7 @@ lex_number (str, len)
|
||||
if (spec_unsigned)
|
||||
error ("two 'u' suffixes on integer constant");
|
||||
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");
|
||||
|
||||
spec_unsigned = 1;
|
||||
|
24
gcc/cpp.texi
24
gcc/cpp.texi
@ -170,9 +170,9 @@ spaces, horizontal and vertical tabs, and form feeds between the
|
||||
backslash and the subsequent newline. The preprocessor issues a
|
||||
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
|
||||
tokens, including multi-line strings, as well as between tokens.
|
||||
Comments are @emph{not} treated as whitespace for the purposes of this
|
||||
relaxation, since they have not yet been replaced with spaces.
|
||||
tokens, as well as between tokens. Comments are @emph{not} treated as
|
||||
whitespace for the purposes of this relaxation, since they have not yet
|
||||
been replaced with spaces.
|
||||
|
||||
@item
|
||||
All comments are replaced with single spaces.
|
||||
@ -216,8 +216,9 @@ bar"
|
||||
@end example
|
||||
|
||||
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
|
||||
multi-line strings. Instead, use string constant concatenation:
|
||||
having to worry about this, do not use the deprecated GNU extension
|
||||
which permits multi-line strings. Instead, use string literal
|
||||
concatenation:
|
||||
|
||||
@example
|
||||
"foo\\"
|
||||
@ -3053,12 +3054,15 @@ used at all.
|
||||
This pragma has been superseded by @samp{#pragma GCC poison}.
|
||||
@xref{Poisoning}.
|
||||
|
||||
@item Multi-line string literals in directives
|
||||
@item Multi-line string literals
|
||||
|
||||
The GNU C preprocessor currently allows newlines in string literals
|
||||
within a directive. This is forbidden by the C standard and will
|
||||
eventually be removed. (Multi-line string literals in open text are
|
||||
still supported.)
|
||||
The preprocessor currently allows raw newlines in string literals. This
|
||||
extension is deprecated and will be removed in a future version of GCC.
|
||||
The preprocessor already forbids such string literals in all directives
|
||||
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
|
||||
|
||||
|
@ -205,7 +205,7 @@ parse_number (pfile, tok)
|
||||
|
||||
if (CPP_WTRADITIONAL (pfile)
|
||||
&& sufftab[i].u
|
||||
&& ! cpp_sys_objmacro_p (pfile))
|
||||
&& ! cpp_sys_macro_p (pfile))
|
||||
cpp_warning (pfile, "traditional C rejects the `U' suffix");
|
||||
if (sufftab[i].l == 2 && CPP_OPTION (pfile, pedantic)
|
||||
&& ! CPP_OPTION (pfile, c99))
|
||||
|
@ -686,12 +686,10 @@ parse_string (pfile, token, terminator)
|
||||
break;
|
||||
}
|
||||
|
||||
if (! cpp_sys_macro_p (pfile))
|
||||
cpp_pedwarn (pfile, "multi-line string constants are deprecated");
|
||||
if (pfile->mlstring_pos.line == 0)
|
||||
{
|
||||
pfile->mlstring_pos = pfile->lexer_pos;
|
||||
if (CPP_PEDANTIC (pfile))
|
||||
cpp_pedwarn (pfile, "multi-line string constant");
|
||||
}
|
||||
pfile->mlstring_pos = pfile->lexer_pos;
|
||||
|
||||
handle_newline (buffer, c); /* Stores to read_ahead. */
|
||||
c = '\n';
|
||||
|
@ -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_start_lookahead PARAMS ((cpp_reader *));
|
||||
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 */
|
||||
extern int cpp_included PARAMS ((cpp_reader *, const char *));
|
||||
|
@ -988,12 +988,12 @@ cpp_get_token (pfile, token)
|
||||
defined in a system header. Just checks the macro at the top of
|
||||
the stack. Used for diagnostic suppression. */
|
||||
int
|
||||
cpp_sys_objmacro_p (pfile)
|
||||
cpp_sys_macro_p (pfile)
|
||||
cpp_reader *pfile;
|
||||
{
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user