diff --git a/source/MRMesh/MRUnitInfo.h b/source/MRMesh/MRUnitInfo.h index 158c98be8b21..db4879a12dc1 100644 --- a/source/MRMesh/MRUnitInfo.h +++ b/source/MRMesh/MRUnitInfo.h @@ -111,10 +111,6 @@ enum class InvLengthUnit // All supported value types for `valueToString()`. // Not using `__VA_OPT__(,)` here to support legacy MSVC preprocessor. -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" -#endif #define DETAIL_MR_UNIT_VALUE_TYPES(X, ...) \ X(float ,__VA_ARGS__) X(double ,__VA_ARGS__) X(long double ,__VA_ARGS__) \ X(signed char ,__VA_ARGS__) X(unsigned char ,__VA_ARGS__) \ @@ -122,9 +118,6 @@ enum class InvLengthUnit X(int ,__VA_ARGS__) X(unsigned int ,__VA_ARGS__) \ X(long ,__VA_ARGS__) X(unsigned long ,__VA_ARGS__) \ X(long long ,__VA_ARGS__) X(unsigned long long ,__VA_ARGS__) -#ifdef __clang__ -#pragma clang diagnostic pop -#endif // Whether `E` is one of the unit enums: NoUnit, LengthUnit, AngleUnit, ... template diff --git a/source/MRViewer/MRGLMacro.h b/source/MRViewer/MRGLMacro.h index 6a2e7b35921c..2d44238b5b4e 100644 --- a/source/MRViewer/MRGLMacro.h +++ b/source/MRViewer/MRGLMacro.h @@ -3,16 +3,28 @@ #if !defined( NDEBUG ) && !defined( MR_GL_NO_LOGGING ) #include "MRPch/MRSpdlog.h" #include "MRMesh/MRFinally.h" + +// Not using `__VA_OPT__(,)` here to support legacy MSVC preprocessor. +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" +#endif + #define GL_EXEC( ... ) \ - [&]() -> decltype(auto) \ - { \ - MR_FINALLY{ \ + ( \ + void(MR::detail::ScopeGuard([] \ + { \ auto error = glGetError();\ if ( error != 0 )\ spdlog::warn("GL error: {} In file: {} Line: {}", error , __FILE__ , __LINE__ );\ - }; \ - return __VA_ARGS__;\ - }() + })) \ + ,##__VA_ARGS__\ + ) + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #else #define GL_EXEC( ... ) __VA_ARGS__ -#endif \ No newline at end of file +#endif