Skip to content

Commit

Permalink
cocoa: ignore compiler warnings about OpenGL being deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 15, 2019
1 parent 90e2dc9 commit ed8b78d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/video/cocoa/SDL_cocoaopengl.h
Expand Up @@ -28,6 +28,12 @@
#include "SDL_atomic.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
{
int initialized;
Expand All @@ -46,7 +52,6 @@ struct SDL_GLDriverData

@end


/* OpenGL functions */
extern int Cocoa_GL_LoadLibrary(_THIS, const char *path);
extern void *Cocoa_GL_GetProcAddress(_THIS, const char *proc);
Expand All @@ -61,6 +66,10 @@ extern int Cocoa_GL_GetSwapInterval(_THIS);
extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);

#ifdef __clang__
#pragma clang diagnostic pop
#endif

#endif /* SDL_VIDEO_OPENGL_CGL */

#endif /* SDL_cocoaopengl_h_ */
Expand Down
11 changes: 11 additions & 0 deletions src/video/cocoa/SDL_cocoaopengl.m
Expand Up @@ -36,6 +36,12 @@

#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

- (id)initWithFormat:(NSOpenGLPixelFormat *)format
Expand Down Expand Up @@ -431,6 +437,11 @@ - (void)setWindow:(SDL_Window *)newWindow
[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 */

/* vi: set ts=4 sw=4 expandtab: */
18 changes: 18 additions & 0 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -228,6 +228,12 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
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];
NSMutableArray *contexts = data->nscontexts;
@synchronized (contexts) {
Expand All @@ -239,6 +245,10 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
}
}
}

#ifdef __clang__
#pragma clang diagnostic pop
#endif
}

/* !!! FIXME: this should use a hint callback. */
Expand Down Expand Up @@ -1422,11 +1432,19 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
SDLView *contentView = [[SDLView alloc] initWithFrame:rect];
[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 ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
[contentView setWantsBestResolutionOpenGLSurface:YES];
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif

#if SDL_VIDEO_OPENGL_ES2
#if SDL_VIDEO_OPENGL_EGL
Expand Down

0 comments on commit ed8b78d

Please sign in to comment.