Stephane-D / SGDK

SGDK - A free and open development kit for the Sega Mega Drive
https://www.patreon.com/SGDK
MIT License
1.74k stars 187 forks source link

GCC 13 default behavior #336

Closed moon-watcher closed 3 months ago

moon-watcher commented 3 months ago

Had some "multiple definition of" errors compiling with GCC 13. According to this link GCC changed default behavior since GCC 10 so would be nice to add -fcommon flag to Makefile DEFAULT_FLAGS to ensure higher compatibility with our projects.

https://github.com/Stephane-D/SGDK/blob/ee31806442ab6c9ddf636444ca16f445c29da502/makefile.gen#L64

DEFAULT_FLAGS= $(EXTRA_FLAGS) -DSGDK_GCC -m68000 -Wall -Wextra -Wno-shift-negative-value -Wno-main -Wno-unused-parameter -fno-builtin -fms-extensions -fcommon $(INCS) -B$(BIN)

Stephane-D commented 3 months ago

This is definitely better to avoid the multiple definitions (which are basically errors) which previous GCC was accepting in some situations, hence we want to keep the default GCC 13 behavior which is less permissive. You can patch your makefile but keep in mind that it potentially hides some issues with how you declared variables.