mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-01 19:42:04 +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:
parent
2c72e6f015
commit
a5f18b5f91
@ -93,7 +93,7 @@ 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.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.cmd=xtensa-lx106-elf-g++
|
||||||
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}
|
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}
|
||||||
|
|
||||||
compiler.as.cmd=xtensa-lx106-elf-as
|
compiler.as.cmd=xtensa-lx106-elf-as
|
||||||
|
|
||||||
|
@ -131,6 +131,7 @@ function build_sketches()
|
|||||||
local build_cmd
|
local build_cmd
|
||||||
build_cmd+=${cli_path}
|
build_cmd+=${cli_path}
|
||||||
build_cmd+=" compile"\
|
build_cmd+=" compile"\
|
||||||
|
" --warnings=all"\
|
||||||
" --build-path $build_dir"\
|
" --build-path $build_dir"\
|
||||||
" --fqbn $fqbn"\
|
" --fqbn $fqbn"\
|
||||||
" --libraries $library_path"\
|
" --libraries $library_path"\
|
||||||
@ -307,20 +308,23 @@ function install_core()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set our custom warnings for all builds
|
# Set our custom warnings for all builds
|
||||||
{ echo "compiler.c.extra_flags=-Wall -Wextra -Werror $debug_flags";
|
printf "%s\n" \
|
||||||
echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror $debug_flags";
|
"compiler.c.extra_flags=-Wall -Wextra $debug_flags" \
|
||||||
echo "mkbuildoptglobals.extra_flags=--ci --cache_core"; } \
|
"compiler.cpp.extra_flags=-Wall -Wextra $debug_flags" \
|
||||||
> platform.local.txt
|
"mkbuildoptglobals.extra_flags=--ci --cache_core" \
|
||||||
|
> ${core_path}/platform.local.txt
|
||||||
echo -e "\n----platform.local.txt----"
|
echo -e "\n----platform.local.txt----"
|
||||||
cat platform.local.txt
|
cat platform.local.txt
|
||||||
echo -e "\n----\n"
|
echo -e "\n----\n"
|
||||||
|
|
||||||
|
# Fetch toolchain & filesystem utils
|
||||||
pushd tools
|
pushd tools
|
||||||
python3 get.py -q
|
python3 get.py -q
|
||||||
|
|
||||||
popd
|
popd
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
# todo: windows runners are using copied tree
|
||||||
local core_dir
|
local core_dir
|
||||||
core_dir=$(dirname "$hardware_core_path")
|
core_dir=$(dirname "$hardware_core_path")
|
||||||
mkdir -p "$core_dir"
|
mkdir -p "$core_dir"
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
These are the warning options for the compiler at different levels.
|
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
|
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
|
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
|
cannot warn them if we use "-w" to disable all warnings, and instead have
|
||||||
to delete every warning but "-Wreturn-type"
|
to delete every warning but "-Wreturn-type"
|
||||||
|
|
||||||
Generate the "none-g++" file with the following command:
|
Generate the C++ variant with the [`make_none-cxxflags.sh`](make_none-cxxflags.sh) script
|
||||||
````
|
|
||||||
./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++
|
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-address-of-packed-member
|
||||||
-Wno-aggressive-loop-optimizations
|
-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-malloc-leak
|
||||||
-Wno-analyzer-null-argument
|
-Wno-analyzer-null-argument
|
||||||
-Wno-analyzer-null-dereference
|
-Wno-analyzer-null-dereference
|
||||||
@ -8,18 +13,19 @@
|
|||||||
-Wno-analyzer-stale-setjmp-buffer
|
-Wno-analyzer-stale-setjmp-buffer
|
||||||
-Wno-analyzer-tainted-array-index
|
-Wno-analyzer-tainted-array-index
|
||||||
-Wno-analyzer-unsafe-call-within-signal-handler
|
-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-attributes
|
||||||
|
-Wno-attribute-warning
|
||||||
-Wno-builtin-declaration-mismatch
|
-Wno-builtin-declaration-mismatch
|
||||||
-Wno-builtin-macro-redefined
|
-Wno-builtin-macro-redefined
|
||||||
-Wno-cannot-profile
|
-Wno-cannot-profile
|
||||||
-Wno-coverage-mismatch
|
-Wno-coverage-mismatch
|
||||||
-Wno-cpp
|
-Wno-cpp
|
||||||
-Wno-deprecated
|
|
||||||
-Wno-deprecated-declarations
|
|
||||||
-Wno-div-by-zero
|
-Wno-div-by-zero
|
||||||
-Wno-endif-labels
|
-Wno-endif-labels
|
||||||
-Wno-enum-compare
|
-Wno-enum-compare
|
||||||
|
-Wno-free-nonheap-object
|
||||||
-Wno-hsa
|
-Wno-hsa
|
||||||
-Wno-if-not-aligned
|
-Wno-if-not-aligned
|
||||||
-Wno-ignored-attributes
|
-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
|
Loading…
x
Reference in New Issue
Block a user