diff options
author | John McCall <rjmccall@apple.com> | 2010-02-26 23:35:57 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-02-26 23:35:57 +0000 |
commit | 2a0d7574acaa3a8d516e9ae4b720755460ebe8a8 (patch) | |
tree | e3c42cea14e9a0270625629637c2aa7c46ca4c64 | |
parent | d64a4f4798907495091daf2b081c3d62d729dca9 (diff) |
At sabre's request, drop the FP bounds diagnostics down to warnings and file
them under -Wbad-literal. They're still on by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97284 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 1 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 10 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 4 | ||||
-rw-r--r-- | test/Lexer/constants.c | 16 |
4 files changed, 17 insertions, 14 deletions
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 918f13e2b4..4cedd11e21 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -24,6 +24,7 @@ def AddressOfTemporary : DiagGroup<"address-of-temporary">; def : DiagGroup<"aggregate-return">; def : DiagGroup<"attributes">; def : DiagGroup<"bad-function-cast">; +def BadLiteral : DiagGroup<"bad-literal">; // not in gcc def : DiagGroup<"c++-compat">; def : DiagGroup<"cast-align">; def : DiagGroup<"cast-qual">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 3d9253db33..6eb3520c6f 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -29,10 +29,12 @@ def ext_null_pointer_expr_not_ice : Extension< // Semantic analysis of constant literals. def ext_predef_outside_function : Warning< "predefined identifier is only valid inside function">; -def err_float_overflow : Error< - "magnitude of floating-point constant too large for type %0; maximum is %1">; -def err_float_underflow : Error< - "magnitude of floating-point constant too small for type %0; minimum is %1">; +def warn_float_overflow : Warning< + "magnitude of floating-point constant too large for type %0; maximum is %1">, + InGroup<BadLiteral>; +def warn_float_underflow : Warning< + "magnitude of floating-point constant too small for type %0; minimum is %1">, + InGroup<BadLiteral>; // C99 Designated Initializers def err_array_designator_negative : Error< diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index fc89b15c04..c25d1195d8 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1736,10 +1736,10 @@ Action::OwningExprResult Sema::ActOnNumericConstant(const Token &Tok) { unsigned diagnostic; llvm::SmallVector<char, 20> buffer; if (result & APFloat::opOverflow) { - diagnostic = diag::err_float_overflow; + diagnostic = diag::warn_float_overflow; APFloat::getLargest(Format).toString(buffer); } else { - diagnostic = diag::err_float_underflow; + diagnostic = diag::warn_float_underflow; APFloat::getSmallest(Format).toString(buffer); } diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c index 104a3a2a2b..b833e7b43f 100644 --- a/test/Lexer/constants.c +++ b/test/Lexer/constants.c @@ -38,20 +38,20 @@ char f = 'abcd'; // ignored. float t0[] = { 1.9e20f, 1.9e-20f, - 1.9e50f, // expected-error {{too large}} - 1.9e-50f, // expected-error {{too small}} + 1.9e50f, // expected-warning {{too large}} + 1.9e-50f, // expected-warning {{too small}} -1.9e20f, -1.9e-20f, - -1.9e50f, // expected-error {{too large}} - -1.9e-50f // expected-error {{too small}} + -1.9e50f, // expected-warning {{too large}} + -1.9e-50f // expected-warning {{too small}} }; double t1[] = { 1.9e50, 1.9e-50, - 1.9e500, // expected-error {{too large}} - 1.9e-500, // expected-error {{too small}} + 1.9e500, // expected-warning {{too large}} + 1.9e-500, // expected-warning {{too small}} -1.9e50, -1.9e-50, - -1.9e500, // expected-error {{too large}} - -1.9e-500 // expected-error {{too small}} + -1.9e500, // expected-warning {{too large}} + -1.9e-500 // expected-warning {{too small}} }; |