Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control reaches end of non-void function #92

Open
Testato opened this issue Aug 29, 2022 · 1 comment
Open

control reaches end of non-void function #92

Testato opened this issue Aug 29, 2022 · 1 comment

Comments

@Testato
Copy link

Testato commented Aug 29, 2022

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]
   }
   ^
@Bazmundi
Copy link

Bazmundi commented Sep 12, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants