From ba823e3a5fc1ccf5e6aeb9f28541b84d655cfaf1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 7 Aug 2024 11:46:37 +0200 Subject: [PATCH] qYieldCpu(): compile in strict C11 mode This function is one of the few Qt functions that are also available in C (as opposed to C++) mode. Testing has shown that 'asm' doesn't work in strict mode (-std=c11) on GCC, so use __asm__ instead, like we do in qthread.h. Amends a7f227f56cfe562280e89d3c73040f7e8384129e and 877c158c5976bebffd0ff02c39b6b66a842c6344. Task-number: QTBUG-119901 Task-number: QTBUG-103014 Task-number: QTBUG-103011 Pick-to: 6.7 6.5 Change-Id: I4cb59bf6c716b09bfc7225314624ccd5ab77a5fd Reviewed-by: Thiago Macieira (cherry picked from commit 0c4d4cfa02ce8743a7aae3924af0d120c1c5e2fb) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/thread/qyieldcpu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/thread/qyieldcpu.h b/src/corelib/thread/qyieldcpu.h index d5da58deeb9..c30374f005a 100644 --- a/src/corelib/thread/qyieldcpu.h +++ b/src/corelib/thread/qyieldcpu.h @@ -44,15 +44,15 @@ void qYieldCpu(void) #elif defined(Q_PROCESSOR_X86) && defined(Q_CC_MSVC) _mm_pause(); #elif defined(Q_PROCESSOR_X86) - asm("pause"); // hopefully asm() works in this compiler + __asm__("pause"); // hopefully asm() works in this compiler #elif __has_builtin(__builtin_arm_yield) __builtin_arm_yield(); #elif defined(Q_PROCESSOR_ARM) && Q_PROCESSOR_ARM >= 7 && defined(Q_CC_GNU) - asm("yield"); // this works everywhere + __asm__("yield"); // this works everywhere #elif defined(Q_PROCESSOR_RISCV) - asm(".word 0x0100000f"); // a.k.a. "pause" + __asm__(".word 0x0100000f"); // a.k.a. "pause" #elif defined(_YIELD_PROCESSOR) && defined(Q_CC_GHS) _YIELD_PROCESSOR; // Green Hills (INTEGRITY), but only on ARM