kemenaran / SameBoy

Game Boy and Game Boy Color emulator written in C
https://sameboy.github.io/
MIT License
60 stars 2 forks source link

Compile fails on clang 9.0.0 #1

Open parkerlreed opened 5 years ago

parkerlreed commented 5 years ago

Arch Linux clang version 9.0.0 (trunk) (llvm/trunk 358753)

clang -Werror -Wall -Wno-unknown-warning-option -Wno-multichar -Wno-int-in-bool-context -std=gnu11 -D_GNU_SOURCE -DVERSION="0.11.1" -I. -D_USE_MATH_DEFINES -Wno-deprecated-declarations -g -DGB_INTERNAL -c Core/timing.c -o build/obj/Core/timing.c.o
clang -Werror -Wall -Wno-unknown-warning-option -Wno-multichar -Wno-int-in-bool-context -std=gnu11 -D_GNU_SOURCE -DVERSION="0.11.1" -I. -D_USE_MATH_DEFINES -Wno-deprecated-declarations -g -c Misc/wide_gb.c -o build/obj/Misc/wide_gb.c.o
Misc/wide_gb.c:154:47: error: format specifies type 'unsigned long long *' but the argument has type 'WGB_exact_hash *' (aka 'unsigned long *') [-Werror,-Wformat]
                sscanf(line, "%llu,%i,%i,%i", &frame_hash, &scene_id, &scene_scroll.x, &scene_scroll.y);
                              ~~~~            ^~~~~~~~~~~
                              %lu
Misc/wide_gb.c:218:57: error: format specifies type 'unsigned long long' but the argument has type 'WGB_exact_hash' (aka 'unsigned long') [-Werror,-Wformat]
                fprintf(frames_file, "%llu,%i,%i,%i\n", scene_frame->frame_hash, scene_frame->scene_id, scene_frame->scene_scroll.x, scene_frame->scene_scroll.y);
                                      ~~~~              ^~~~~~~~~~~~~~~~~~~~~~~
                                      %lu
2 errors generated.
make: *** [Makefile:162: build/obj/Misc/wide_gb.c.o] Error 1

(Thanks for enabling the issue tracker!)

AntonioND commented 5 years ago

I think that this highlights another problem. -Werror shouldn't be used by default when compiling. I imagine that the idea is to force developers to not introduce new warnings, but different versions of compilers may have different warnings, so it isn't realistic to expect that your code is always going to be warning-free.