[cfe-commits] r173461 - in /cfe/trunk: include/clang/Basic/DiagnosticASTKinds.td test/Sema/switch-1.c

Jordan Rose jordan_rose at apple.com
Fri Jan 25 09:30:55 PST 2013


On Jan 25, 2013, at 9:19 , Fariborz Jahanian <fjahanian at apple.com> wrote:

> Author: fjahanian
> Date: Fri Jan 25 11:19:07 2013
> New Revision: 173461
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=173461&view=rev
> Log:
> Improve diagnsotic further on integer overflow.
> 
> 
> Modified:
>    cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
>    cfe/trunk/test/Sema/switch-1.c
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td?rev=173461&r1=173460&r2=173461&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td Fri Jan 25 11:19:07 2013
> @@ -107,7 +107,7 @@
>   "see all)">;
> def note_constexpr_call_here : Note<"in call to '%0'">;
> def warn_integer_constant_overflow : Warning<
> -  "overflow of constant expression results in value %0 of type %1">,
> +  "overflow in expression;result is %0 with type %1">,

You're missing a space after the semicolon.

I feel like "in expression" is now useless, since you can hardly have overflow in something that's not an expression, but I can't come up with anything better.


>   InGroup<DiagGroup<"integer-overflow">>;
> 
> // inline asm related.
> 
> Modified: cfe/trunk/test/Sema/switch-1.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/switch-1.c?rev=173461&r1=173460&r2=173461&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/switch-1.c (original)
> +++ cfe/trunk/test/Sema/switch-1.c Fri Jan 25 11:19:07 2013
> @@ -4,14 +4,15 @@
> 
> int f(int i) {
>   switch (i) {
> -    case 2147483647 + 2: // expected-warning {{overflow of constant expression results in value -2147483647 of type 'int'}}
> +    case 2147483647 + 2: // expected-warning {{overflow in expression;result is -2147483647 with type 'int'}}
>       return 1;
> -    case 9223372036854775807L * 4: // expected-warning {{overflow of constant expression results in value -4 of type 'long'}}
> +    case 9223372036854775807L * 4: // expected-warning {{overflow in expression;result is -4 with type 'long'}}
>       return 2;
> -    case (123456 *789012) + 1:  // expected-warning {{overflow of constant expression results in value -1375982336 of type 'int'}}
> +    case (123456 *789012) + 1:  // expected-warning {{overflow in expression;result is -1375982336 with type 'int'}}
>       return 3;
>     case 2147483647:
>       return 0;
>   }
> -  return 0;
> +  return (i, 65537) * 65537; // expected-warning {{overflow in expression;result is 131073 with type 'int'}} \
> +			     // expected-warning {{expression result unused}}
> }
> 
> 
> _______________________________________________
> 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