diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2009-04-20 22:12:52 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2009-04-20 22:12:52 +0000 |
commit | 9c650d90abf690ca3d66ece71c69778c0eec05b7 (patch) | |
tree | fd9591c53025bec4c451b0619535e1e5e33a2a4d /gcc/c-lex.c | |
parent | 37041295f5ded2ee556e2b98f28402b6f35d1459 (diff) | |
download | gcc-9c650d90abf690ca3d66ece71c69778c0eec05b7.zip gcc-9c650d90abf690ca3d66ece71c69778c0eec05b7.tar.gz gcc-9c650d90abf690ca3d66ece71c69778c0eec05b7.tar.bz2 |
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
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 9fe29df..df63548 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -582,13 +582,18 @@ interpret_integer (const cpp_token *token, unsigned int flags) ? widest_unsigned_literal_type_node : widest_integer_literal_type_node); else - type = integer_types[itk]; - - if (itk > itk_unsigned_long - && (flags & CPP_N_WIDTH) != CPP_N_LARGE - && !in_system_header && !flag_isoc99) - pedwarn (input_location, 0, "integer constant is too large for %qs type", - (flags & CPP_N_UNSIGNED) ? "unsigned long" : "long"); + { + type = integer_types[itk]; + if (itk > itk_unsigned_long + && (flags & CPP_N_WIDTH) != CPP_N_LARGE) + emit_diagnostic + ((c_dialect_cxx () ? cxx_dialect == cxx98 : !flag_isoc99) + ? DK_PEDWARN : DK_WARNING, + input_location, OPT_Wlong_long, + (flags & CPP_N_UNSIGNED) + ? "integer constant is too large for %<unsigned long%> type" + : "integer constant is too large for %<long%> type"); + } value = build_int_cst_wide (type, integer.low, integer.high); |