From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1105) id 747BC38515D2; Mon, 12 Sep 2022 14:35:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 747BC38515D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662993334; bh=023jbvvakXbkmA9mXg5MBikFtk+yfn98vnkjm/m+XJ0=; h=From:To:Subject:Date:From; b=wmOvUUdm9vKg15EIw9QcNlPYyQScSr8wtx/8YORVkdVJjhyfhlwpEArFSeqcLaG2L ikLBCPFwjEUrV1UO62ebruL6O87UlF5876Yz+8WQUJh/G8w6EF1lgV7nHbvV0stdgK RxtPEGY4eDilc/goeD1fMOW7RQdPtjbqv863+W8Y= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Joseph Myers To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2626] stdatomic.h: Do not define ATOMIC_VAR_INIT for C2x X-Act-Checkin: gcc X-Git-Author: Joseph Myers X-Git-Refname: refs/heads/master X-Git-Oldrev: 6b43f556f392a7165582aca36a19fe7389d995b2 X-Git-Newrev: 2e7bc76d84f0aa2f08bc01407ffcdca43c15f2ff Message-Id: <20220912143534.747BC38515D2@sourceware.org> Date: Mon, 12 Sep 2022 14:35:34 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2e7bc76d84f0aa2f08bc01407ffcdca43c15f2ff commit r13-2626-g2e7bc76d84f0aa2f08bc01407ffcdca43c15f2ff Author: Joseph Myers Date: Mon Sep 12 14:34:26 2022 +0000 stdatomic.h: Do not define ATOMIC_VAR_INIT for C2x The 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. Diff: --- gcc/ginclude/stdatomic.h | 2 ++ gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-var-init-1.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/gcc/ginclude/stdatomic.h b/gcc/ginclude/stdatomic.h index 9f2475b739d..a56ba5d9639 100644 --- a/gcc/ginclude/stdatomic.h +++ b/gcc/ginclude/stdatomic.h @@ -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) \ diff --git a/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-var-init-1.c b/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-var-init-1.c new file mode 100644 index 00000000000..1978a410350 --- /dev/null +++ b/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-var-init-1.c @@ -0,0 +1,9 @@ +/* Test ATOMIC_VAR_INIT not in C2x. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#include + +#ifdef ATOMIC_VAR_INIT +#error "ATOMIC_VAR_INIT defined" +#endif