From 6451a29f49919364f1b680337dd6675d1d9786ce Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Wed, 2 Nov 2022 23:34:26 -0600 Subject: [PATCH] Disable certain GCC pragmas when using other compilers Fixes MSVC warning C4068 in public headers while keeping that warning disabled for uses of GCC pragmas in SFML source files. --- include/SFML/Graphics/Glsl.inl | 4 ++++ include/SFML/System/Vector2.inl | 4 ++++ include/SFML/System/Vector3.inl | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/include/SFML/Graphics/Glsl.inl b/include/SFML/Graphics/Glsl.inl index d391b7b76..9e678bf8b 100644 --- a/include/SFML/Graphics/Glsl.inl +++ b/include/SFML/Graphics/Glsl.inl @@ -108,12 +108,16 @@ struct Vector4 /// \param w Component of the 4D vector /// //////////////////////////////////////////////////////////// +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" +#endif Vector4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) { } +#if defined(__GNUC__) #pragma GCC diagnostic pop +#endif //////////////////////////////////////////////////////////// /// \brief Conversion constructor diff --git a/include/SFML/System/Vector2.inl b/include/SFML/System/Vector2.inl index 854778d83..637380f0e 100644 --- a/include/SFML/System/Vector2.inl +++ b/include/SFML/System/Vector2.inl @@ -31,13 +31,17 @@ constexpr Vector2::Vector2() : x(0), y(0) //////////////////////////////////////////////////////////// +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" +#endif template constexpr Vector2::Vector2(T x, T y) : x(x), y(y) { } +#if defined(__GNUC__) #pragma GCC diagnostic pop +#endif //////////////////////////////////////////////////////////// diff --git a/include/SFML/System/Vector3.inl b/include/SFML/System/Vector3.inl index a2626989a..a23265eaf 100644 --- a/include/SFML/System/Vector3.inl +++ b/include/SFML/System/Vector3.inl @@ -31,13 +31,17 @@ constexpr Vector3::Vector3() : x(0), y(0), z(0) //////////////////////////////////////////////////////////// +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" +#endif template constexpr Vector3::Vector3(T x, T y, T z) : x(x), y(y), z(z) { } +#if defined(__GNUC__) #pragma GCC diagnostic pop +#endif ////////////////////////////////////////////////////////////