diff --git a/platform.txt b/platform.txt index ead29507f..8c882ac21 100644 --- a/platform.txt +++ b/platform.txt @@ -21,11 +21,11 @@ runtime.tools.mkdir={runtime.platform.path}/tools/mkdir.py runtime.tools.cp={runtime.platform.path}/tools/cp.py runtime.tools.eboot={runtime.platform.path}/bootloaders/eboot/eboot.elf -compiler.warning_flags=-w -Werror=return-type -compiler.warning_flags.none=-w -Werror=return-type -compiler.warning_flags.default=-Werror=return-type -compiler.warning_flags.more=-Wall -Werror=return-type -compiler.warning_flags.all=-Wall -Wextra -Werror=return-type +compiler.warning_flags=@{runtime.platform.path}/tools/warnings/none +compiler.warning_flags.none=@{runtime.platform.path}/tools/warnings/none +compiler.warning_flags.default=@{runtime.platform.path}/tools/warnings/default +compiler.warning_flags.more=@{runtime.platform.path}/tools/warnings/more +compiler.warning_flags.all=@{runtime.platform.path}/tools/warnings/extra build.lwip_lib=-llwip_gcc build.lwip_include=lwip/include @@ -68,18 +68,18 @@ compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_S compiler.libraries.ldflags= compiler.c.cmd=xtensa-lx106-elf-gcc -compiler.c.flags=-c {compiler.warning_flags} -std=gnu17 {build.stacksmash_flags} -Os -g -free -fipa-pta -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.mmuflags} {build.non32xferflags} +compiler.c.flags=-c {compiler.warning_flags}-gcc -std=gnu17 {build.stacksmash_flags} -Os -g -free -fipa-pta -Werror=return-type -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.mmuflags} {build.non32xferflags} compiler.S.cmd=xtensa-lx106-elf-gcc compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls "-I{runtime.tools.xtensa-lx106-elf-gcc.path}/include/" -compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/lib/{build.sdk}" "-L{build.path}" "-L{compiler.libc.path}/lib" "-Tlocal.eagle.flash.ld" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read +compiler.c.elf.flags=-g {compiler.warning_flags}-gcc -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/lib/{build.sdk}" "-L{build.path}" "-L{compiler.libc.path}/lib" "-Tlocal.eagle.flash.ld" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read compiler.c.elf.cmd=xtensa-lx106-elf-gcc compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -lespnow -lsmartconfig -lairkiss -lwpa2 {build.stdcpp_lib} -lm -lc -lgcc compiler.cpp.cmd=xtensa-lx106-elf-g++ -compiler.cpp.flags=-c {compiler.warning_flags} {build.stacksmash_flags} -Os -g -free -fipa-pta -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 {build.stdcpp_level} -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.mmuflags} {build.non32xferflags} +compiler.cpp.flags=-c {compiler.warning_flags}-g++ {build.stacksmash_flags} -Os -g -free -fipa-pta -Werror=return-type -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 {build.stdcpp_level} -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.mmuflags} {build.non32xferflags} compiler.as.cmd=xtensa-lx106-elf-as diff --git a/tools/warnings/README.md b/tools/warnings/README.md new file mode 100644 index 000000000..5fb33f2bd --- /dev/null +++ b/tools/warnings/README.md @@ -0,0 +1,12 @@ +These are the warning options for the compiler at different levels. + +Because G++ 10 produces code which crashes when a function is declared +to return a value but doesn't (this is undefined per the C++ specs, but legal +for C11 and above code as long as the [non]returned value is ignored), we +cannot warn them if we use "-w" to disable all warnings, and instead have +to delete every warning but "-Wreturn-type" + +Generate the "none-g++" file with the following command: +```` +./tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc --help=warnings -Q | grep '\[enabled\]' | grep -v 'return-type' | awk '{print $1}' | sed 's/-W/-Wno-/' | grep -v = | grep -v -- -f | egrep -v '(c11-c2x-compat|c90-c99-compat|c99-c11-compat|declaration-after-statement|designated-init|discarded-array-qualifiers|discarded-qualifiers|implicit-int|incompatible-pointer-types|int-conversion|old-style-definition|override-init-side-effects|pointer-to-int-cast)' > tools/warnings/none-g++ +```` diff --git a/tools/warnings/default-g++ b/tools/warnings/default-g++ new file mode 100644 index 000000000..e69de29bb diff --git a/tools/warnings/default-gcc b/tools/warnings/default-gcc new file mode 100644 index 000000000..e69de29bb diff --git a/tools/warnings/extra-g++ b/tools/warnings/extra-g++ new file mode 100644 index 000000000..649258838 --- /dev/null +++ b/tools/warnings/extra-g++ @@ -0,0 +1 @@ +-Wall -Wextra diff --git a/tools/warnings/extra-gcc b/tools/warnings/extra-gcc new file mode 100644 index 000000000..649258838 --- /dev/null +++ b/tools/warnings/extra-gcc @@ -0,0 +1 @@ +-Wall -Wextra diff --git a/tools/warnings/more-g++ b/tools/warnings/more-g++ new file mode 100644 index 000000000..bd866b696 --- /dev/null +++ b/tools/warnings/more-g++ @@ -0,0 +1 @@ +-Wall diff --git a/tools/warnings/more-gcc b/tools/warnings/more-gcc new file mode 100644 index 000000000..bd866b696 --- /dev/null +++ b/tools/warnings/more-gcc @@ -0,0 +1 @@ +-Wall diff --git a/tools/warnings/none-g++ b/tools/warnings/none-g++ new file mode 100644 index 000000000..d72f50f2a --- /dev/null +++ b/tools/warnings/none-g++ @@ -0,0 +1,52 @@ +-Wno-address-of-packed-member +-Wno-aggressive-loop-optimizations +-Wno-analyzer-malloc-leak +-Wno-analyzer-null-argument +-Wno-analyzer-null-dereference +-Wno-analyzer-possible-null-argument +-Wno-analyzer-possible-null-dereference +-Wno-analyzer-stale-setjmp-buffer +-Wno-analyzer-tainted-array-index +-Wno-analyzer-unsafe-call-within-signal-handler +-Wno-attribute-warning +-Wno-attributes +-Wno-builtin-declaration-mismatch +-Wno-builtin-macro-redefined +-Wno-cannot-profile +-Wno-coverage-mismatch +-Wno-cpp +-Wno-deprecated +-Wno-deprecated-declarations +-Wno-div-by-zero +-Wno-endif-labels +-Wno-enum-compare +-Wno-hsa +-Wno-if-not-aligned +-Wno-ignored-attributes +-Wno-int-to-pointer-cast +-Wno-invalid-memory-model +-Wno-long-long +-Wno-lto-type-mismatch +-Wno-main +-Wno-missing-profile +-Wno-narrowing +-Wno-odr +-Wno-overflow +-Wno-packed-bitfield-compat +-Wno-pointer-compare +-Wno-pragmas +-Wno-prio-ctor-dtor +-Wno-psabi +-Wno-return-local-addr +-Wno-shift-count-negative +-Wno-shift-count-overflow +-Wno-shift-negative-value +-Wno-sizeof-array-argument +-Wno-switch-bool +-Wno-switch-outside-range +-Wno-switch-unreachable +-Wno-sync-nand +-Wno-trigraphs +-Wno-unused-result +-Wno-varargs +-Wno-vla diff --git a/tools/warnings/none-gcc b/tools/warnings/none-gcc new file mode 100644 index 000000000..e1350473a --- /dev/null +++ b/tools/warnings/none-gcc @@ -0,0 +1 @@ +-w