diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-06-27 06:52:18 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-06-27 06:52:18 +0000 |
commit | 9698b078c86c21aa6a2a2fb4e5bc198f6f1df24c (patch) | |
tree | b588d0373131659bca29f2c2a1903cc3d85b46fb /gcc/c | |
parent | 4443341a9e4b33ead4365160127d0a51a2452c72 (diff) | |
download | gcc-9698b078c86c21aa6a2a2fb4e5bc198f6f1df24c.zip gcc-9698b078c86c21aa6a2a2fb4e5bc198f6f1df24c.tar.gz gcc-9698b078c86c21aa6a2a2fb4e5bc198f6f1df24c.tar.bz2 |
c-parser.c (c_parser_declaration_or_fndef): Discard all type qualifiers in __auto_type for atomic types.
* c-parser.c (c_parser_declaration_or_fndef): Discard all type
qualifiers in __auto_type for atomic types.
(c_parser_typeof_specifier): Discard all type qualifiers in
__typeof__ for atomic types.
* gcc.dg/typeof-2.c: New testcase.
From-SVN: r212062
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 21 |
2 files changed, 13 insertions, 15 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index d1837c2..fa7caac 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2014-06-27 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * c-parser.c (c_parser_declaration_or_fndef): Discard all type + qualifiers in __auto_type for atomic types. + (c_parser_typeof_specifier): Discard all type qualifiers in + __typeof__ for atomic types. + 2014-06-25 Marek Polacek <polacek@redhat.com> PR c/61162 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 5842320..797d1bc 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -1720,14 +1720,10 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, " initializer"); init = convert_lvalue_to_rvalue (init_loc, init, true, true); tree init_type = TREE_TYPE (init.value); - /* As with typeof, remove _Atomic and const - qualifiers from atomic types. */ + /* As with typeof, remove all qualifiers from atomic types. */ if (init_type != error_mark_node && TYPE_ATOMIC (init_type)) init_type - = c_build_qualified_type (init_type, - (TYPE_QUALS (init_type) - & ~(TYPE_QUAL_ATOMIC - | TYPE_QUAL_CONST))); + = c_build_qualified_type (init_type, TYPE_UNQUALIFIED); bool vm_type = variably_modified_type_p (init_type, NULL_TREE); if (vm_type) @@ -3024,16 +3020,11 @@ c_parser_typeof_specifier (c_parser *parser) if (was_vm) ret.expr = c_fully_fold (expr.value, false, &ret.expr_const_operands); pop_maybe_used (was_vm); - /* For use in macros such as those in <stdatomic.h>, remove - _Atomic and const qualifiers from atomic types. (Possibly - all qualifiers should be removed; const can be an issue for - more macros using typeof than just the <stdatomic.h> - ones.) */ + /* For use in macros such as those in <stdatomic.h>, remove all + qualifiers from atomic types. (const can be an issue for more macros + using typeof than just the <stdatomic.h> ones.) */ if (ret.spec != error_mark_node && TYPE_ATOMIC (ret.spec)) - ret.spec = c_build_qualified_type (ret.spec, - (TYPE_QUALS (ret.spec) - & ~(TYPE_QUAL_ATOMIC - | TYPE_QUAL_CONST))); + ret.spec = c_build_qualified_type (ret.spec, TYPE_UNQUALIFIED); } c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>"); return ret; |