cocoa: ignore compiler warnings about OpenGL being deprecated.

This commit is contained in:
Ryan C. Gordon 2019-06-14 21:18:53 -04:00
parent 90e2dc9891
commit ed8b78d36b
3 changed files with 39 additions and 1 deletions

View file

@ -28,6 +28,12 @@
#include "SDL_atomic.h" #include "SDL_atomic.h"
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
struct SDL_GLDriverData struct SDL_GLDriverData
{ {
int initialized; int initialized;
@ -46,7 +52,6 @@ struct SDL_GLDriverData
@end @end
/* OpenGL functions */ /* OpenGL functions */
extern int Cocoa_GL_LoadLibrary(_THIS, const char *path); extern int Cocoa_GL_LoadLibrary(_THIS, const char *path);
extern void *Cocoa_GL_GetProcAddress(_THIS, const char *proc); extern void *Cocoa_GL_GetProcAddress(_THIS, const char *proc);
@ -61,6 +66,10 @@ extern int Cocoa_GL_GetSwapInterval(_THIS);
extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context); extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif /* SDL_VIDEO_OPENGL_CGL */ #endif /* SDL_VIDEO_OPENGL_CGL */
#endif /* SDL_cocoaopengl_h_ */ #endif /* SDL_cocoaopengl_h_ */

View file

@ -36,6 +36,12 @@
#define DEFAULT_OPENGL "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib" #define DEFAULT_OPENGL "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
@implementation SDLOpenGLContext : NSOpenGLContext @implementation SDLOpenGLContext : NSOpenGLContext
- (id)initWithFormat:(NSOpenGLPixelFormat *)format - (id)initWithFormat:(NSOpenGLPixelFormat *)format
@ -431,6 +437,11 @@ Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
[nscontext release]; [nscontext release];
}} }}
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif /* SDL_VIDEO_OPENGL_CGL */ #endif /* SDL_VIDEO_OPENGL_CGL */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View file

@ -228,6 +228,12 @@ ScheduleContextUpdates(SDL_WindowData *data)
return; return;
} }
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
NSOpenGLContext *currentContext = [NSOpenGLContext currentContext]; NSOpenGLContext *currentContext = [NSOpenGLContext currentContext];
NSMutableArray *contexts = data->nscontexts; NSMutableArray *contexts = data->nscontexts;
@synchronized (contexts) { @synchronized (contexts) {
@ -239,6 +245,10 @@ ScheduleContextUpdates(SDL_WindowData *data)
} }
} }
} }
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} }
/* !!! FIXME: this should use a hint callback. */ /* !!! FIXME: this should use a hint callback. */
@ -1422,11 +1432,19 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
SDLView *contentView = [[SDLView alloc] initWithFrame:rect]; SDLView *contentView = [[SDLView alloc] initWithFrame:rect];
[contentView setSDLWindow:window]; [contentView setSDLWindow:window];
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
[contentView setWantsBestResolutionOpenGLSurface:YES]; [contentView setWantsBestResolutionOpenGLSurface:YES];
} }
} }
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#if SDL_VIDEO_OPENGL_ES2 #if SDL_VIDEO_OPENGL_ES2
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL