gstring.h/gmacros.h: Avoid compiler warnings on Visual Studio
Hi,
From the commit message:
The recent optimizations to gstring.h used G_ALWAYS_INLINE
(meaning __forceinline
on Visual Studio) together with static inline
, which
will cause warning C4141 indicating that inline
was used more than once on the function.
Avoid this by using a macro to just use dropping the __forceinline
on Visual Studio, and use the current approach otherwise.inline
keyword in the definitions
In the recent changes in gstring.h
and gmacros.h
, some warnings appear when building items using Visual Studio, where:
- Warning
C4141
shows up whenevergstring.h
is included, as we end up using__forceinline
withinline
. - Warning
C5051
shows up whenevergmacros.h
is included in a pre-C++-20 code in Visual Studio 2019 16.7.x or later, as the C++ attribute[[msvc::forceinline]]
and so forth are only supported since C++-20.
This attempts to rememedy things by:
- Using
#pragma
directives to disable warningC4141
momentarily ingstring.h
. - Change
G_CXX_STD_CHECK_VERSION (11)
toG_CXX_STD_CHECK_VERSION (20)
as needed ingmacros.h
Fixes issue #2905 (closed).
With blessings, thank you!
Edited by Chun-wei Fan