mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Tools - none-cxxflags generator script & enable deprecation warnings (#9245)
* 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 * actually set warnings when compiling --warnings=none is arduino-cli implicit default
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
These are the warning options for the compiler at different levels.
|
||||
|
||||
Because G++ 10 produces code which crashes when a function is declared
|
||||
Because GCC 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++
|
||||
````
|
||||
Generate the C++ variant with the [`make_none-cxxflags.sh`](make_none-cxxflags.sh) script
|
||||
|
||||
Modify [`patterns_none-cxxflags.txt`](patterns_none-cxxflags.txt) patterns to ignore incompatible warning types
|
||||
|
11
tools/warnings/make_none-cxxflags.sh
Executable file
11
tools/warnings/make_none-cxxflags.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
${CC:-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 ${root}/tools/warnings/patterns_none-cxxflags.txt |\
|
||||
sort -u > ${root}/tools/warnings/none-cxxflags
|
@ -1,5 +1,10 @@
|
||||
-Wno-address-of-packed-member
|
||||
-Wno-aggressive-loop-optimizations
|
||||
-Wno-analyzer-double-fclose
|
||||
-Wno-analyzer-double-free
|
||||
-Wno-analyzer-exposure-through-output-file
|
||||
-Wno-analyzer-file-leak
|
||||
-Wno-analyzer-free-of-non-heap
|
||||
-Wno-analyzer-malloc-leak
|
||||
-Wno-analyzer-null-argument
|
||||
-Wno-analyzer-null-dereference
|
||||
@ -8,18 +13,19 @@
|
||||
-Wno-analyzer-stale-setjmp-buffer
|
||||
-Wno-analyzer-tainted-array-index
|
||||
-Wno-analyzer-unsafe-call-within-signal-handler
|
||||
-Wno-attribute-warning
|
||||
-Wno-analyzer-use-after-free
|
||||
-Wno-analyzer-use-of-pointer-in-stale-stack-frame
|
||||
-Wno-attributes
|
||||
-Wno-attribute-warning
|
||||
-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-free-nonheap-object
|
||||
-Wno-hsa
|
||||
-Wno-if-not-aligned
|
||||
-Wno-ignored-attributes
|
22
tools/warnings/patterns_none-cxxflags.txt
Normal file
22
tools/warnings/patterns_none-cxxflags.txt
Normal file
@ -0,0 +1,22 @@
|
||||
=
|
||||
NSObject-attribute
|
||||
c11-c2x-compat
|
||||
c90-c99-compat
|
||||
c99-c11-compat
|
||||
compare-distinct-pointer-types
|
||||
complain-wrong-lang
|
||||
declaration-after-statement
|
||||
declaration-missing-parameter-type
|
||||
deprecated
|
||||
deprecated-declarations
|
||||
designated-init
|
||||
discarded-array-qualifiers
|
||||
discarded-qualifiers
|
||||
implicit-function-declaration
|
||||
implicit-int
|
||||
incompatible-pointer-types
|
||||
int-conversion
|
||||
old-style-definition
|
||||
override-init-side-effects
|
||||
pointer-to-int-cast
|
||||
return-mismatch
|
Reference in New Issue
Block a user