OSDN Git Service

* c-common.c (c_common_reswords) add the alignof keyword,
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Aug 2009 21:21:25 +0000 (21:21 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Aug 2009 21:21:25 +0000 (21:21 +0000)
with same RID as __alignof and __alignof__

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

gcc/ChangeLog
gcc/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/alignof.C [new file with mode: 0644]

index 4d4a8e6..03ffa9b 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-25 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+       * c-common.c (c_common_reswords) add the alignof keyword,
+       with same RID as __alignof and __alignof__
+
 2009-08-25  Anatoly Sokolov  <aesok@post.ru>
 
        * hooks.h (hook_bool_const_int_const_int_true): Declare.
index ee4991a..a19489c 100644 (file)
@@ -619,6 +619,7 @@ const struct c_common_resword c_common_reswords[] =
   { "__typeof__",      RID_TYPEOF,     0 },
   { "__volatile",      RID_VOLATILE,   0 },
   { "__volatile__",    RID_VOLATILE,   0 },
+  { "alignof",         RID_ALIGNOF,    D_CXXONLY | D_CXX0X | D_CXXWARN },
   { "asm",             RID_ASM,        D_ASM },
   { "auto",            RID_AUTO,       0 },
   { "bool",            RID_BOOL,       D_CXXONLY | D_CXXWARN },
index 702fb68..eff7d26 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-25 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+       * g++.dg/cpp0x/alignof.C: New. Tests that the alignof
+       keyword works in the same manner as __alignof.
+
 2009-08-25  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR libfortran/34670
diff --git a/gcc/testsuite/g++.dg/cpp0x/alignof.C b/gcc/testsuite/g++.dg/cpp0x/alignof.C
new file mode 100644 (file)
index 0000000..8e8f715
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-options "-std=c++0x" }
+int main(void)
+{
+  static_assert(alignof(int) == __alignof(int), "alignof(int) does not equal __alignof(int)");
+}