diff options
| author | Andre Weissflog <floooh@gmail.com> | 2020-05-30 14:53:48 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2020-05-30 14:53:48 +0200 |
| commit | 2b14aa796e7b244cb52223c499261fcded7daed1 (patch) | |
| tree | 09f1df441a01bac9072514202caf8ed078470e6d | |
| parent | 48d650f626b7a1b82c51dc4f6f77757baf4d3b69 (diff) | |
fix unused parameter warnings in platform-agnostic and OSX/iOS code paths
| -rw-r--r-- | sokol_app.h | 21 | ||||
| -rw-r--r-- | sokol_audio.h | 5 | ||||
| -rw-r--r-- | sokol_gfx.h | 4 | ||||
| -rw-r--r-- | util/sokol_fontstash.h | 5 |
4 files changed, 35 insertions, 0 deletions
diff --git a/sokol_app.h b/sokol_app.h index 93300e2f..b54b0e29 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -1472,6 +1472,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) { @implementation _sapp_macos_app_delegate - (void)applicationDidFinishLaunching:(NSNotification*)aNotification { + _SOKOL_UNUSED(aNotification); if (_sapp.desc.fullscreen) { NSRect screen_rect = NSScreen.mainScreen.frame; _sapp.window_width = screen_rect.size.width; @@ -1576,6 +1577,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) { } - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender { + _SOKOL_UNUSED(sender); return YES; } @end @@ -1627,6 +1629,7 @@ _SOKOL_PRIVATE void _sapp_macos_app_event(sapp_event_type type) { @implementation _sapp_macos_window_delegate - (BOOL)windowShouldClose:(id)sender { + _SOKOL_UNUSED(sender); /* only give user-code a chance to intervene when sapp_quit() wasn't already called */ if (!_sapp.quit_ordered) { /* if window should be closed and event handling is enabled, give user code @@ -1649,15 +1652,18 @@ _SOKOL_PRIVATE void _sapp_macos_app_event(sapp_event_type type) { } - (void)windowDidResize:(NSNotification*)notification { + _SOKOL_UNUSED(notification); _sapp_macos_update_dimensions(); _sapp_macos_app_event(SAPP_EVENTTYPE_RESIZED); } - (void)windowDidMiniaturize:(NSNotification*)notification { + _SOKOL_UNUSED(notification); _sapp_macos_app_event(SAPP_EVENTTYPE_ICONIFIED); } - (void)windowDidDeminiaturize:(NSNotification*)notification { + _SOKOL_UNUSED(notification); _sapp_macos_app_event(SAPP_EVENTTYPE_RESTORED); } @end @@ -1665,11 +1671,14 @@ _SOKOL_PRIVATE void _sapp_macos_app_event(sapp_event_type type) { #if defined(SOKOL_METAL) @implementation _sapp_macos_mtk_view_dlg - (void)drawInMTKView:(MTKView*)view { + _SOKOL_UNUSED(view); @autoreleasepool { _sapp_macos_frame(); } } - (void)mtkView:(MTKView*)view drawableSizeWillChange:(CGSize)size { + _SOKOL_UNUSED(view); + _SOKOL_UNUSED(size); /* this is required by the protocol, but we can't do anything useful here */ } @end @@ -1678,6 +1687,7 @@ _SOKOL_PRIVATE void _sapp_macos_app_event(sapp_event_type type) { @implementation _sapp_macos_view #if defined(SOKOL_GLCORE33) - (void)timerFired:(id)sender { + _SOKOL_UNUSED(sender); [self setNeedsDisplay:YES]; } - (void)prepareOpenGL { @@ -1688,6 +1698,7 @@ _SOKOL_PRIVATE void _sapp_macos_app_event(sapp_event_type type) { [ctx makeCurrentContext]; } - (void)drawRect:(NSRect)bound { + _SOKOL_UNUSED(bound); _sapp_macos_frame(); [[_sapp_view_obj openGLContext] flushBuffer]; } @@ -1843,6 +1854,7 @@ _SOKOL_PRIVATE void _sapp_macos_app_event(sapp_event_type type) { } } - (void)cursorUpdate:(NSEvent*)event { + _SOKOL_UNUSED(event); if (_sapp.desc.user_cursor) { _sapp_macos_app_event(SAPP_EVENTTYPE_UPDATE_CURSOR); } @@ -2427,6 +2439,8 @@ _SOKOL_PRIVATE void _sapp_emsc_wgpu_surfaces_discard(void); #endif _SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenUiEvent* ui_event, void* user_data) { + _SOKOL_UNUSED(event_type); + _SOKOL_UNUSED(user_data); double w, h; emscripten_get_element_css_size(_sapp.html5_canvas_name, &w, &h); /* The above method might report zero when toggling HTML5 fullscreen, @@ -2481,6 +2495,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenU } _SOKOL_PRIVATE EM_BOOL _sapp_emsc_mouse_cb(int emsc_type, const EmscriptenMouseEvent* emsc_event, void* user_data) { + _SOKOL_UNUSED(user_data); _sapp.mouse_x = (emsc_event->targetX * _sapp.dpi_scale); _sapp.mouse_y = (emsc_event->targetY * _sapp.dpi_scale); if (_sapp_events_enabled() && (emsc_event->button >= 0) && (emsc_event->button < SAPP_MAX_MOUSEBUTTONS)) { @@ -2543,6 +2558,8 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_mouse_cb(int emsc_type, const EmscriptenMouseE } _SOKOL_PRIVATE EM_BOOL _sapp_emsc_wheel_cb(int emsc_type, const EmscriptenWheelEvent* emsc_event, void* user_data) { + _SOKOL_UNUSED(emsc_type); + _SOKOL_UNUSED(user_data); if (_sapp_events_enabled()) { _sapp_init_event(SAPP_EVENTTYPE_MOUSE_SCROLL); if (emsc_event->mouse.ctrlKey) { @@ -2566,6 +2583,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_wheel_cb(int emsc_type, const EmscriptenWheelE } _SOKOL_PRIVATE EM_BOOL _sapp_emsc_key_cb(int emsc_type, const EmscriptenKeyboardEvent* emsc_event, void* user_data) { + _SOKOL_UNUSED(user_data); bool retval = true; if (_sapp_events_enabled()) { sapp_event_type type; @@ -2702,6 +2720,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_key_cb(int emsc_type, const EmscriptenKeyboard } _SOKOL_PRIVATE EM_BOOL _sapp_emsc_touch_cb(int emsc_type, const EmscriptenTouchEvent* emsc_event, void* user_data) { + _SOKOL_UNUSED(user_data); bool retval = true; if (_sapp_events_enabled()) { sapp_event_type type; @@ -2862,6 +2881,8 @@ _SOKOL_PRIVATE void _sapp_emsc_keytable_init(void) { #if defined(SOKOL_GLES2) || defined(SOKOL_GLES3) _SOKOL_PRIVATE EM_BOOL _sapp_emsc_webgl_context_cb(int emsc_type, const void* reserved, void* user_data) { + _SOKOL_UNUSED(reserved); + _SOKOL_UNUSED(user_data); sapp_event_type type; switch (emsc_type) { case EMSCRIPTEN_EVENT_WEBGLCONTEXTLOST: type = SAPP_EVENTTYPE_SUSPENDED; break; diff --git a/sokol_audio.h b/sokol_audio.h index 21907d49..0c0f2d7c 100644 --- a/sokol_audio.h +++ b/sokol_audio.h @@ -463,6 +463,10 @@ inline void saudio_setup(const saudio_desc& desc) { return saudio_setup(&desc); #endif #endif +#ifndef _SOKOL_UNUSED + #define _SOKOL_UNUSED(x) (void)(x) +#endif + #if (defined(__APPLE__) || defined(__linux__) || defined(__unix__)) && !defined(__EMSCRIPTEN__) #include <pthread.h> #elif defined(_WIN32) @@ -918,6 +922,7 @@ _SOKOL_PRIVATE void _saudio_backend_shutdown(void) { }; /* NOTE: the buffer data callback is called on a separate thread! */ _SOKOL_PRIVATE void _sapp_ca_callback(void* user_data, AudioQueueRef queue, AudioQueueBufferRef buffer) { + _SOKOL_UNUSED(user_data); if (_saudio_has_callback()) { const int num_frames = buffer->mAudioDataByteSize / _saudio.bytes_per_frame; const int num_channels = _saudio.num_channels; diff --git a/sokol_gfx.h b/sokol_gfx.h index 75fcc34d..e50e6b39 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -8804,6 +8804,7 @@ _SOKOL_PRIVATE void _sg_mtl_destroy_context(_sg_context_t* ctx) { } _SOKOL_PRIVATE void _sg_mtl_activate_context(_sg_context_t* ctx) { + _SOKOL_UNUSED(ctx); _sg_mtl_clear_state_cache(); } @@ -8938,6 +8939,7 @@ _SOKOL_PRIVATE bool _sg_mtl_init_texdesc_common(MTLTextureDescriptor* mtl_desc, /* initialize MTLTextureDescritor with rendertarget attributes */ _SOKOL_PRIVATE void _sg_mtl_init_texdesc_rt(MTLTextureDescriptor* mtl_desc, _sg_image_t* img) { SOKOL_ASSERT(img->cmn.render_target); + _SOKOL_UNUSED(img); /* reset the cpuCacheMode to 'default' */ mtl_desc.cpuCacheMode = MTLCPUCacheModeDefaultCache; /* render targets are only visible to the GPU */ @@ -9462,6 +9464,7 @@ _SOKOL_PRIVATE void _sg_mtl_commit(void) { id<MTLDrawable> cur_drawable = (__bridge id<MTLDrawable>) _sg.mtl.drawable_cb(); [_sg_mtl_cmd_buffer presentDrawable:cur_drawable]; [_sg_mtl_cmd_buffer addCompletedHandler:^(id<MTLCommandBuffer> cmd_buffer) { + _SOKOL_UNUSED(cmd_buffer); dispatch_semaphore_signal(_sg_mtl_sem); }]; [_sg_mtl_cmd_buffer commit]; @@ -9553,6 +9556,7 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( _sg_image_t** vs_imgs, int num_vs_imgs, _sg_image_t** fs_imgs, int num_fs_imgs) { + _SOKOL_UNUSED(pip); SOKOL_ASSERT(_sg.mtl.in_pass); if (!_sg.mtl.pass_valid) { return; diff --git a/util/sokol_fontstash.h b/util/sokol_fontstash.h index 3dfb7010..2b57e9c3 100644 --- a/util/sokol_fontstash.h +++ b/util/sokol_fontstash.h @@ -222,6 +222,9 @@ SOKOL_API_DECL uint32_t sfons_rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a); #ifndef SOKOL_UNREACHABLE #define SOKOL_UNREACHABLE SOKOL_ASSERT(false) #endif +#ifndef _SOKOL_UNUSED + #define _SOKOL_UNUSED(x) (void)(x) +#endif #if defined(SOKOL_GLCORE33) static const char* _sfons_vs_src = @@ -931,6 +934,8 @@ static int _sfons_render_resize(void* user_ptr, int width, int height) { static void _sfons_render_update(void* user_ptr, int* rect, const unsigned char* data) { SOKOL_ASSERT(user_ptr && rect && data); + _SOKOL_UNUSED(rect); + _SOKOL_UNUSED(data); _sfons_t* sfons = (_sfons_t*) user_ptr; sfons->img_dirty = true; } |