ssilverman / QNEthernet

An lwIP-based Ethernet library for Teensy 4.1 and possibly some other platforms
GNU Affero General Public License v3.0
80 stars 24 forks source link

StaticInit.h: In instantiation of 'StaticInit<T>::StaticInit() [with T = qindesign::network::MDNSClass]': #69

Closed shmorgan closed 5 months ago

shmorgan commented 5 months ago

Receive this warning during compile

Arduino 1.8.19 Teensyduino 1.57 QNEthernet 0.27.0

Using library SD at version 2.0.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD Using library SdFat at version 2.1.2 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI Using library TeensyDMX at version 4.2.0 in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\TeensyDMX Using library FseqReader at version 0.1.0 in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\FseqReader Using library sACN in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\sACN (legacy) Using library QNEthernet at version 0.27.0 in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet Using library FTP_Server_Teensy41 at version 1.2.0 in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\FTP_Server_Teensy41 Using library WDT_T4 at version 0.1 in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\WDT_T4 Using library AsyncWebServer_Teensy41 at version 1.7.0 in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\AsyncWebServer_Teensy41 Using library Teensy41_AsyncTCP at version 1.1.0 in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\Teensy41_AsyncTCP Using library EEPROM at version 2.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\EEPROM Using library ArduinoJson at version 7.0.4 in folder: C:\Users\Stephen Morgan\Documents\Arduino\libraries\ArduinoJson

In file included from C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/QNMDNS.h:19:0, from C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/QNEthernet.h:21, from C:\Users\Stephen Morgan\Documents\Arduino\libraries\sACN/sACN.h:9, from D:\GitHub\S4i-Replay-2.1\S4i-Replay-2.1.ino:63: C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/StaticInit.h: In instantiation of 'StaticInit::StaticInit() [with T = qindesign::network::MDNSClass]': C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/QNMDNS.h:171:1: required from here C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/StaticInit.h:30:16: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] StaticInit() { ^ C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/StaticInit.h: In instantiation of 'StaticInit::StaticInit() [with T = qindesign::security::RandomDevice]': C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/security/RandomDevice.h:47:1: required from here C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/StaticInit.h:30:16: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/StaticInit.h: In instantiation of 'StaticInit::StaticInit() [with T = qindesign::network::EthernetClass]': C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/QNEthernet.h:396:1: required from here C:\Users\Stephen Morgan\Documents\Arduino\libraries\QNEthernet\src/StaticInit.h:30:16: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

ssilverman commented 5 months ago

What happens if you use Teensyduino 1.59? (You’re using a much older compiler in 1.57.)

Side note: none of those “async” libraries use QNEthernet for operation. They use the lwIP stack directly.

ssilverman commented 5 months ago

I don’t see a warning here when compiling one of the examples using Teensyduino 1.59.

ssilverman commented 5 months ago

I just pushed a change that better satisfies strict aliasing in StaticInit. It should no longer generate that warning about that class when using Teensyduino 1.57.

ssilverman commented 4 months ago

Note: Fixed in 573098f311256d30cf3c6974f339b8e6a6249eec.