Skip to content

Commit 1305c18

Browse files
committed
sdl3: Enable compiler warnings
1 parent 5967a90 commit 1305c18

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

demo/sdl3/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,14 @@ if (NUKLEAR_SDL3_EXAMPLES)
4040

4141
# on Visual Studio, set our app as the default project
4242
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "nuklear_sdl3_renderer")
43+
44+
# Enable Warnings
45+
if(MSVC)
46+
target_compile_options(nuklear_sdl3_renderer PRIVATE /W4 /WX)
47+
else()
48+
target_compile_options(nuklear_sdl3_renderer PRIVATE -Wall -Wextra -Wpedantic -Werror)
49+
endif()
50+
51+
# SDL3 does not support C89/C90
52+
set_property(TARGET nuklear_sdl3_renderer PROPERTY C_STANDARD 99)
4353
endif()

demo/sdl3/nuklear_sdl3_renderer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ SDL_AppResult SDL_Fail(){
8787
}
8888

8989
SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) {
90+
NK_UNUSED(argc);
91+
NK_UNUSED(argv);
9092
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS)) {
9193
return SDL_Fail();
9294
}
@@ -238,6 +240,7 @@ SDL_AppResult SDL_AppIterate(void *appstate) {
238240

239241
void SDL_AppQuit(void* appstate, SDL_AppResult result) {
240242
AppContext* app = (AppContext*)appstate;
243+
NK_UNUSED(result);
241244

242245
if (app) {
243246
nk_sdl_shutdown(app->ctx);

demo/sdl3/nuklear_sdl3_renderer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,18 @@ static void
187187
nk_sdl_clipboard_paste(nk_handle usr, struct nk_text_edit *edit)
188188
{
189189
const char *text = SDL_GetClipboardText();
190+
NK_UNUSED(usr);
190191
if (text) {
191192
nk_textedit_paste(edit, text, nk_strlen(text));
192193
SDL_free((void *)text);
193194
}
194-
(void)usr;
195195
}
196196

197197
static void
198198
nk_sdl_clipboard_copy(nk_handle usr, const char *text, int len)
199199
{
200200
char *str = 0;
201-
(void)usr;
201+
NK_UNUSED(usr);
202202
if (len <= 0 || text == NULL) return;
203203
str = SDL_strndup(text, (size_t)len);
204204
if (str == NULL) return;

0 commit comments

Comments
 (0)