I think the following patch addresses all requirements and in the process it fixes some small deficiencies of the current status, such as talking about C99 when invoked from C++. Bootstrapped and regression tested on x86_64-unknown-linux-gnu with --enable-languages=all,obj-c++ --enable-decimal-float and --target_board=\{-m32,-m64\} OK for trunk? 2008-10-23 Manuel Lopez-Ibanez PR 13358 * doc/invoke.texi (-Wlong-long): Update description. * c-lex (interpret_integer): Only warn if there was no previous overflow and -Wlong-long is enabled. * c-decl.c (declspecs_add_type): Drop redundant flags. * c.opt (Wlong-long): Init to -1. * c-opts.c (sanitize_cpp_opts): Synchronize cpp's warn_long_long and front-end warn_long_long. Wlong-long only depends on other flags if it is uninitialized. * c-parser.c (disable_extension_diagnostics): warn_long_long is the same for CPP and FE. (restore_extension_diagnostics): Likewise. libcpp/ * init.c (cpp_create_reader): Wlong_long is disabled by default. * expr.c (cpp_classify_number): Give different messages for C and C++ front-ends. cp/ * parser.c (cp_parser_check_decl_spec): Drop redundant flags. * error.c (pedwarn_cxx98): New. * cp-tree.h (pedwarn_cxx98): Declare. testsuite/ * gcc.dg/wtr-int-type-1.c: Use two dg-warning to match two messages. Test for "long long" in system headers. * gcc.dg/c99-longlong-2.c: New. * g++.dg/warn/pr13358.C: New. * g++.dg/warn/pr13358-2.C: New. * g++.dg/warn/pr13358-3.C: New. * g++.dg/warn/pr13358-4.C: New. 2008/8/29 Manuel López-Ibáñez : > 2008/8/29 Joseph S. Myers : >> On Fri, 29 Aug 2008, Manuel López-Ibáñez wrote: >> >>> CPP and the FE were using different semantics. invoke.texi said that >>> Wlong-long was the default. This was not correct. It was the default >>> for CPP but -Wno-long-long was the default for the FE. Now there is >>> only one semantic: the one from the FE. >>> >>> However, we were inhibiting warning even if the user requested it >>> through Wlong-long. Now explicit Wlong-long (or Wno-long-long) >>> overrides everything else, except in system headers. >> >> If you allow -Wlong-long to have an effect in C99 mode, -std=c99 >> -pedantic-errors -Wlong-long should give the diagnostics as warnings not >> errors. Does it? > > No but I can make it do that just using pedwarn_c90 instead of pedwarn > and add a testcase. I'll do the same for c++98. I''ll need to add an > equivalent of pedwarn_c90 to C++ and CPP. In C++ is probably easy. > > Is there a way to tell in CPP if we are being called from the C++ FE? > and which standard? I cannot find anything in the sources apart from > CPP_OPTION (pfile, c99). > > Cheers, > > Manuel. >