<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 22, 2014 at 3:39 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div> def ext_integer_too_large_for_signed : ExtWarn<</div><div class=""><div>-  "integer constant is larger than the largest %0-bit signed integer type">,</div>
</div><div>-  InGroup<DiagGroup<"implicitly-unsigned-literal">>;</div><div class="">
<div>+  "integer constant evaluates to value %0 that cannot be represented as a "</div></div><div>+  "%1-bit signed integer">, InGroup<DiagGroup<"implicitly-unsigned-literal">>;</div>

<div><br></div><div>This should probably go on to say that we're interpreting the value as unsigned.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I also think we should have separate diagnostics for the case where we evaluate a constant expression (which should include the 'evaluates to value %0' part) and the case where it's a literal (where we shouldn't). We don't need to repeat things that are literally present in the source code. (Sorry for suggesting the unconditional change here, I hadn't really looked at the use cases other than the one in SemaDeclAttr.cpp)</div>
</div></blockquote><div><br></div><div>Actually, more than this, I think the original diagnostic text was better than any of the updated wordings in the case of a literal. The bit-width is incidental; the point is that the literal doesn't fit in the largest signed type.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div><div class="h5"><div class="gmail_quote">On Tue, Jul 22, 2014 at 3:31 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div>On Tue, Jul 22, 2014 at 4:34 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>> wrote:<br>
><br>
> On 22 Jul 2014 07:22, "Aaron Ballman" <<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>> wrote:<br>
>><br>
>> Author: aaronballman<br>
>> Date: Tue Jul 22 09:08:09 2014<br>
>> New Revision: 213657<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=213657&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=213657&view=rev</a><br>
>> Log:<br>
>> Provide extra information in the "integer constant is too large"<br>
>> diagnostic. This will be used to improve other diagnostics.<br>
>><br>
>> Modified:<br>
>>     cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td<br>
>>     cfe/trunk/lib/Lex/PPExpressions.cpp<br>
>>     cfe/trunk/lib/Sema/SemaExpr.cpp<br>
>>     cfe/trunk/test/CXX/lex/lex.literal/lex.ext/p3.cpp<br>
>>     cfe/trunk/test/Lexer/constants.c<br>
>>     cfe/trunk/test/Sema/128bitint.c<br>
>><br>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=213657&r1=213656&r2=213657&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=213657&r1=213656&r2=213657&view=diff</a><br>


>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)<br>
>> +++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Tue Jul 22<br>
>> 09:08:09 2014<br>
>> @@ -103,9 +103,9 @@ def warn_cxx98_compat_longlong : Warning<br>
>>    "'long long' is incompatible with C++98">,<br>
>>    InGroup<CXX98CompatPedantic>, DefaultIgnore;<br>
>>  def err_integer_too_large : Error<<br>
>> -  "integer constant is larger than the largest unsigned integer type">;<br>
>> +  "integer constant is larger than the largest %0-bit unsigned integer<br>
>> type">;<br>
><br>
> The wording here could be better -- all 32-bit integer types are the same<br>
> size, by definition.<br>
><br>
> Perhaps "integer constant evaluates to value %0 that cannot be represented<br>
> as a %1-bit %select{signed|unsigned}2 integer"?<br>
<br>
</div></div>Something like this?<br>
<span><font color="#888888"><br>
~Aaron<br>
</font></span></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>