]> granicus.if.org Git - clang/commitdiff
Partially revert r186903.
authorEli Friedman <eli.friedman@gmail.com>
Fri, 26 Jul 2013 00:06:45 +0000 (00:06 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 26 Jul 2013 00:06:45 +0000 (00:06 +0000)
It turns out that Plum Hall depends on us not emitting an error on
integer literals which fit into long long, but fit into
unsigned long long.  So C99 conformance requires not conforming to C99. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187172 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticCommonKinds.td
lib/Lex/PPExpressions.cpp
lib/Sema/SemaExpr.cpp
test/Lexer/constants.c
test/Misc/warning-flags.c

index 94f1b4b244a47eb96b322c9f4aad94347409dacb..cec938b180de24f745be80997f1968fc8fc56802 100644 (file)
@@ -101,7 +101,7 @@ def warn_cxx98_compat_longlong : Warning<
   InGroup<CXX98CompatPedantic>, DefaultIgnore;
 def err_integer_too_large : Error<
   "integer constant is larger than the largest unsigned integer type">;
-def err_integer_too_large_for_signed : Error<
+def warn_integer_too_large_for_signed : Warning<
   "integer constant is larger than the largest signed integer type">;
 
 // Sema && AST
index 5cba35b2af1d56283c9bd181c9d1c006ee46db42..87c0a6ace6cbc23c4c81c59b735658c0a317be1d 100644 (file)
@@ -259,7 +259,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
       if (!Literal.isUnsigned && Result.Val.isNegative()) {
         // Don't warn for a hex or octal literal: 0x8000..0 shouldn't warn.
         if (ValueLive && Literal.getRadix() == 10)
-          PP.Diag(PeekTok, diag::err_integer_too_large_for_signed);
+          PP.Diag(PeekTok, diag::warn_integer_too_large_for_signed);
         Result.Val.setIsUnsigned(true);
       }
     }
index 8b7829d8a5db7a0853f93fadd416dc5f1c3f7f15..5b0029a91f371845f744c5d2c5efbe24a9a62f83 100644 (file)
@@ -3079,7 +3079,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
       // If we still couldn't decide a type, we probably have something that
       // does not fit in a signed long long, but has no U suffix.
       if (Ty.isNull()) {
-        Diag(Tok.getLocation(), diag::err_integer_too_large_for_signed);
+        Diag(Tok.getLocation(), diag::warn_integer_too_large_for_signed);
         Ty = Context.UnsignedLongLongTy;
         Width = Context.getTargetInfo().getLongLongWidth();
       }
index c1fb54df42d696738a2428260df0ac4870c883c9..f0cd4d7cf29cf938be9e7ee5f7c2d4aaded1c282 100644 (file)
@@ -15,7 +15,7 @@ float Y = 08.123456;
 #endif
 #if -01000000000000000000000  // should not warn.
 #endif
-#if 9223372036854775808 // expected-error {{integer constant is larger than the largest signed integer type}}
+#if 9223372036854775808 // expected-warning {{integer constant is larger than the largest signed integer type}}
 #endif
 #if 0x10000000000000000 // expected-error {{integer constant is larger than the largest unsigned integer type}}
 #endif
index 0a22e640a72cfce3c43cc2fc8fb3534e4e600c58..1ddd9e1dac6ec094aa05e282bdf12929861e9ab9 100644 (file)
@@ -18,7 +18,7 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (135):
+CHECK: Warnings without flags (136):
 CHECK-NEXT:   ext_delete_void_ptr_operand
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
@@ -85,6 +85,7 @@ CHECK-NEXT:   warn_implements_nscopying
 CHECK-NEXT:   warn_incompatible_qualified_id
 CHECK-NEXT:   warn_initializer_string_for_char_array_too_long
 CHECK-NEXT:   warn_inline_namespace_reopened_noninline
+CHECK-NEXT:   warn_integer_too_large_for_signed
 CHECK-NEXT:   warn_invalid_asm_cast_lvalue
 CHECK-NEXT:   warn_many_braces_around_scalar_init
 CHECK-NEXT:   warn_maynot_respond