From patchwork Wed Aug 24 20:44:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9298317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16740607F0 for ; Wed, 24 Aug 2016 20:45:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 087F22911C for ; Wed, 24 Aug 2016 20:45:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F12AE2911E; Wed, 24 Aug 2016 20:44:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8A4E12911C for ; Wed, 24 Aug 2016 20:44:59 +0000 (UTC) Received: from localhost ([::1]:53287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcf2g-00021u-9T for patchwork-qemu-devel@patchwork.kernel.org; Wed, 24 Aug 2016 16:44:58 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=rRufe+6bAUullKtHuUJvDAUlHLmxi9P/HtwPdpaUvRw=; b=NVyDYYh2+p3Nd3EgZ7ymKO33a6Brha6d3b+WoQZvOwjmuzACCaiZuoDVWTZ8Gu3HKr lbpngd+EnXj36d57aTI5KSfwlc8viQtTB9GLJjIiF9JUELdQHi1jtxLSmFAvzKNtMGeM 1lLlJimV+bK79npn4ru+UAnyZnryUF4vF5uTq1pAzkRZ3uonTToafxhdX/4V8r48KPp4 fZ42HkQGeSxudLZZQ+tN9r3UBG+zqe2Q2nRgH6M8u5TOhbUaUG6d/ZEIlUsLEYI8iO+I iPMktffPs26VgjwBOlAx8juMuYmq/UqAyW+Jrt4Hfp23ihf3jN6545gM1kq+PA+ba4GM jU5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=rRufe+6bAUullKtHuUJvDAUlHLmxi9P/HtwPdpaUvRw=; b=lUE7MBrc7TYI3gmKqzAeyHABQ1YrtR36xt5m438A2LGR+PzByOWtewS0QKNzNEiMUG VqoCR1he6cnJAc+bTSBtcFy6i5qBAjAy5NCV6mF2iQCYilFebZEi1cUKcngg8wgFzQds UqnwQYcarALja4IoZG4A8K4w8UGgLx2UtG3cVK7eKC1WjUGMwYVo4dWhnMjoBx29pqeT qDFvxZjF5kfAHUrhFbOkY5A4unAS32yCWJdiu2YinQg7s2SWz8uRdlgKtLIlQKAX4Zq+ yUmCZYVDJP6A8EhnaY1u8wQSvSxf5wPn1ZABhSyB+RvJ0ARhE2d/iTg+XAYQlz/bjCYW 3tMA== X-Gm-Message-State: AEkooutTu6Je7pwct7Xi/tX5oWNyXTn7ub+xAXcppP9zhcK2qCIABH1OOiO/xAtTVJVD8Q== X-Received: by 10.37.92.215 with SMTP id q206mr4074720ybb.33.1472071471086; Wed, 24 Aug 2016 13:44:31 -0700 (PDT) Received: from evgadesktop.attlocal.net (108-232-152-155.lightspeed.tukrga.sbcglobal.net. [108.232.152.155]) by smtp.gmail.com with ESMTPSA id l81sm6276520ywb.56.2016.08.24.13.44.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Aug 2016 13:44:27 -0700 (PDT) From: Pranith Kumar To: qemu-devel@nongnu.org, Paolo Bonzini , "Emilio G. Cota" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster Date: Wed, 24 Aug 2016 16:44:21 -0400 Message-Id: <20160824204424.14041-1-bobby.prani@gmail.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c09::243 Subject: [Qemu-devel] [PATCH 1/3] atomics: Test __STDC_VERSION__ for C11 compat X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 */