This is the mail archive of the
gcc-cvs@gcc.gnu.org
mailing list for the GCC project.
r186738 - in /branches/google/gcc-4_7: ./ gcc/C...
- From: aaw at gcc dot gnu dot org
- To: gcc-cvs at gcc dot gnu dot org
- Date: Tue, 24 Apr 2012 02:10:51 -0000
- Subject: r186738 - in /branches/google/gcc-4_7: ./ gcc/C...
Author: aaw
Date: Tue Apr 24 02:10:49 2012
New Revision: 186738
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186738
Log:
Merged revision 186736 from google/main.
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-23 Ollie Wild <aaw@google.com>
* 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.
Added:
branches/google/gcc-4_7/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix.C
- copied unchanged from r186736, branches/google/main/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix.C
branches/google/gcc-4_7/libcpp/ChangeLog.google-integration
- copied unchanged from r186736, branches/google/main/libcpp/ChangeLog.google-integration
Modified:
branches/google/gcc-4_7/ (props changed)
branches/google/gcc-4_7/gcc/ChangeLog.google-integration
branches/google/gcc-4_7/gcc/c-family/c-common.c
branches/google/gcc-4_7/gcc/c-family/c-opts.c
branches/google/gcc-4_7/gcc/c-family/c.opt
branches/google/gcc-4_7/gcc/doc/invoke.texi
branches/google/gcc-4_7/gcc/testsuite/gcc.target/powerpc/ppc-round.c (props changed)
branches/google/gcc-4_7/libcpp/include/cpplib.h
branches/google/gcc-4_7/libcpp/init.c
branches/google/gcc-4_7/libcpp/lex.c
branches/google/gcc-4_7/libjava/classpath/ (props changed)
Propchange: branches/google/gcc-4_7/
('svn:mergeinfo' modified)
Propchange: branches/google/gcc-4_7/gcc/testsuite/gcc.target/powerpc/ppc-round.c
('svn:mergeinfo' modified)
Propchange: branches/google/gcc-4_7/libjava/classpath/
('svn:mergeinfo' modified)