re PR c++/13358 (long long and C++ do not mix well)
2009-04-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/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. From-SVN: r146459
This commit is contained in:
parent
37041295f5
commit
9c650d90ab
22 changed files with 213 additions and 40 deletions
|
@ -419,10 +419,12 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
|
|||
}
|
||||
|
||||
if ((result & CPP_N_WIDTH) == CPP_N_LARGE
|
||||
&& ! CPP_OPTION (pfile, c99)
|
||||
&& CPP_OPTION (pfile, warn_long_long))
|
||||
cpp_error (pfile, CPP_DL_PEDWARN,
|
||||
"use of C99 long long integer constant");
|
||||
cpp_error (pfile,
|
||||
CPP_OPTION (pfile, c99) ? CPP_DL_WARNING : CPP_DL_PEDWARN,
|
||||
CPP_OPTION (pfile, cplusplus)
|
||||
? "use of C++0x long long integer constant"
|
||||
: "use of C99 long long integer constant");
|
||||
|
||||
result |= CPP_N_INTEGER;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue