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

Return type warning treated as error - compilation fails on Linux #20

Open
coezmaden opened this issue Oct 20, 2023 · 1 comment
Open

Comments

@coezmaden
Copy link

Due to the setting of -Werror=return-type in the compiler flags below:

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror=return-type -Werror=deprecated" )

the project won't compile on my Linux using Cmake due to no return statement placed before the bracket here:

Here is the warning treated as error that gcc 7.5.0 issues:

[ 30%] Building CXX object CMakeFiles/gnsstk.dir/core/lib/GNSSCore/SatMetaDataStore.cpp.o
/home/coezmaden/Repositories/gnsstk/core/lib/GNSSCore/RefFrameRlz.cpp: In function ‘gnsstk::RefFrameRlz gnsstk::getRefFrameRlz(gnsstk::RefFrameSys, const gnsstk::CommonTime&)’:
/home/coezmaden/Repositories/gnsstk/core/lib/GNSSCore/RefFrameRlz.cpp:177:4: error: control reaches end of non-void function [-Werror=return-type]
    }
    ^

Can be a potential easy fix by adding a return of an unknown reference frame RefFrameRlz::Unknown as I have done in my fork: 3f332d5
Should be tested for unwanted changes to the logic of the function.

@coezmaden
Copy link
Author

A fix for Linux users who just want to get on with their lives: Set an additional cmake flag -DCMAKE_CXX_FLAGS=\'-w\'.

Extract from the gcc man page:

-w
Inhibit all warning messages.

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

1 participant