pubsubclient
pubsubclient copied to clipboard
control reaches end of non-void function
Building for Esp32 appears this Warning:
.pio/libdeps/esp32dev/PubSubClient_imroy_/src/MQTT.cpp: In member function 'virtual MQTT::message_type MQTT::Publish::response_type() const':
.pio/libdeps/esp32dev/PubSubClient_imroy_/src/MQTT.cpp:602:3: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Ditto for me on ESP-8266 , the code worked originally so I am assume PIO (especially compiler: Core 6.1.4 Home 3.4.3) updates make this more stringent? Is this as straight forward as rewriting the function to read?:
message_type Publish::response_type(void) const {
switch (qos()) {
case 1:
return PUBACK;
case 2:
return PUBREC;
default:
return None;
}
}
Obviously compiles etc., but any unwanted side effects? I note the case indices do not relate to the enum order in any event, since that reads:
None=0
PUBACK=4
PUBREC=5
Seems then a safe fix?
Relevant platformio.ini:
[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
I note there are a range of warnings of same but less lethal ilk?