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
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
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);
}
}
// 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();
}
#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
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
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