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. :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187172 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td
index 94f1b4b..cec938b 100644
--- a/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/include/clang/Basic/DiagnosticCommonKinds.td
@@ -101,7 +101,7 @@
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
diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp
index 5cba35b..87c0a6a 100644
--- a/lib/Lex/PPExpressions.cpp
+++ b/lib/Lex/PPExpressions.cpp
@@ -259,7 +259,7 @@
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);
}
}
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 8b7829d..5b0029a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3079,7 +3079,7 @@
// 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();
}
diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c
index c1fb54d..f0cd4d7 100644
--- a/test/Lexer/constants.c
+++ b/test/Lexer/constants.c
@@ -15,7 +15,7 @@
#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
diff --git a/test/Misc/warning-flags.c b/test/Misc/warning-flags.c
index 0a22e64..1ddd9e1 100644
--- a/test/Misc/warning-flags.c
+++ b/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
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_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