You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling using GCC 11 from Teensyduino 1.58 beta 2 with -Wextra enabled, I get the following two warnings in the Teensy core files. (I usually compile with -Wall -Wextra -Werror in the CI builds for my libraries.)
I believe that these warnings are indeed valid.
In file included from /home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/libraries/SPI/SPI.h:23:
/home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/cores/teensy3/DMAChannel.h: In copy constructor 'DMASetting::DMASetting(const DMASetting&)':
/home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/cores/teensy3/DMAChannel.h:405:25: error: implicitly-declared 'constexpr DMASetting& DMASetting::operator=(const DMASetting&)' is deprecated [-Werror=deprecated-copy]
405 | *this = c;
| ^
/home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/cores/teensy3/DMAChannel.h:403:9: note: because 'DMASetting' has user-provided 'DMASetting::DMASetting(const DMASetting&)'403 | DMASetting(const DMASetting &c) {
| ^~~~~~~~~~
Here, the implicitly declared copy assignment operator operator=(const DMASetting &) is used instead of the user-defined assignment operator operator=(const DMABaseClass &). Although I'm not familiar with the specifics, I believe this might be a mistake, because copy_tcd is not called in this case.
If it is indeed a mistake, I'd recommend explicitly implementing or =deleteing operator=(const DMASetting &). If it's not a mistake, I think you should be able to explicitly use DMASetting &operator=(const DMASetting &) = default.
With USB type set to MIDI, you also get this warning about an invalid function pointer cast:
In file included from /home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/cores/teensy3/WProgram.h:62,
from /tmp/arduino_build_737688/pch/Arduino.h:6:
/home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/cores/teensy3/usb_midi.h: In member function 'void usb_midi_class::setHandleSysEx(void (*)(const uint8_t*, uint16_t, bool))':
/home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/cores/teensy3/usb_midi.h:327:47: warning: cast between incompatible function types from 'void (*)(const uint8_t*, uint16_t, bool)' {aka 'void (*)(const unsigned char*, short unsigned int, bool)'} to 'void (*)(const uint8_t*, uint16_t, uint8_t)' {aka 'void (*)(const unsigned char*, short unsigned int, unsigned char)'} [-Wcast-function-type]
327 | usb_midi_handleSysExPartial = (void (*)(constuint8_t *, uint16_t, uint8_t))fptr;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/cores/teensy3/usb_midi.h: In member function 'void usb_midi_class::setHandleSystemExclusive(void (*)(const uint8_t*, uint16_t, bool))':
/home/pieter/.arduino15/packages/teensy/hardware/avr/1.58.0-beta2/cores/teensy3/usb_midi.h:331:47: warning: cast between incompatible function types from 'void (*)(const uint8_t*, uint16_t, bool)' {aka 'void (*)(const unsigned char*, short unsigned int, bool)'} to 'void (*)(const uint8_t*, uint16_t, uint8_t)' {aka 'void (*)(const unsigned char*, short unsigned int, unsigned char)'} [-Wcast-function-type]
331 | usb_midi_handleSysExPartial = (void (*)(constuint8_t *, uint16_t, uint8_t))fptr;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Although this is probably fine, it still invokes undefined behavior, and it would be nice to get rid of the warning (and the cast) anyway by using the same signature everywhere.
To reproduce: create an empty sketch and add a .cpp file to it with the following contents (I ignored unused parameter warnings to filter out some of the noise):
Hi Paul,
When compiling using GCC 11 from Teensyduino 1.58 beta 2 with
-Wextra
enabled, I get the following two warnings in the Teensy core files. (I usually compile with-Wall -Wextra -Werror
in the CI builds for my libraries.)I believe that these warnings are indeed valid.
Here, the implicitly declared copy assignment operator
operator=(const DMASetting &)
is used instead of the user-defined assignment operatoroperator=(const DMABaseClass &)
. Although I'm not familiar with the specifics, I believe this might be a mistake, becausecopy_tcd
is not called in this case.If it is indeed a mistake, I'd recommend explicitly implementing or
=delete
ingoperator=(const DMASetting &)
. If it's not a mistake, I think you should be able to explicitly useDMASetting &operator=(const DMASetting &) = default
.With USB type set to MIDI, you also get this warning about an invalid function pointer cast:
Although this is probably fine, it still invokes undefined behavior, and it would be nice to get rid of the warning (and the cast) anyway by using the same signature everywhere.
To reproduce: create an empty sketch and add a
.cpp
file to it with the following contents (I ignored unused parameter warnings to filter out some of the noise):The text was updated successfully, but these errors were encountered: