Closed andwhyisit closed 7 years ago
Whoops, I keep forgetting everyone else is using GCC 4.9 :zipper_mouth_face:
You have no idea how much I wish C99 (or newer) became the default :P
C11 is the default in 5.x (or 6? i forget). I'm using 6.2 currently so yeah.
Python has been annoying the hell out of me though. I mostly just google how to do what I want and whether it supports 2 or 3 or both is complete luck. Easy enough to automate a few tedious things at least.
The other tools seem to compile fine, but tscomp is throwing warnings:
[root@cavestory cave-story-md]# gcc tools/tscomp/tscomp.c -o tscomp -std=c99 -O2 -Wall -Wextra
tools/tscomp/tscomp.c: In function âis_valid_charâ:
tools/tscomp/tscomp.c:328: warning: comparison between signed and unsigned integer expressions
tools/tscomp/tscomp.c: In function âdo_commandâ:
tools/tscomp/tscomp.c:276: warning: âparamsâ may be used uninitialized in this function
tools/tscomp/tscomp.c:277: warning: âflagsâ may be used uninitialized in this function
...and tileopt is throwing errors:
[root@cavestory cave-story-md]# gcc tools/tileopt/tileopt.c -lSDL2 -lSDL2_image -o tileopt -std=c99 -O2 -Wall -Wextra
tools/tileopt/tileopt.c:12:22: error: SDL2/SDL.h: No such file or directory
tools/tileopt/tileopt.c:13:28: error: SDL2/SDL_image.h: No such file or directory
tools/tileopt/tileopt.c:24: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â*â token
tools/tileopt/tileopt.c: In function âload_tilesetâ:
tools/tileopt/tileopt.c:33: error: âtilesetâ undeclared (first use in this function)
tools/tileopt/tileopt.c:33: error: (Each undeclared identifier is reported only once
tools/tileopt/tileopt.c:33: error: for each function it appears in.)
tools/tileopt/tileopt.c:33: warning: implicit declaration of function âIMG_Loadâ
tools/tileopt/tileopt.c:35: warning: implicit declaration of function âSDL_GetErrorâ
tools/tileopt/tileopt.c:35: warning: format â%sâ expects type âchar *â, but argument 2 has type âintâ
tools/tileopt/tileopt.c: In function âload_attrâ:
tools/tileopt/tileopt.c:43: error: âtilesetâ undeclared (first use in this function)
tools/tileopt/tileopt.c: In function âsave_tilesetâ:
tools/tileopt/tileopt.c:65: warning: implicit declaration of function âSDL_SaveBMPâ
tools/tileopt/tileopt.c:65: error: âtilesetâ undeclared (first use in this function)
tools/tileopt/tileopt.c: In function âshift_tilesetâ:
tools/tileopt/tileopt.c:120: error: âUint8â undeclared (first use in this function)
tools/tileopt/tileopt.c:120: error: âpixelsâ undeclared (first use in this function)
tools/tileopt/tileopt.c:120: error: expected expression before â)â token
tools/tileopt/tileopt.c:122: error: âtilesetâ undeclared (first use in this function)
tools/tileopt/tileopt.c: In function âtrim_unusedâ:
tools/tileopt/tileopt.c:141: error: âUint8â undeclared (first use in this function)
tools/tileopt/tileopt.c:141: error: âpixelsâ undeclared (first use in this function)
tools/tileopt/tileopt.c:141: error: expected expression before â)â token
tools/tileopt/tileopt.c:142: error: âtilesetâ undeclared (first use in this function)
tools/tileopt/tileopt.c: In function âmainâ:
tools/tileopt/tileopt.c:161: warning: implicit declaration of function âSDL_LockSurfaceâ
tools/tileopt/tileopt.c:161: error: âtilesetâ undeclared (first use in this function)
tools/tileopt/tileopt.c:166: warning: implicit declaration of function âSDL_UnlockSurfaceâ
tools/tileopt/tileopt.c:167: warning: implicit declaration of function âSDL_FreeSurfaceâ
tscomp still compiles regardless, but tileopt fails and interrupts make tools.
Also for the sake of completion, while there are no errors while compiling the rom, there are some warnings that pop up that don't seem to affect the compile process but have been around for a while:
/opt/toolchains/gen/m68k-elf/bin/m68k-elf-gcc -m68000 -Wall -Wextra -Wno-missing-field-initializers -std=c99 -c -fno-builtin -O3 -fomit-frame-pointer -I/opt/toolchains/gen/m68k-elf/include -I/opt/toolchains/gen/m68k-elf/m68k-elf/include -Isrc -Ires -Iinc -c src/credits.c -o src/credits.o
src/credits.c: In function âcredits_mainâ:
src/credits.c:9:22: warning: unused parameter âendingâ [-Wunused-parameter]
void credits_main(u8 ending) {
^~~~~~
/opt/toolchains/gen/m68k-elf/bin/m68k-elf-gcc -m68000 -Wall -Wextra -Wno-missing-field-initializers -std=c99 -c -fno-builtin -O3 -fomit-frame-pointer -I/opt/toolchains/gen/m68k-elf/include -I/opt/toolchains/gen/m68k-elf/m68k-elf/include -Isrc -Ires -Iinc -c src/weapon.c -o src/weapon.o
src/weapon.c: In function âweapon_fire_noneâ:
src/weapon.c:49:31: warning: unused parameter âwâ [-Wunused-parameter]
void weapon_fire_none(Weapon *w) { }
^
src/weapon.c: In function âbullet_update_noneâ:
src/weapon.c:248:33: warning: unused parameter âbâ [-Wunused-parameter]
void bullet_update_none(Bullet *b) { }
^
/opt/toolchains/gen/m68k-elf/bin/m68k-elf-gcc -m68000 -Wall -Wextra -Wno-missing-field-initializers -std=c99 -c -fno-builtin -O3 -fomit-frame-pointer -I/opt/toolchains/gen/m68k-elf/include -I/opt/toolchains/gen/m68k-elf/m68k-elf/include -Isrc -Ires -Iinc -c src/ai/basic.c -o src/ai/basic.o
src/ai/basic.c: In function âai_nullâ:
src/ai/basic.c:12:22: warning: unused parameter âeâ [-Wunused-parameter]
void ai_null(Entity *e) {}
^
/opt/toolchains/gen/m68k-elf/bin/m68k-elf-gcc -m68000 -Wall -Wextra -Wno-missing-field-initializers -std=c99 -c -fno-builtin -O3 -fomit-frame-pointer -I/opt/toolchains/gen/m68k-elf/include -I/opt/toolchains/gen/m68k-elf/m68k-elf/include -Isrc -Ires -Iinc -c src/ai/miza.c -o src/ai/miza.o
src/ai/miza.c:236:16: warning: âfm_spawn_missileâ defined but not used [-Wunused-function]
static Entity *fm_spawn_missile(Entity *e, u8 angindex) {
^~~~~~~~~~~~~~~~
I removed those from make tools
just now. They have done their job and are no longer useful. You should still be able to build them with something like make tscomp
, and if for whatever reason you really want to compile tileopt, install SDL2 and SDL2_image.
For the game itself, it's probably for the best if you ignore the warnings. I use -Wall -Wextra which leaves a few warnings that I don't care to get rid of. 3 of the warnings are for stub functions that do nothing, so I can put it in a function pointer array instead of NULL, so it'll skip over instead of crashing the game with an address error. The thing is, that warning could come up for new functions I write and that is useful, so I don't suppress them.
Are the warnings for the functions that do nothing the unused variable kind? Because there's the (void)(variablename);
idiom to let the compiler know explicitly that you're not intending to use it. Particularly useful in the case of generic callbacks where sooner or later you'll run into one that doesn't really use all the arguments.
I'd be worried about the unsigned vs signed comparison ones though, because promotion rules probably are not going to do what you expect. At the very least do an explicit cast for one of the values so you know for sure what the compiler is going to do.
EDIT: OK yeah rereading again and most of those game warnings are the unused variable kind, yeah use the idiom I mentioned there (I normally just make them the first sentence). The last one is a static function going completely unused from what I can tell?
I've never heard of that. Are you talking like this?
void ai_null((void)(Entity *e)) {}
Or like this?
void ai_null(Entity *e) {
(void)(e);
}
The last one is a new function that isn't used yet. It will be later.
The unsigned vs signed is being thrown for a defunct tool. If I ever have a reason to use tscomp again I'll worry about it then.
The latter. Note that it's literally a sentence that does nothing (the result is discarded, hence the casting to void).
This error seems to be specific to python 3.0 or python 2.6 and lower:
I think you need to change said line to...
(note the added 0 before the colon)
Secondly "make tools" throws innumerable "only allowed in C99 mode" errors. You forgot to add -std=c99.
Effectively this...
...should probably be this...