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 <thiago.macieira@intel.com> (cherry picked from commit 0c4d4cfa02ce8743a7aae3924af0d120c1c5e2fb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
6f01a67bdc
commit
ba823e3a5f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user