Simplify how warnings are ignored on Apple platforms

Within files that are only compiled on Apple platforms, we don't
need that redundant check for __APPLE__ so that got removed. Further,
Clang will recognize GCC pragmas so we don't need both Clang AND GCC
pragmas so I removed the Clang pragmas.

Currently GCC fails to compile this code but if one day in the future
that gets fixed, the deprecation warnings will continue to get ignored.
This commit is contained in:
Chris Thrasher 2022-07-11 23:27:21 -06:00 committed by Lukas Dürrenberger
parent 49fd5887c8
commit a71d60a0c9
30 changed files with 4 additions and 209 deletions

View File

@ -32,13 +32,7 @@
#define GREEN @"Green" #define GREEN @"Green"
#define RED @"Red" #define RED @"Red"
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
// Our PIMPL // Our PIMPL
struct SFMLmainWindow struct SFMLmainWindow

View File

@ -33,12 +33,8 @@
#include <utility> #include <utility>
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
namespace namespace
{ {

View File

@ -33,14 +33,9 @@
#include <filesystem> #include <filesystem>
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
#include <al.h> #include <al.h>
#include <alc.h> #include <alc.h>
@ -100,9 +95,5 @@ ALenum alGetLastErrorImpl();
#endif // SFML_ALCHECK_HPP #endif // SFML_ALCHECK_HPP
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#endif

View File

@ -34,12 +34,8 @@
#include <ostream> #include <ostream>
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
namespace namespace
{ {

View File

@ -36,12 +36,8 @@
#include <ostream> #include <ostream>
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
namespace sf namespace sf
{ {

View File

@ -30,12 +30,8 @@
#include <SFML/Audio/SoundBuffer.hpp> #include <SFML/Audio/SoundBuffer.hpp>
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
namespace sf namespace sf
{ {

View File

@ -38,12 +38,8 @@
#include <ostream> #include <ostream>
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
namespace sf namespace sf
{ {

View File

@ -40,12 +40,8 @@
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
namespace namespace
{ {

View File

@ -29,12 +29,8 @@
#include <SFML/Audio/SoundSource.hpp> #include <SFML/Audio/SoundSource.hpp>
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
namespace sf namespace sf
{ {

View File

@ -40,12 +40,8 @@
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif
namespace sf namespace sf
{ {

View File

@ -30,9 +30,7 @@
#include <android/looper.h> #include <android/looper.h>
#if defined(__clang__) #if defined(__clang__) || defined(__GNUC__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif

View File

@ -109,8 +109,8 @@ bool CursorImpl::loadFromSystem(Cursor::Type type)
case Cursor::SizeBottom: newCursor = [NSCursor resizeUpDownCursor]; break; case Cursor::SizeBottom: newCursor = [NSCursor resizeUpDownCursor]; break;
// These cursor types are undocumented, may not be available on some platforms // These cursor types are undocumented, may not be available on some platforms
#pragma clang diagnostic push #pragma GCC diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector" #pragma GCC diagnostic ignored "-Wundeclared-selector"
case Cursor::SizeTopRight: case Cursor::SizeTopRight:
case Cursor::SizeBottomLeft: case Cursor::SizeBottomLeft:
case Cursor::SizeBottomLeftTopRight: case Cursor::SizeBottomLeftTopRight:
@ -126,7 +126,7 @@ bool CursorImpl::loadFromSystem(Cursor::Type type)
case Cursor::Help: case Cursor::Help:
newCursor = loadFromSelector(@selector(_helpCursor)); newCursor = loadFromSelector(@selector(_helpCursor));
break; break;
#pragma clang diagnostic pop #pragma GCC diagnostic pop
} }
// clang-format on // clang-format on

View File

@ -28,13 +28,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#import <SFML/Window/OSX/SFApplication.h> #import <SFML/Window/OSX/SFApplication.h>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -28,13 +28,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#import <SFML/Window/OSX/SFApplicationDelegate.h> #import <SFML/Window/OSX/SFApplicationDelegate.h>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@implementation SFApplicationDelegate @implementation SFApplicationDelegate

View File

@ -35,13 +35,7 @@
#include <ostream> #include <ostream>
#include <stdint.h> #include <stdint.h>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
namespace sf namespace sf
{ {

View File

@ -29,13 +29,7 @@
#import <SFML/Window/OSX/SFKeyboardModifiersHelper.h> #import <SFML/Window/OSX/SFKeyboardModifiersHelper.h>
#include <SFML/Window/OSX/WindowImplCocoa.hpp> #include <SFML/Window/OSX/WindowImplCocoa.hpp>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -31,13 +31,7 @@
#import <SFML/Window/OSX/SFOpenGLView+keyboard_priv.h> #import <SFML/Window/OSX/SFOpenGLView+keyboard_priv.h>
#include <SFML/Window/OSX/WindowImplCocoa.hpp> #include <SFML/Window/OSX/WindowImplCocoa.hpp>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// In this file, we implement keyboard handling for SFOpenGLView /// In this file, we implement keyboard handling for SFOpenGLView

View File

@ -32,13 +32,7 @@
#include <cmath> #include <cmath>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -28,15 +28,8 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
namespace sf namespace sf
{ {
@ -212,10 +205,4 @@ class WindowImplCocoa;
@end @end
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
#endif

View File

@ -32,13 +32,7 @@
#import <SFML/Window/OSX/SFSilentResponder.h> #import <SFML/Window/OSX/SFSilentResponder.h>
#include <SFML/Window/OSX/WindowImplCocoa.hpp> #include <SFML/Window/OSX/WindowImplCocoa.hpp>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -34,13 +34,7 @@
#include <ostream> #include <ostream>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
@implementation SFViewController @implementation SFViewController

View File

@ -43,13 +43,7 @@
#include <algorithm> #include <algorithm>
#include <ostream> #include <ostream>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// SFBlackView is a simple view filled with black, nothing more /// SFBlackView is a simple view filled with black, nothing more

View File

@ -32,15 +32,8 @@
#include <SFML/Window/Event.hpp> #include <SFML/Window/Event.hpp>
#include <SFML/Window/WindowImpl.hpp> #include <SFML/Window/WindowImpl.hpp>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// Predefine OBJ-C classes /// Predefine OBJ-C classes
@ -379,12 +372,6 @@ private:
} // namespace sf } // namespace sf
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
#endif
#endif // SFML_WINDOWIMPLCOCOA_HPP #endif // SFML_WINDOWIMPLCOCOA_HPP

View File

@ -32,15 +32,8 @@
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
namespace sf namespace sf
{ {
@ -246,10 +239,4 @@ class WindowImplCocoa;
@end @end
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
#endif

View File

@ -30,13 +30,7 @@
#import <SFML/Window/OSX/Scaling.h> #import <SFML/Window/OSX/Scaling.h>
#include <SFML/Window/OSX/cg_sf_conversion.hpp> #include <SFML/Window/OSX/cg_sf_conversion.hpp>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
namespace sf namespace sf
{ {

View File

@ -35,15 +35,8 @@
#include <glad/gl.h> #include <glad/gl.h>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
SFML_DECLARE_OBJC_CLASS(EAGLContext); SFML_DECLARE_OBJC_CLASS(EAGLContext);
SFML_DECLARE_OBJC_CLASS(SFView); SFML_DECLARE_OBJC_CLASS(SFView);
@ -178,12 +171,6 @@ private:
} // namespace sf } // namespace sf
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
#endif
#endif // SFML_EAGLCONTEXT_HPP #endif // SFML_EAGLCONTEXT_HPP

View File

@ -39,13 +39,7 @@
#include <ostream> #include <ostream>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
namespace namespace

View File

@ -176,25 +176,12 @@ std::vector<sf::Vector2i> touchPositions;
if (!self.sfWindow) if (!self.sfWindow)
return false; return false;
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#endif
UIViewController* rootViewController = [((__bridge UIWindow*)(self.sfWindow->getSystemHandle())) rootViewController]; UIViewController* rootViewController = [((__bridge UIWindow*)(self.sfWindow->getSystemHandle())) rootViewController];
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
#endif
if (!rootViewController || ![rootViewController shouldAutorotate]) if (!rootViewController || ![rootViewController shouldAutorotate])
return false; return false;

View File

@ -32,13 +32,7 @@
#include <QuartzCore/CAEAGLLayer.h> #include <QuartzCore/CAEAGLLayer.h>
#include <cstring> #include <cstring>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
@interface SFView () @interface SFView ()

View File

@ -34,13 +34,7 @@
#include <UIKit/UIKit.h> #include <UIKit/UIKit.h>
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
namespace sf namespace sf
{ {
@ -109,25 +103,12 @@ void WindowImplUIKit::processEvents()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle WindowImplUIKit::getSystemHandle() const WindowHandle WindowImplUIKit::getSystemHandle() const
{ {
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#endif
return (__bridge WindowHandle)m_window; return (__bridge WindowHandle)m_window;
#if defined(__APPLE__)
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
#endif
} }