[cfe-commits] r97284 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/Lexer/constants.c

Chris Lattner clattner at apple.com
Fri Feb 26 15:45:03 PST 2010


On Feb 26, 2010, at 3:35 PM, John McCall wrote:

> Author: rjmccall
> Date: Fri Feb 26 17:35:57 2010
> New Revision: 97284
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=97284&view=rev
> Log:
> At sabre's request, drop the FP bounds diagnostics down to warnings and file
> them under -Wbad-literal.  They're still on by default.

If you'd like, you can still default them to error,  that allows people to shut it up with -Wno-error=bad-literal   Also, please add the BadLiteral group to the "NotGCC" group.

-Chris

> 
> 
> Modified:
>    cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>    cfe/trunk/lib/Sema/SemaExpr.cpp
>    cfe/trunk/test/Lexer/constants.c
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=97284&r1=97283&r2=97284&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Feb 26 17:35:57 2010
> @@ -24,6 +24,7 @@
> 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">;
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=97284&r1=97283&r2=97284&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Feb 26 17:35:57 2010
> @@ -29,10 +29,12 @@
> // 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<
> 
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=97284&r1=97283&r2=97284&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Feb 26 17:35:57 2010
> @@ -1736,10 +1736,10 @@
>       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);
>       }
> 
> 
> Modified: cfe/trunk/test/Lexer/constants.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/constants.c?rev=97284&r1=97283&r2=97284&view=diff
> ==============================================================================
> --- cfe/trunk/test/Lexer/constants.c (original)
> +++ cfe/trunk/test/Lexer/constants.c Fri Feb 26 17:35:57 2010
> @@ -38,20 +38,20 @@
> 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}}
> };
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list