gcc/libcpp
Ollie Wild 7f5f5f98c5 Add new option, -Wliteral-suffix.
This option, which is enabled by default, causes the preprocessor to warn
when a string or character literal is followed by a ud-suffix which does
not begin with an underscore.  According to [lex.ext]p10, this is
ill-formed.

Also modifies the preprocessor to treat such ill-formed suffixes as separate
preprocessing tokens.  This is consistent with the Clang front end (see
http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and enables
backwards compatibility with code that uses formatting macros from
<inttypes.h>, as in the following code block:

  int main() {
    int64_t i64 = 123;
    printf("My int64: %"PRId64"\n", i64);
  }

Google ref b/6377711.

2012-04-27   Ollie Wild  <aaw@google.com>

	PR c++/52538
	* gcc/c-family/c-common.c: Add CPP_W_LITERAL_SUFFIX mapping.
	* gcc/c-family/c-opts.c (c_common_handle_option): Handle
	OPT_Wliteral_suffix.
	* gcc/c-family/c.opt: Add Wliteral-suffix.
	* gcc/doc/invoke.texi (Wliteral-suffix): Document new option.
	* gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix.c: New test.
	* libcpp/include/cpplib.h (struct cpp_options): Add new field,
	warn_literal_suffix.
	(CPP_W_LITERAL_SUFFIX): New enum.
	* libcpp/init.c (cpp_create_reader): Default initialization of
	warn_literal_suffix.
	* libcpp/lex.c (lex_raw_string): Treat user-defined literals which
	don't begin with '_' as separate tokens and produce a warning.
	(lex_string): Ditto.

From-SVN: r186909
2012-04-27 14:29:32 +00:00
..
include Add new option, -Wliteral-suffix. 2012-04-27 14:29:32 +00:00
po * vi.po: Update. 2012-04-24 23:16:24 +01:00
aclocal.m4 Undo inadvertent commit in rev 160105. 2010-06-01 10:20:24 -04:00
ChangeLog Add new option, -Wliteral-suffix. 2012-04-27 14:29:32 +00:00
charset.c Update Copyright years for files modified in 2010. 2011-01-03 21:52:22 +01:00
config.in re PR bootstrap/45538 (--enable-build-with-cxx compiling gcc/libcpp/charset.c) 2010-11-18 07:35:34 +00:00
configure Add ports for TILE-Gx and TILEPro. 2012-02-14 10:02:21 +00:00
configure.ac Add ports for TILE-Gx and TILEPro. 2012-02-14 10:02:21 +00:00
directives-only.c LINEMAP_POSITION_FOR_COLUMN had the exact same effect as linemap_position_for_column... 2011-08-15 20:35:58 +00:00
directives.c Generate virtual locations for tokens 2011-10-17 11:59:12 +02:00
errors.c Update Copyright years for files modified in 2010. 2011-01-03 21:52:22 +01:00
expr.c re PR c++/50958 ([C++0x] raw literal operator provides incorrect string for integer literal '0') 2011-11-21 14:27:30 -05:00
files.c re PR preprocessor/33919 (__BASE_FILE__ does not expand correctly when included from the command line) 2012-01-09 08:48:43 +00:00
identifiers.c Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception. 2009-04-09 17:00:19 +02:00
init.c Add new option, -Wliteral-suffix. 2012-04-27 14:29:32 +00:00
internal.h re PR preprocessor/33919 (__BASE_FILE__ does not expand correctly when included from the command line) 2012-01-09 08:48:43 +00:00
lex.c Add new option, -Wliteral-suffix. 2012-04-27 14:29:32 +00:00
line-map.c tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Fix comment. 2012-04-26 07:14:01 +00:00
macro.c macro.c (_cpp_builtin_macro_text): Remove unused variable map. 2012-01-09 14:15:25 +00:00
Makefile.in re PR bootstrap/50857 (The compiler is built with exceptions and RTTI enabled) 2011-11-03 17:17:07 +00:00
makeucnid.c Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception. 2009-04-09 17:00:19 +02:00
mkdeps.c files.c (file_hash_eq): Use filename_cmp instead of strcmp. 2011-03-25 20:11:26 +01:00
pch.c remove useless if-before-free tests 2011-04-20 18:19:03 +00:00
symtab.c directives.c (do_linemarker, do_line): Use CPP_STRING for ignored enum value. 2009-07-18 03:22:16 +00:00
system.h system.h: Prior to #define, #undef fopen and freopen unconditionally. 2012-01-03 11:44:34 +00:00
traditional.c Generate virtual locations for tokens 2011-10-17 11:59:12 +02:00
ucnid.h Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception. 2009-04-09 17:00:19 +02:00
ucnid.tab Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception. 2009-04-09 17:00:19 +02:00