c-common.c (reswords): Add _Imaginary.
authorJoseph Myers <joseph@codesourcery.com>
Sun, 3 May 2009 14:07:41 +0000 (15:07 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Sun, 3 May 2009 14:07:41 +0000 (15:07 +0100)
* c-common.c (reswords): Add _Imaginary.
* c-common.c (enum rid): Add RID_IMAGINARY.

testsuite:
* gcc.dg/c99-complex-3.c: New test.

From-SVN: r147075

gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c99-complex-3.c [new file with mode: 0644]

index 4fd93e5d5c69a407ce72808e220622f174a50e39..225919e6ba4e9bdd20b9e6a530befb453f58b0a4 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-03  Joseph Myers  <joseph@codesourcery.com>
+
+       * c-common.c (reswords): Add _Imaginary.
+       * c-common.c (enum rid): Add RID_IMAGINARY.
+
 2009-05-03  Paolo Bonzini  <bonzini@gnu.org>
 
        * tree.h (TYPE_VECTOR_OPAQUE): Fix documentation.
index 7ee7a091963e442f16777f9dfaa4391a674487f0..d877c0f8469fa01fd6add27f454322e7e50f24f2 100644 (file)
@@ -730,6 +730,7 @@ const struct c_common_resword c_common_reswords[] =
 {
   { "_Bool",           RID_BOOL,      D_CONLY },
   { "_Complex",                RID_COMPLEX,    0 },
+  { "_Imaginary",      RID_IMAGINARY, D_CONLY },
   { "_Decimal32",       RID_DFLOAT32,  D_CONLY | D_EXT },
   { "_Decimal64",       RID_DFLOAT64,  D_CONLY | D_EXT },
   { "_Decimal128",      RID_DFLOAT128, D_CONLY | D_EXT },
index 616273ad5c19825e8dedda3a9da05218f98bbb2f..14448800ce09137c203f284f79993865b0f67bc6 100644 (file)
@@ -63,6 +63,10 @@ enum rid
   /* ObjC */
   RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
 
+  /* C (reserved and imaginary types not implemented, so any use is a
+     syntax error) */
+  RID_IMAGINARY,
+
   /* C */
   RID_INT,     RID_CHAR,   RID_FLOAT,    RID_DOUBLE, RID_VOID,
   RID_ENUM,    RID_STRUCT, RID_UNION,    RID_IF,     RID_ELSE,
index bdb6f4419268f7c94115d6970660a5d98efe651d..fe172c504963327760cfe2b90264fa56646614c6 100644 (file)
@@ -1,3 +1,7 @@
+2009-05-03  Joseph Myers  <joseph@codesourcery.com>
+
+       * gcc.dg/c99-complex-3.c: New test.
+
 2009-05-03  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc.dg/cpp/utf8-5byte-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/c99-complex-3.c b/gcc/testsuite/gcc.dg/c99-complex-3.c
new file mode 100644 (file)
index 0000000..f1f7a1f
--- /dev/null
@@ -0,0 +1,7 @@
+/* Test for _Imaginary: when imaginary types are not implemented, this
+   is still a keyword and must give a syntax error if used rather than
+   being treated as an identifier.  */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+float _Imaginary; /* { dg-error "expected" } */