OSDN Git Service

* c-common.c (reswords): Add _Imaginary.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 3 May 2009 14:07:41 +0000 (14:07 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 3 May 2009 14:07:41 +0000 (14:07 +0000)
* c-common.c (enum rid): Add RID_IMAGINARY.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147075 138bc75d-0d04-0410-961f-82ee72b054a4

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 4fd93e5..225919e 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 7ee7a09..d877c0f 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 616273a..1444880 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 bdb6f44..fe172c5 100644 (file)
@@ -1,5 +1,9 @@
 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.
 
 2009-05-02  Joseph Myers  <joseph@codesourcery.com>
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" } */