r187172 - Partially revert r186903.

Eli Friedman eli.friedman at gmail.com
Thu Jul 25 17:06:45 PDT 2013


Author: efriedma
Date: Thu Jul 25 19:06:45 2013
New Revision: 187172

URL: http://llvm.org/viewvc/llvm-project?rev=187172&view=rev
Log:
Partially revert r186903.

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. :)

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

Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=187172&r1=187171&r2=187172&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Thu Jul 25 19:06:45 2013
@@ -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

Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=187172&r1=187171&r2=187172&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Thu Jul 25 19:06:45 2013
@@ -259,7 +259,7 @@ static bool EvaluateValue(PPValue &Resul
       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);
       }
     }

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=187172&r1=187171&r2=187172&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jul 25 19:06:45 2013
@@ -3079,7 +3079,7 @@ ExprResult Sema::ActOnNumericConstant(co
       // 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();
       }

Modified: cfe/trunk/test/Lexer/constants.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/constants.c?rev=187172&r1=187171&r2=187172&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/constants.c (original)
+++ cfe/trunk/test/Lexer/constants.c Thu Jul 25 19:06:45 2013
@@ -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

Modified: cfe/trunk/test/Misc/warning-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=187172&r1=187171&r2=187172&view=diff
==============================================================================
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Thu Jul 25 19:06:45 2013
@@ -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





More information about the cfe-commits mailing list