Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error even w/warnings disabled for no-return fcns #8495

Merged
merged 7 commits into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions tools/warnings/README.md
Original file line number Diff line number Diff line change
@@ -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++
````
Empty file added tools/warnings/default-g++
Empty file.
Empty file added tools/warnings/default-gcc
Empty file.
1 change: 1 addition & 0 deletions tools/warnings/extra-g++
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Wall -Wextra
1 change: 1 addition & 0 deletions tools/warnings/extra-gcc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Wall -Wextra
1 change: 1 addition & 0 deletions tools/warnings/more-g++
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Wall
1 change: 1 addition & 0 deletions tools/warnings/more-gcc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Wall
52 changes: 52 additions & 0 deletions tools/warnings/none-g++
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tools/warnings/none-gcc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-w