Skip to content

fix clang compile warning with -DNDEBUG - #817

Merged
vsonnier merged 1 commit into
Novum:masterfrom
j4reporting:clang_fixes
Oct 25, 2025
Merged

fix clang compile warning with -DNDEBUG#817
vsonnier merged 1 commit into
Novum:masterfrom
j4reporting:clang_fixes

Conversation

@j4reporting

Copy link
Copy Markdown
Contributor

FAILED: [code=1] vkquake.p/Quake_pr_edict.c.o
clang -Ivkquake.p -I. -I.. -I../Quake/mimalloc -I/usr/include/SDL2 -I/usr/include/opus -fdiagnostics-color=always -DNDEBUG -include-pch vkquake.p/quakedef.h.pch -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu11 -O3 -D_GNU_SOURCE -D_GNU_SOURCE=1 -D_REENTRANT -pthread -Wall -Wno-trigraphs -Werror -std=gnu11 -DUSE_CODEC_WAVE -DUSE_CODEC_MP3 -DUSE_CODEC_FLAC -DUSE_CODEC_VORBIS -DUSE_CODEC_OPUS -MD -MQ vkquake.p/Quake_pr_edict.c.o -MF vkquake.p/Quake_pr_edict.c.o.d -o vkquake.p/Quake_pr_edict.c.o -c ../Quake/pr_edict.c ../Quake/pr_edict.c:886:6: error: variable 'free_edicts_count' set but not used [-Werror,-Wunused-but-set-variable]
886 | int free_edicts_count = 0;
| ^
../Quake/pr_edict.c:887:6: error: variable 'free_list_count' set but not used [-Werror,-Wunused-but-set-variable]
887 | int free_list_count = 0;
| ^
2 errors generated.

FAILED: [code=1] vkquake.p/Quake_pr_edict.c.o
clang -Ivkquake.p -I. -I.. -I../Quake/mimalloc -I/usr/include/SDL2 -I/usr/include/opus -fdiagnostics-color=always -DNDEBUG -include-pch vkquake.p/quakedef.h.pch -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu11 -O3 -D_GNU_SOURCE -D_GNU_SOURCE=1 -D_REENTRANT -pthread -Wall -Wno-trigraphs -Werror -std=gnu11 -DUSE_CODEC_WAVE -DUSE_CODEC_MP3 -DUSE_CODEC_FLAC -DUSE_CODEC_VORBIS -DUSE_CODEC_OPUS -MD -MQ vkquake.p/Quake_pr_edict.c.o -MF vkquake.p/Quake_pr_edict.c.o.d -o vkquake.p/Quake_pr_edict.c.o -c ../Quake/pr_edict.c
../Quake/pr_edict.c:886:6: error: variable 'free_edicts_count' set but not used [-Werror,-Wunused-but-set-variable]
  886 |         int free_edicts_count = 0;
      |             ^
../Quake/pr_edict.c:887:6: error: variable 'free_list_count' set but not used [-Werror,-Wunused-but-set-variable]
  887 |         int free_list_count = 0;
      |             ^
2 errors generated.
@vsonnier
vsonnier merged commit 65d9e49 into Novum:master Oct 25, 2025
11 checks passed
@vsonnier

Copy link
Copy Markdown
Collaborator

Thanks !

@j4reporting
j4reporting deleted the clang_fixes branch October 25, 2025 14:37
@j4reporting

Copy link
Copy Markdown
Contributor Author

must have made a mistake. clang still aborts when compiling with -DNDEBUG :(

looks like a clang issue
changing free_edicts_count++; to free_edicts_count = free_edicts_count + 1;
( the same for free_list_count++ )
prevents the warning.

I'll enclose both lines with #pragma clang diagnostics for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants