]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* c-common.c (c_common_reswords) add the alignof keyword,
authorVille Voutilainen <ville.voutilainen@gmail.com>
Tue, 25 Aug 2009 21:21:25 +0000 (00:21 +0300)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 25 Aug 2009 21:21:25 +0000 (17:21 -0400)
with same RID as __alignof and __alignof__

From-SVN: r151097

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

index 4d4a8e659f020a8891e1e9ab39ab37097f0a7244..03ffa9b00849f462696ef81d2c80611946f0f500 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 ee4991ad6238db6f2036b12ca19dd44b91a5731f..a19489c49df99312fd7c4475ff0f26a51398e803 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 702fb685ceb53a89c12f9d6d6a1c8d8c45828408..eff7d269e619eb3b0410db6adbf85e55e9e1a7b2 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)");
+}