Ensure we diagnose long long literals in C90 mode.
llvm-svn: 41581
This commit is contained in:
parent
4e5f99da6c
commit
ac582c5ecb
|
@ -167,6 +167,11 @@ static bool EvaluateValue(llvm::APSInt &Result, Token &PeekTok,
|
|||
}
|
||||
assert(Literal.isIntegerLiteral() && "Unknown ppnumber");
|
||||
|
||||
// long long is a C99 feature.
|
||||
if (!PP.getLangOptions().C99 && !PP.getLangOptions().CPlusPlus0x
|
||||
&& Literal.isLongLong)
|
||||
PP.Diag(PeekTok, diag::ext_longlong);
|
||||
|
||||
// Parse the integer literal into Result.
|
||||
if (Literal.GetIntegerValue(Result)) {
|
||||
// Overflow parsing integer literal.
|
||||
|
|
|
@ -156,6 +156,11 @@ Action::ExprResult Sema::ParseNumericConstant(const Token &Tok) {
|
|||
} else {
|
||||
QualType t;
|
||||
|
||||
// long long is a C99 feature.
|
||||
if (!getLangOptions().C99 && !getLangOptions().CPlusPlus0x &&
|
||||
Literal.isLongLong)
|
||||
Diag(Tok.getLocation(), diag::ext_longlong);
|
||||
|
||||
// Get the value in the widest-possible width.
|
||||
llvm::APInt ResultVal(Context.Target.getIntMaxTWidth(Tok.getLocation()), 0);
|
||||
|
||||
|
|
|
@ -24,3 +24,8 @@ long long test2; /* expected-warning {{extension}} */
|
|||
void test3(int i) {
|
||||
int A[i]; /* expected-warning {{variable length array}} */
|
||||
}
|
||||
|
||||
int test4 = 0LL; /* expected-warning {{long long}} */
|
||||
|
||||
#if 1LL /* expected-warning {{long long}} */
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue