-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error even w/warnings disabled for no-return fcns (#8495)
* Error even w/warnings disabled for no-return fcns A function whose prototype says it will return a value but doesn't is undefined behaviour in C++. GCC 10 will generate code that crashes in this case. In warnings==None mode, insterad of turning off all warnings with `-w`, explicitly list all G++ possible warnings except for the `no-return` warning which catches this programming error. * Use different lists for GCC vs G++ G++ and GCC have different warning options, so use different lists. * Make separate file for each level, add readme The readme now includes the exact commands required to regenerate the none-XXX files, no manual editing needed. * Address review comments, only adjusts G++/None
- Loading branch information
1 parent
ead5f94
commit 46190b6
Showing
10 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-Wall -Wextra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-Wall -Wextra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-Wall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-Wall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-w |
runtime.platform.path
can contain space, such as"C:\Program Files (x86)\Arduino\hardware\esp8266com\esp8266"
.