aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Basic/DiagnosticGroups.td1
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td10
-rw-r--r--lib/Sema/SemaExpr.cpp4
-rw-r--r--test/Lexer/constants.c16
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}}
};