def ext_integer_too_large_for_signed : ExtWarn< - "integer constant is larger than the largest %0-bit signed integer type">, - InGroup<DiagGroup<"implicitly-unsigned-literal">>; + "integer constant evaluates to value %0 that cannot be represented as a " + "%1-bit signed integer">, InGroup<DiagGroup<"implicitly-unsigned-literal">>;
This should probably go on to say that we're interpreting the value as unsigned. 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) On Tue, Jul 22, 2014 at 3:31 PM, Aaron Ballman <aa...@aaronballman.com> wrote: > On Tue, Jul 22, 2014 at 4:34 PM, Richard Smith <rich...@metafoo.co.uk> > wrote: > > > > On 22 Jul 2014 07:22, "Aaron Ballman" <aa...@aaronballman.com> wrote: > >> > >> Author: aaronballman > >> Date: Tue Jul 22 09:08:09 2014 > >> New Revision: 213657 > >> > >> URL: http://llvm.org/viewvc/llvm-project?rev=213657&view=rev > >> Log: > >> Provide extra information in the "integer constant is too large" > >> diagnostic. This will be used to improve other diagnostics. > >> > >> Modified: > >> cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td > >> cfe/trunk/lib/Lex/PPExpressions.cpp > >> cfe/trunk/lib/Sema/SemaExpr.cpp > >> cfe/trunk/test/CXX/lex/lex.literal/lex.ext/p3.cpp > >> cfe/trunk/test/Lexer/constants.c > >> cfe/trunk/test/Sema/128bitint.c > >> > >> Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td > >> URL: > >> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=213657&r1=213656&r2=213657&view=diff > >> > >> > ============================================================================== > >> --- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original) > >> +++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Tue Jul 22 > >> 09:08:09 2014 > >> @@ -103,9 +103,9 @@ def warn_cxx98_compat_longlong : Warning > >> "'long long' is incompatible with C++98">, > >> InGroup<CXX98CompatPedantic>, DefaultIgnore; > >> def err_integer_too_large : Error< > >> - "integer constant is larger than the largest unsigned integer type">; > >> + "integer constant is larger than the largest %0-bit unsigned integer > >> type">; > > > > The wording here could be better -- all 32-bit integer types are the same > > size, by definition. > > > > Perhaps "integer constant evaluates to value %0 that cannot be > represented > > as a %1-bit %select{signed|unsigned}2 integer"? > > Something like this? > > ~Aaron >
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits