-Wextra emits a bunch of warnings when compiling the core-files.
I've wrote a pull-request yesterday, which fixes some of them, but there are many left.
There are two types of warnings :
a) warning: unused parameter [-Wunused-parameter]
and
b) warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
While b) really needs an individual fix per warning, a) is not as important (low priority).
A suggestion for "warning: unused parameter" is to use a macro like this:
- or to use the attribute in the macro:
(taken from https://stackoverflow.com/questions/3599160/unused-parameter-warnings-in-c-code)
some examples:
I'd suggest to fix b) for the next release of teensyduino .
some examples:
Just add -Wextra to the GCC-Commandline to see them.
I've wrote a pull-request yesterday, which fixes some of them, but there are many left.
There are two types of warnings :
a) warning: unused parameter [-Wunused-parameter]
and
b) warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
While b) really needs an individual fix per warning, a) is not as important (low priority).
A suggestion for "warning: unused parameter" is to use a macro like this:
Code:
#define UNUSED(x) (void)(x)
- or to use the attribute in the macro:
Code:
#ifdef __GNUC__
# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
#else
# define UNUSED(x) UNUSED_ ## x
#endif
#ifdef __GNUC__
# define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x
#else
# define UNUSED_FUNCTION(x) UNUSED_ ## x
#endif
some examples:
Code:
C:\Arduino\hardware\teensy\avr\libraries\Audio/analyze_fft256.h:89:31: warning: unused parameter 'n' [-Wunused-parameter]
void averageTogether(uint8_t n) {
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:62:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/analyze_fft1024.h:81:31: warning: unused parameter 'n' [-Wunused-parameter]
void averageTogether(uint8_t n) {
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:68:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/control_sgtl5000.h:40:24: warning: unused parameter 'n' [-Wunused-parameter]
bool inputLevel(float n) {return false;}
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:69:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/control_wm8731.h:39:23: warning: unused parameter 'n' [-Wunused-parameter]
bool inputSelect(int n) { return false; }
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:70:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/control_ak4558.h:245:24: warning: unused parameter 'n' [-Wunused-parameter]
bool inputLevel(float n) { return false; } //not supported by AK4558
^
C:\Arduino\hardware\teensy\avr\libraries\Audio/control_ak4558.h:246:23: warning: unused parameter 'n' [-Wunused-parameter]
bool inputSelect(int n) { return false; } //sets inputs to mono left, mono right, stereo (default stereo), not yet implemented
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:71:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/control_cs4272.h:41:24: warning: unused parameter 'n' [-Wunused-parameter]
bool inputLevel(float n) { return false; }
^
C:\Arduino\hardware\teensy\avr\libraries\Audio/control_cs4272.h:42:23: warning: unused parameter 'n' [-Wunused-parameter]
bool inputSelect(int n) { return false; }
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:89:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/input_i2s.h:41:20: warning: unused parameter 'dummy' [-Wunused-parameter]
AudioInputI2S(int dummy): AudioStream(0, NULL) {} // to be used only inside AudioInputI2Sslave !!
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:95:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/output_i2s.h:42:21: warning: unused parameter 'dummy' [-Wunused-parameter]
AudioOutputI2S(int dummy): AudioStream(2, inputQueueArray) {} // to be used only inside AudioOutputI2Sslave !!
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:98:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/output_spdif.h:40:23: warning: unused parameter 'dummy' [-Wunused-parameter]
AudioOutputSPDIF(int dummy): AudioStream(2, inputQueueArray) {}
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:109:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/synth_waveform.h:113:53: warning: unused parameter 'maxFreq' [-Wunused-parameter]
void arbitraryWaveform(const int16_t *data, float maxFreq) {
^
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio/Audio.h:113:0,
from C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new/Teensy64.h:8,
from C:\Users\Frank\Documents\Arduino\c64\c64.ino:3:
C:\Arduino\hardware\teensy\avr\libraries\Audio/synth_karplusstrong.h:53:21: warning: unused parameter 'velocity' [-Wunused-parameter]
void noteOff(float velocity) {
I'd suggest to fix b) for the next release of teensyduino .
some examples:
Code:
"C:\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-gcc" -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK66FX1M0__ -DTEENSYDUINO=137 -DARDUINO=10803 -DF_CPU=240000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@f:\arduino_build_633245/sketch/defs.h" "-IC:\Arduino\hardware\teensy\avr\cores\teensy3" "C:\Arduino\hardware\teensy\avr\cores\teensy3\nonstd.c" -o "f:\arduino_build_633245\core\nonstd.c.o"
C:\Arduino\hardware\teensy\avr\cores\teensy3\nonstd.c: In function 'dtostrf':
C:\Arduino\hardware\teensy\avr\cores\teensy3\nonstd.c:174:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (newDecimalPoint - decpt == precision + 1) decpt++;
^
"C:\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-gcc" -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK66FX1M0__ -DTEENSYDUINO=137 -DARDUINO=10803 -DF_CPU=240000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@f:\arduino_build_633245/sketch/defs.h" "-IC:\Arduino\hardware\teensy\avr\cores\teensy3" "C:\Arduino\hardware\teensy\avr\cores\teensy3\pins_teensy.c" -o "f:\arduino_build_633245\core\pins_teensy.c.o"
C:\Arduino\hardware\teensy\avr\cores\teensy3\pins_teensy.c: In function 'analogWrite':
C:\Arduino\hardware\teensy\avr\cores\teensy3\pins_teensy.c:727:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
} else if (val >= max) {
Last edited: