[cfe-dev] More long long

Neil Booth neil at daikokuya.co.uk
Wed Aug 29 04:23:43 PDT 2007


Chris Lattner wrote:-

> Look great to me.  Also Lex/PPExpressions.cpp might need the same fix.
> 
> #if 1LL
> 
> ?
> 
> -Chris

Ugh, yes, imagine a front end where this stuff isn't in one place ;)

OK for attached?

Neil.
-------------- next part --------------
Index: test/Sema/c89.c
===================================================================
--- test/Sema/c89.c	(revision 41562)
+++ test/Sema/c89.c	(working copy)
@@ -24,3 +24,8 @@
 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
Index: Sema/SemaExpr.cpp
===================================================================
--- Sema/SemaExpr.cpp	(revision 41562)
+++ Sema/SemaExpr.cpp	(working copy)
@@ -156,6 +156,11 @@
   } 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);
    
Index: Lex/PPExpressions.cpp
===================================================================
--- Lex/PPExpressions.cpp	(revision 41562)
+++ Lex/PPExpressions.cpp	(working copy)
@@ -167,6 +167,11 @@
     }
     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.


More information about the cfe-dev mailing list