Received: from eggs.gnu.org ([2001:4830:134:3::10]:33833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcf2J-00020c-Uc for qemu-devel@nongnu.org; Wed, 24 Aug 2016 16:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcf2F-0004SJ-SN for qemu-devel@nongnu.org; Wed, 24 Aug 2016 16:44:35 -0400 Received: from mail-yb0-x243.google.com ([2607:f8b0:4002:c09::243]:36324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcf2F-0004S8-Oe for qemu-devel@nongnu.org; Wed, 24 Aug 2016 16:44:31 -0400 Received: by mail-yb0-x243.google.com with SMTP id f60so794171ybi.3 for ; Wed, 24 Aug 2016 13:44:31 -0700 (PDT) From: Pranith Kumar Date: Wed, 24 Aug 2016 16:44:21 -0400 Message-Id: <20160824204424.14041-1-bobby.prani@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 1/3] atomics: Test __STDC_VERSION__ for C11 compat List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Paolo Bonzini , "Emilio G. Cota" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster This patch tries to do the Right Thing™ to test for C11 features, which is to test __STDC_VERSION__. Signed-off-by: Pranith Kumar --- include/qemu/atomic.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 43b0645..d313e6b 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -60,7 +60,7 @@ (unsigned short)1, \ (expr)+0)))))) -#ifdef __ATOMIC_RELAXED +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* For C11 atomic ops */ /* Manual memory barriers @@ -210,7 +210,7 @@ #define atomic_and(ptr, n) ((void) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST)) #define atomic_or(ptr, n) ((void) __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST)) -#else /* __ATOMIC_RELAXED */ +#else /* __STDC_VERSION__ */ /* * We use GCC builtin if it's available, as that can use mfence on @@ -405,5 +405,5 @@ #define atomic_and(ptr, n) ((void) __sync_fetch_and_and(ptr, n)) #define atomic_or(ptr, n) ((void) __sync_fetch_and_or(ptr, n)) -#endif /* __ATOMIC_RELAXED */ +#endif /* __STDC_VERSION__ */ #endif /* QEMU_ATOMIC_H */ -- 2.9.3