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.
This commit is contained in:
Chris Thrasher 2022-11-02 23:34:26 -06:00
parent 0e16627677
commit 6451a29f49
3 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -31,13 +31,17 @@ constexpr Vector2<T>::Vector2() : x(0), y(0)
////////////////////////////////////////////////////////////
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
template <typename T>
constexpr Vector2<T>::Vector2(T x, T y) : x(x), y(y)
{
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
////////////////////////////////////////////////////////////

View File

@ -31,13 +31,17 @@ constexpr Vector3<T>::Vector3() : x(0), y(0), z(0)
////////////////////////////////////////////////////////////
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
template <typename T>
constexpr Vector3<T>::Vector3(T x, T y, T z) : x(x), y(y), z(z)
{
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
////////////////////////////////////////////////////////////