1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Add -Werror to acceptance builds for C and CPP (#4369)

Use platform.local.txt to add -Werror to GCC for the build of all
code.  Any warnings on a submitted patch will cause an error.

Several examples and libraries had warnings/errors (missing returns
on functions, types, etc.).  Clean those up with this commit as well.
This commit is contained in:
Earle F. Philhower, III
2018-02-17 18:47:10 -08:00
committed by GitHub
parent ad42ab69c1
commit f9ac524b13
22 changed files with 73 additions and 51 deletions

View File

@ -40,7 +40,7 @@ function build_sketches()
local build_arg=$3
local build_dir=build.tmp
mkdir -p $build_dir
local build_cmd="python tools/build.py -b generic -v -k -p $PWD/$build_dir $build_arg "
local build_cmd="python tools/build.py -b generic -v -w all -k -p $PWD/$build_dir $build_arg "
local sketches=$(find $srcpath -name *.ino)
print_size_info >size.log
export ARDUINO_IDE_PATH=$arduino
@ -50,7 +50,7 @@ function build_sketches()
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
echo "Skipping $sketch, beacause it is not the main sketch file";
echo "Skipping $sketch, because it is not the main sketch file";
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
@ -68,6 +68,12 @@ function build_sketches()
cat build.log
set -e
return $result
else
local warns=$( grep -c warning: build.log )
if [ $warns -ne 0 ]; then
echo "Warnings detected, log follows:"
cat build.log
fi
fi
rm build.log
print_size_info $build_dir/*.elf >>size.log
@ -97,6 +103,9 @@ function install_ide()
mkdir esp8266com
cd esp8266com
ln -s $core_path esp8266
# Set custom warnings for all builds (i.e. could add -Wextra at some point)
echo "compiler.c.extra_flags=-Wall -Werror" > esp8266/platform.local.txt
echo "compiler.cpp.extra_flags=-Wall -Werror" >> esp8266/platform.local.txt
cd esp8266/tools
python get.py
export PATH="$ide_path:$core_path/tools/xtensa-lx106-elf/bin:$PATH"