From c8730dc6f97292c963c5056f2e57b51bae4a06d0 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 21 Feb 2023 14:45:36 +0800 Subject: [PATCH] gmacros.h: Fix C++ macros for Visual Studio ,,,for G_ALWAYS_INLINE and G_NO_INLINE, since the msvc::forceinline and msvc::noinline attributes require C++-20 support, not just C++-11 support. This will avoid warning C5051 (unsupported attribute ..., ignored) if pre-C++-20 was used. --- glib/gmacros.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/gmacros.h b/glib/gmacros.h index da3611de0..aee81a69c 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -1157,7 +1157,7 @@ # endif #elif defined (_MSC_VER) /* Use MSVC specific syntax. */ -# if G_CXX_STD_CHECK_VERSION (11) && _MSC_VER >= 1927 +# if G_CXX_STD_CHECK_VERSION (20) && _MSC_VER >= 1927 # define G_ALWAYS_INLINE [[msvc::forceinline]] # else # define G_ALWAYS_INLINE __forceinline @@ -1202,7 +1202,7 @@ # if defined (__GNUC__) # define G_NO_INLINE [[gnu::noinline]] # elif defined (_MSC_VER) -# if _MSC_VER >= 1927 +# if G_CXX_STD_CHECK_VERSION (20) && _MSC_VER >= 1927 # define G_NO_INLINE [[msvc::noinline]] # else # define G_NO_INLINE __declspec (noinline) @@ -1214,7 +1214,7 @@ #elif defined (_MSC_VER) && (1200 <= _MSC_VER) /* Use MSVC specific syntax. */ /* Use ISO C++11 syntax when the compiler supports it. */ -# if G_CXX_STD_CHECK_VERSION (11) && _MSC_VER >= 1927 +# if G_CXX_STD_CHECK_VERSION (20) && _MSC_VER >= 1927 # define G_NO_INLINE [[msvc::noinline]] # else # define G_NO_INLINE __declspec (noinline)