提交 7edd9ddc 编写于 作者: P Peter Maydell 提交者: Michael Tokarev

tests/test-int128: Don't use __noclone__ attribute on clang

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: NPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 8ead6018
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册