mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
* 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
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++