diff options
author | Joseph Myers <joseph@codesourcery.com> | 2011-11-06 23:51:19 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2011-11-06 23:51:19 +0000 |
commit | d19fa6b5f1372429e56c2d4f8d384ed388a22d21 (patch) | |
tree | 665bdd624cc911e728a962281f278e5fbf2aefce /gcc/ginclude/stdalign.h | |
parent | 55d2e499d693df45f3065f8bf9f654fd816ae0fb (diff) | |
download | gcc-d19fa6b5f1372429e56c2d4f8d384ed388a22d21.zip gcc-d19fa6b5f1372429e56c2d4f8d384ed388a22d21.tar.gz gcc-d19fa6b5f1372429e56c2d4f8d384ed388a22d21.tar.bz2 |
c-decl.c (shadow_tag_warned, [...]): Handle _Alignas specifiers.
* c-decl.c (shadow_tag_warned, grokdeclarator): Handle _Alignas
specifiers.
(build_null_declspecs): Initialize align_log and alignas_p fields.
(declspecs_add_alignas): New.
* c-parser.c (c_token_starts_declspecs): Handle RID_ALIGNAS.
(c_parser_declspecs): Handle _Alignas specifiers.
(c_parser_alignas_specifier): New.
(c_parser_alignof_expression): Diagnose alignof use for non-C1X.
Diagnose _Alignof (expression).
* c-tree.h (struct c_declspecs): Add align_log and alignas_p
fields.
(declspecs_add_alignas): Declare.
* ginclude/stddef.h (max_align_t): Define for C1X and C++11.
* ginclude/stdalign.h: New.
* Makefile.in (USER_H): Add stdalign.h.
c-family:
* c-common.c (c_common_reswords): Add _Alignas and _Alignof.
(c_sizeof_or_alignof_type): Diagnose alignof applied to a function
type.
(check_user_alignment): New. Split out of
handle_aligned_attribute. Disallow integer constants with
noninteger types. Conditionally allow zero.
(handle_aligned_attribute): Use check_user_alignment.
* c-common.h (RID_ALIGNAS, check_user_alignment): New.
testsuite:
* g++.dg/cpp0x/alignof3.C, gcc.dg/c1x-align-1.c,
gcc.dg/c1x-align-2.c, gcc.dg/c1x-align-3.c, gcc.dg/c1x-align-4.c,
gcc.dg/c90-align-1.c, gcc.dg/c99-align-1.c: New tests.
* gcc.dg/gnu89-const-expr-1.c, gcc.dg/gnu90-const-expr-1.c,
gcc.dg/gnu99-const-expr-1.c, gcc.dg/gnu99-static-1.c: Update
expected diagnostics.
From-SVN: r181048
Diffstat (limited to 'gcc/ginclude/stdalign.h')
-rw-r--r-- | gcc/ginclude/stdalign.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/ginclude/stdalign.h b/gcc/ginclude/stdalign.h new file mode 100644 index 0000000..fd55ed3 --- /dev/null +++ b/gcc/ginclude/stdalign.h @@ -0,0 +1,39 @@ +/* Copyright (C) 2011 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +/* ISO C1X: 7.15 Alignment <stdalign.h>. */ + +#ifndef _STDALIGN_H +#define _STDALIGN_H + +#ifndef __cplusplus + +#define alignas _Alignas +#define alignof _Alignof + +#define __alignas_is_defined 1 +#define __alignof_is_defined 1 + +#endif + +#endif /* stdalign.h */ |