diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-03-03 11:32:32 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-03-03 11:32:32 +0000 |
commit | c691145a655ed6fe191c2f7ce3220f19e46d2c3f (patch) | |
tree | 13a0b2cea1a5401bbb4f81dfe7b01474a61b9a00 /gcc | |
parent | 4073aad5b5460710695ff3d15315e16c6549311e (diff) | |
download | gcc-c691145a655ed6fe191c2f7ce3220f19e46d2c3f.zip gcc-c691145a655ed6fe191c2f7ce3220f19e46d2c3f.tar.gz gcc-c691145a655ed6fe191c2f7ce3220f19e46d2c3f.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/c-lex.c | 6 | ||||
-rw-r--r-- | gcc/cpp.texi | 24 | ||||
-rw-r--r-- | gcc/cppexp.c | 2 | ||||
-rw-r--r-- | gcc/cpplex.c | 8 | ||||
-rw-r--r-- | gcc/cpplib.h | 2 | ||||
-rw-r--r-- | gcc/cppmacro.c | 4 |
7 files changed, 35 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23eba3b..c818ddc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 9078361..1af7cd6 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -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; diff --git a/gcc/cpp.texi b/gcc/cpp.texi index 79efd48..8bfa8c4 100644 --- a/gcc/cpp.texi +++ b/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 diff --git a/gcc/cppexp.c b/gcc/cppexp.c index 6ce693e4..1231a7e 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.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)) diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 1d98b05..c0b5e02 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -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'; diff --git a/gcc/cpplib.h b/gcc/cpplib.h index 50d3bfe..eaa0ff9 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -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 *)); diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index 4d4302d..d424a41 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -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 |