From: Andrei Tatar Date: Mon, 14 Aug 2023 18:19:45 +0000 (+0200) Subject: Add compatibility with GCC <= 11.2 X-Git-Tag: RELEASE-0.14.0~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a125e4044be64906a9782d0960517cfa19cc2e7b;p=unikraft%2Flibs%2Fintel-intrinsics.git Add compatibility with GCC <= 11.2 GCC versions prior to 11.3 do not support the "mwait" target attribute. This change adds compiler version checks to the pragmas using this attribute, enabling builds with GCC 11.1 & 11.2. Signed-off-by: Andrei Tatar Reviewed-by: Stefan Jumarea Reviewed-by: Maria Sfiraiala Reviewed-by: Radu Nichita Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #4 --- diff --git a/include-gcc/mwaitintrin.h b/include-gcc/mwaitintrin.h index 9ade96b..73f53db 100644 --- a/include-gcc/mwaitintrin.h +++ b/include-gcc/mwaitintrin.h @@ -24,11 +24,13 @@ #ifndef _MWAITINTRIN_H_INCLUDED #define _MWAITINTRIN_H_INCLUDED +#if ((__GNUC__ >= 12) || (__GNUC__ == 11 && __GNUC_MINOR__ >= 3)) #ifndef __MWAIT__ #pragma GCC push_options #pragma GCC target("mwait") #define __DISABLE_MWAIT__ #endif /* __MWAIT__ */ +#endif /* GCC >= 11.3 */ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))