diff options
author | Martin Uecker <muecker@gwdg.de> | 2020-11-26 08:12:12 +0100 |
---|---|---|
committer | Martin Uecker <muecker@gwdg.de> | 2020-11-26 08:22:38 +0100 |
commit | 768ce4f0ceb030e38427e85e483ed44330cd5da7 (patch) | |
tree | 62d7ca90f39ead505ccca0416451442db50b3c0e /gcc/ginclude | |
parent | 8f81f43f606cd915e96c857c007a4635fc0ea601 (diff) | |
download | gcc-768ce4f0ceb030e38427e85e483ed44330cd5da7.zip gcc-768ce4f0ceb030e38427e85e483ed44330cd5da7.tar.gz gcc-768ce4f0ceb030e38427e85e483ed44330cd5da7.tar.bz2 |
C: Do not drop qualifiers in typeof for _Atomic types. [PR65455,PR92935]
2020-11-25 Martin Uecker <muecker@gwdg.de>
gcc/c/
PR c/65455
PR c/92935
* c-parser.c (c_parser_declaration_or_fndef): Remove
redundant code to drop qualifiers of _Atomic types for __auto_type.
(c_parser_typeof_specifier): Do not drop qualifiers of _Atomic
types for __typeof__.
gcc/
PR c/65455
PR c/92935
* ginclude/stdatomic.h: Use comma operator to drop qualifiers.
gcc/testsuite/
PR c/65455
PR c/92935
* gcc.dg/typeof-2.c: Adapt test.
Diffstat (limited to 'gcc/ginclude')
-rw-r--r-- | gcc/ginclude/stdatomic.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/ginclude/stdatomic.h b/gcc/ginclude/stdatomic.h index b968164..7c2e08a 100644 --- a/gcc/ginclude/stdatomic.h +++ b/gcc/ginclude/stdatomic.h @@ -107,7 +107,7 @@ extern void atomic_signal_fence (memory_order); #define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE -/* Note that these macros require __typeof__ and __auto_type to remove +/* Note that these macros require __auto_type to remove _Atomic qualifiers (and const qualifiers, if those are valid on macro operands). @@ -122,7 +122,7 @@ extern void atomic_signal_fence (memory_order); __extension__ \ ({ \ __auto_type __atomic_store_ptr = (PTR); \ - __typeof__ (*__atomic_store_ptr) __atomic_store_tmp = (VAL); \ + __typeof__ ((void)0, *__atomic_store_ptr) __atomic_store_tmp = (VAL); \ __atomic_store (__atomic_store_ptr, &__atomic_store_tmp, (MO)); \ }) @@ -134,7 +134,7 @@ extern void atomic_signal_fence (memory_order); __extension__ \ ({ \ __auto_type __atomic_load_ptr = (PTR); \ - __typeof__ (*__atomic_load_ptr) __atomic_load_tmp; \ + __typeof__ ((void)0, *__atomic_load_ptr) __atomic_load_tmp; \ __atomic_load (__atomic_load_ptr, &__atomic_load_tmp, (MO)); \ __atomic_load_tmp; \ }) @@ -146,8 +146,8 @@ extern void atomic_signal_fence (memory_order); __extension__ \ ({ \ __auto_type __atomic_exchange_ptr = (PTR); \ - __typeof__ (*__atomic_exchange_ptr) __atomic_exchange_val = (VAL); \ - __typeof__ (*__atomic_exchange_ptr) __atomic_exchange_tmp; \ + __typeof__ ((void)0, *__atomic_exchange_ptr) __atomic_exchange_val = (VAL); \ + __typeof__ ((void)0, *__atomic_exchange_ptr) __atomic_exchange_tmp; \ __atomic_exchange (__atomic_exchange_ptr, &__atomic_exchange_val, \ &__atomic_exchange_tmp, (MO)); \ __atomic_exchange_tmp; \ @@ -161,7 +161,7 @@ extern void atomic_signal_fence (memory_order); __extension__ \ ({ \ __auto_type __atomic_compare_exchange_ptr = (PTR); \ - __typeof__ (*__atomic_compare_exchange_ptr) __atomic_compare_exchange_tmp \ + __typeof__ ((void)0, *__atomic_compare_exchange_ptr) __atomic_compare_exchange_tmp \ = (DES); \ __atomic_compare_exchange (__atomic_compare_exchange_ptr, (VAL), \ &__atomic_compare_exchange_tmp, 0, \ @@ -176,7 +176,7 @@ extern void atomic_signal_fence (memory_order); __extension__ \ ({ \ __auto_type __atomic_compare_exchange_ptr = (PTR); \ - __typeof__ (*__atomic_compare_exchange_ptr) __atomic_compare_exchange_tmp \ + __typeof__ ((void)0, *__atomic_compare_exchange_ptr) __atomic_compare_exchange_tmp \ = (DES); \ __atomic_compare_exchange (__atomic_compare_exchange_ptr, (VAL), \ &__atomic_compare_exchange_tmp, 1, \ |