diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-04-25 10:12:01 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-04-25 10:12:01 +0000 |
commit | c3468fc21b6cbf9198df3a0a7311202a3e2f33ac (patch) | |
tree | b741b6d5a143c86b8739b94b471710bc0857833a /gcc/c/c-decl.c | |
parent | 9ede41c550c1cfd052d4729dc14de43a539963f0 (diff) | |
download | gcc-c3468fc21b6cbf9198df3a0a7311202a3e2f33ac.tar.gz |
PR c/52085
* c-decl.c (finish_enum): Copy over TYPE_ALIGN. Also check for "mode"
attribute.
* gcc.dg/enum-incomplete-2.c: New test.
* gcc.dg/enum-mode-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222440 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r-- | gcc/c/c-decl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 27ecd8bf513..4f6761d2392 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -8010,11 +8010,13 @@ finish_enum (tree enumtype, tree values, tree attributes) TYPE_MIN_VALUE (enumtype) = TYPE_MIN_VALUE (tem); TYPE_MAX_VALUE (enumtype) = TYPE_MAX_VALUE (tem); TYPE_UNSIGNED (enumtype) = TYPE_UNSIGNED (tem); + TYPE_ALIGN (enumtype) = TYPE_ALIGN (tem); TYPE_SIZE (enumtype) = 0; - /* If the precision of the type was specific with an attribute and it + /* If the precision of the type was specified with an attribute and it was too small, give an error. Otherwise, use it. */ - if (TYPE_PRECISION (enumtype)) + if (TYPE_PRECISION (enumtype) + && lookup_attribute ("mode", attributes)) { if (precision > TYPE_PRECISION (enumtype)) error ("specified mode too small for enumeral values"); |