[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/13] tests/test-int128: Don't use __noclone__ attri
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 07/13] tests/test-int128: Don't use __noclone__ attribute on clang |
Date: |
Tue, 4 Mar 2014 10:15:55 +0400 |
From: Peter Maydell <address@hidden>
clang doesn't support the __noclone__ attribute and emits a warning about
it. Fortunately clang also implements a mechanism for asking if a particular
attribute is implemented; use it. We assume that if the compiler doesn't
support __has_attribute() then it must be GCC and must support __noclone__.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
tests/test-int128.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tests/test-int128.c b/tests/test-int128.c
index 5aca032..0772ef7 100644
--- a/tests/test-int128.c
+++ b/tests/test-int128.c
@@ -11,6 +11,19 @@
#include "qemu/int128.h"
#include "qemu/osdep.h"
+/* clang doesn't support __noclone__ but it does have a mechanism for
+ * telling us this. We assume that if we don't have __has_attribute()
+ * then this is GCC and that GCC always supports __noclone__.
+ */
+#if defined(__has_attribute)
+#if !__has_attribute(__noclone__)
+#define ATTRIBUTE_NOCLONE
+#endif
+#endif
+#ifndef ATTRIBUTE_NOCLONE
+#define ATTRIBUTE_NOCLONE __attribute__((__noclone__))
+#endif
+
static uint32_t tests[8] = {
0x00000000, 0x00000001, 0x7FFFFFFE, 0x7FFFFFFF,
0x80000000, 0x80000001, 0xFFFFFFFE, 0xFFFFFFFF,
@@ -164,7 +177,7 @@ static void test_gt(void)
/* Make sure to test undefined behavior at runtime! */
-static void __attribute__((__noinline__, __noclone__))
+static void __attribute__((__noinline__)) ATTRIBUTE_NOCLONE
test_rshift_one(uint32_t x, int n, uint64_t h, uint64_t l)
{
Int128 a = expand(x);
--
1.7.10.4
- [Qemu-devel] [PULL 00/13] Trivial patches for 2014-03-04, Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 05/13] tcg: Fix typo in comment (dependancies -> dependencies), Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 01/13] include/qemu/host-utils.h: Trivial typo: ctz->cto, Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 02/13] object: Report type in error when not user creatable., Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 06/13] stubs: Optimize dependencies for gdbstub.c, Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 13/13] vl: Remove unneeded include file, Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 09/13] util/iov: Use qemu/sockets.h instead of conditional code, Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 11/13] qemu-img: Remove unneeded include files, Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 03/13] bswap: Modify prototype of stb_p (avoid type conversions), Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 07/13] tests/test-int128: Don't use __noclone__ attribute on clang,
Michael Tokarev <=
- [Qemu-devel] [PULL 08/13] qjson.h: Remove spurious GCC_FMT_ATTR markup from qobject_from_json() declaration, Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 12/13] qga: Remove unneeded include file, Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 04/13] bswap: Modify prototypes of st[wl]_{le, be}_p (avoid type conversions), Michael Tokarev, 2014/03/04
- [Qemu-devel] [PULL 10/13] exec: Remove unneeded include files, Michael Tokarev, 2014/03/04
- Re: [Qemu-devel] [PULL 00/13] Trivial patches for 2014-03-04, Peter Maydell, 2014/03/04