r213657 - Provide extra information in the "integer constant is too large" diagnostic. This will be used to improve other diagnostics.

Aaron Ballman aaron at aaronballman.com
Tue Jul 22 17:38:01 PDT 2014


How do these sound to you?

On Tue, Jul 22, 2014 at 8:13 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> +def err_integer_literal_too_large : Error<
> +  "integer literal is a value that cannot be represented as %select{a|an}0
> "
> +  "%select{signed|unsigned}0 integer">;
>
> I don't think the "is a value that" adds anything here. Also, I'd like to
> see something that more directly says we don't have a signed/unsigned
> integer type large enough.

"integer literal is too large to be represented in %select{a|an}0
%select{signed|unsigned}0 integer type"

>  def err_integer_too_large : Error<
> -  "integer constant is larger than the largest %0-bit unsigned integer
> type">;
> -def ext_integer_too_large_for_signed : ExtWarn<
> -  "integer constant is larger than the largest %0-bit signed integer
> type">,
> +  "integer constant evaluates to value %0 that cannot be represented as a "
> +  "%1-bit %select{signed|unsigned}2 integer">;
>
> Please rename this to something about ICEs, and move it to
> DiagnosticSemaKinds next to the existing err_ice_ diagnostics. (This is
> pretty similar to ext_cce_narrowing...)
>
>
> +def ext_integer_literal_too_large_for_signed : ExtWarn<
> +  "integer literal is a value that cannot be represented as a signed
> integer, "
> +  "and will instead be interpreted as unsigned">,
>
> Again, mentioning integer types and not just integers would make this
> clearer.

"integer literal is too large to be represented in a signed integer
type, and will instead be interpreted as unsigned integer type"

~Aaron



More information about the cfe-commits mailing list