Skip to content

Commit 354f092

Browse files
committed
Tools - none-cxxflags generator script
GCC10 -> GCC (as in general, not specific to 10) cpp -> cxx to be consistent with gcc terminology grep exclude patterns in a separate file exclude 'deprecated' warnings by default
1 parent 2c72e6f commit 354f092

File tree

8 files changed

+47
-9
lines changed

8 files changed

+47
-9
lines changed

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ compiler.c.elf.cmd=xtensa-lx106-elf-gcc
9393
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
9494

9595
compiler.cpp.cmd=xtensa-lx106-elf-g++
96-
compiler.cpp.flags=-c "{compiler.warning_flags}-cppflags" {build.stacksmash_flags} -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} {build.iramfloat}
96+
compiler.cpp.flags=-c "{compiler.warning_flags}-cxxflags" {build.stacksmash_flags} -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} {build.iramfloat}
9797

9898
compiler.as.cmd=xtensa-lx106-elf-as
9999

tools/warnings/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
These are the warning options for the compiler at different levels.
22

3-
Because G++ 10 produces code which crashes when a function is declared
3+
Because GCC produces code which crashes when a function is declared
44
to return a value but doesn't (this is undefined per the C++ specs, but legal
55
for C11 and above code as long as the [non]returned value is ignored), we
66
cannot warn them if we use "-w" to disable all warnings, and instead have
77
to delete every warning but "-Wreturn-type"
88

9-
Generate the "none-g++" file with the following command:
10-
````
11-
./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++
12-
````
9+
Generate the C++ variant with the [`make_none-cxxflags.sh`](make_none-cxxflags.sh) script
10+
11+
Modify [`patterns_none-cxxflags.txt`](patterns_none-cxxflags.txt) patterns to ignore incompatible warning types
File renamed without changes.
File renamed without changes.

tools/warnings/make_none-cxxflags.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
3+
root=$(git rev-parse --show-toplevel)
4+
${CC:-xtensa-lx106-elf-gcc} --help=warnings -Q |\
5+
grep '\[enabled\]' |\
6+
grep -v 'return-type' |\
7+
awk '{print $1}' |\
8+
sed 's/-W/-Wno-/' |\
9+
grep -v = |\
10+
grep -v -f ${root}/tools/warnings/patterns_none-cxxflags.txt |\
11+
sort -u > ${root}/tools/warnings/none-cxxflags
File renamed without changes.

tools/warnings/none-cppflags renamed to tools/warnings/none-cxxflags

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
-Wno-address-of-packed-member
22
-Wno-aggressive-loop-optimizations
3+
-Wno-analyzer-double-fclose
4+
-Wno-analyzer-double-free
5+
-Wno-analyzer-exposure-through-output-file
6+
-Wno-analyzer-file-leak
7+
-Wno-analyzer-free-of-non-heap
38
-Wno-analyzer-malloc-leak
49
-Wno-analyzer-null-argument
510
-Wno-analyzer-null-dereference
@@ -8,18 +13,19 @@
813
-Wno-analyzer-stale-setjmp-buffer
914
-Wno-analyzer-tainted-array-index
1015
-Wno-analyzer-unsafe-call-within-signal-handler
11-
-Wno-attribute-warning
16+
-Wno-analyzer-use-after-free
17+
-Wno-analyzer-use-of-pointer-in-stale-stack-frame
1218
-Wno-attributes
19+
-Wno-attribute-warning
1320
-Wno-builtin-declaration-mismatch
1421
-Wno-builtin-macro-redefined
1522
-Wno-cannot-profile
1623
-Wno-coverage-mismatch
1724
-Wno-cpp
18-
-Wno-deprecated
19-
-Wno-deprecated-declarations
2025
-Wno-div-by-zero
2126
-Wno-endif-labels
2227
-Wno-enum-compare
28+
-Wno-free-nonheap-object
2329
-Wno-hsa
2430
-Wno-if-not-aligned
2531
-Wno-ignored-attributes
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=
2+
NSObject-attribute
3+
c11-c2x-compat
4+
c90-c99-compat
5+
c99-c11-compat
6+
compare-distinct-pointer-types
7+
complain-wrong-lang
8+
declaration-after-statement
9+
declaration-missing-parameter-type
10+
deprecated
11+
deprecated-declarations
12+
designated-init
13+
discarded-array-qualifiers
14+
discarded-qualifiers
15+
implicit-function-declaration
16+
implicit-int
17+
incompatible-pointer-types
18+
int-conversion
19+
old-style-definition
20+
override-init-side-effects
21+
pointer-to-int-cast
22+
return-mismatch

0 commit comments

Comments
 (0)