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

Fix warnings during compilation #52

Merged
merged 1 commit into from
Jun 7, 2021

Conversation

corteccia
Copy link
Contributor

During building examples in Navio2/C++, regardless of cross-compilation or native build, some warnings appear:


Navio2/C++/Examples/AHRS.cpp: In function ‘std::string get_sensor_name(int, char**)’:
Navio2/C++/Examples/AHRS.cpp:414:1: warning: control reaches end of non-void function [-Wreturn-type]
      414 | }
          | ^
Navio2/C++/Examples/AccelGyroMag.cpp: In function ‘std::string get_sensor_name(int, char**)’:
Navio2/C++/Examples/AccelGyroMag.cpp:79:1: warning: control reaches end of non-void function [-Wreturn-type]
       79 | }
          | ^

It's needed to return string value in those functions even if control never reaches there. In the main function, if 'get_sensor_name' function returns an empty value, it will return EXIT_FAILURE which is why it is needed to return an empty string in case it's not Navio2.

There should be a return value even if control never reaches there.
@AlexanderDranitsa AlexanderDranitsa merged commit c71f5fd into emlid:master Jun 7, 2021
@corteccia corteccia deleted the pr-fix-warnings branch June 7, 2021 12:27
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

Successfully merging this pull request may close these issues.

None yet

2 participants