summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-02-26 23:35:57 +0000
committerJohn McCall <rjmccall@apple.com>2010-02-26 23:35:57 +0000
commit62abc944d6738ffb93f273fb755d4a2d9825d823 (patch)
treea89d3722d928c3ebbd02d89416cb75135d1e689b /clang
parentda5fcdace014f6cffa0160146f6d52a52577b131 (diff)
downloadbcm5719-llvm-62abc944d6738ffb93f273fb755d4a2d9825d823.tar.gz
bcm5719-llvm-62abc944d6738ffb93f273fb755d4a2d9825d823.zip
At sabre's request, drop the FP bounds diagnostics down to warnings and file
them under -Wbad-literal. They're still on by default. llvm-svn: 97284
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/DiagnosticGroups.td1
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td10
-rw-r--r--clang/lib/Sema/SemaExpr.cpp4
-rw-r--r--clang/test/Lexer/constants.c16
4 files changed, 17 insertions, 14 deletions
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 918f13e2b41..4cedd11e219 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/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/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 3d9253db334..6eb3520c6ff 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/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/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index fc89b15c04e..c25d1195d8b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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/clang/test/Lexer/constants.c b/clang/test/Lexer/constants.c
index 104a3a2a2b2..b833e7b43f4 100644
--- a/clang/test/Lexer/constants.c
+++ b/clang/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}}
};
OpenPOWER on IntegriCloud