From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14073 invoked by alias); 27 Apr 2012 14:29:56 -0000 Received: (qmail 14063 invoked by uid 22791); 27 Apr 2012 14:29:54 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Apr 2012 14:29:41 +0000 From: "aaw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52538] Extend C++11 UDLs to be compatible with inttypes.h macros Date: Fri, 27 Apr 2012 14:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: aaw at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg02437.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52538 --- Comment #3 from Ollie Wild 2012-04-27 14:29:39 UTC --- Author: aaw Date: Fri Apr 27 14:29:32 2012 New Revision: 186909 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186909 Log: 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 , 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 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. Added: trunk/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix.C Modified: trunk/gcc/ChangeLog trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.c trunk/gcc/c-family/c-opts.c trunk/gcc/c-family/c.opt trunk/gcc/doc/invoke.texi trunk/gcc/testsuite/ChangeLog trunk/libcpp/ChangeLog trunk/libcpp/include/cpplib.h trunk/libcpp/init.c trunk/libcpp/lex.c