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/c-tree.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/c-tree.h')
-rw-r--r-- | gcc/c-tree.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c-tree.h b/gcc/c-tree.h index b3e756c..6801db2 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -238,6 +238,10 @@ struct c_declspecs { NULL; attributes (possibly from multiple lists) will be passed separately. */ tree attrs; + /* The base-2 log of the greatest alignment required by an _Alignas + specifier, in bytes, or -1 if no such specifiers with nonzero + alignment. */ + int align_log; /* The storage class specifier, or csc_none if none. */ enum c_storage_class storage_class; /* Any type specifier keyword used such as "int", not reflecting @@ -294,6 +298,9 @@ struct c_declspecs { BOOL_BITFIELD restrict_p : 1; /* Whether "_Sat" was specified. */ BOOL_BITFIELD saturating_p : 1; + /* Whether any alignment specifier (even with zero alignment) was + specified. */ + BOOL_BITFIELD alignas_p : 1; /* The address space that the declaration belongs to. */ addr_space_t address_space; }; @@ -510,6 +517,7 @@ extern struct c_declspecs *declspecs_add_scspec (struct c_declspecs *, tree); extern struct c_declspecs *declspecs_add_attrs (struct c_declspecs *, tree); extern struct c_declspecs *declspecs_add_addrspace (struct c_declspecs *, addr_space_t); +extern struct c_declspecs *declspecs_add_alignas (struct c_declspecs *, tree); extern struct c_declspecs *finish_declspecs (struct c_declspecs *); /* in c-objc-common.c */ |