Skip to content
Snippets Groups Projects
Commit 2e7bc76d authored by Joseph Myers's avatar Joseph Myers
Browse files

stdatomic.h: Do not define ATOMIC_VAR_INIT for C2x

The <stdatomic.h> macro ATOMIC_VAR_INIT, previously declared obsolete,
is removed completely in C2x; disable it for C2x in GCC's
implementation.  (Although ATOMIC_* are reserved names for this
header, disabling the macro for C2x still seems appropriate.)

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/
	* ginclude/stdatomic.h [defined __STDC_VERSION__ &&
	__STDC_VERSION__ > 201710L] (ATOMIC_VAR_INIT): Do not define.

gcc/testsuite/
	* gcc.dg/atomic/c2x-stdatomic-var-init-1.c: New test.
parent 6b43f556
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,9 @@ typedef _Atomic __INTMAX_TYPE__ atomic_intmax_t;
typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t;
#if !(defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L)
#define ATOMIC_VAR_INIT(VALUE) (VALUE)
#endif
/* Initialize an atomic object pointed to by PTR with VAL. */
#define atomic_init(PTR, VAL) \
......
/* Test ATOMIC_VAR_INIT not in C2x. */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
#include <stdatomic.h>
#ifdef ATOMIC_VAR_INIT
#error "ATOMIC_VAR_INIT defined"
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment