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

Build error on Fedora 24 with gcc 6.1.1 #666

Closed
ragnar-ouchterlony opened this issue Jun 22, 2016 · 9 comments
Closed

Build error on Fedora 24 with gcc 6.1.1 #666

ragnar-ouchterlony opened this issue Jun 22, 2016 · 9 comments

Comments

@ragnar-ouchterlony
Copy link

Built using "cmake -DRAPIDJSON_HAS_STDSTRING=ON .. && make".

System is Fedora 24

gcc is 6.1.1.

Build ends with:

/extra/ragnar/source/rapidjson-master/test/unittest/namespacetest.cpp:39:19: required from here
/extra/ragnar/source/rapidjson-master/include/rapidjson/document.h:755:66: error: throw will always call terminate() [-Werror=terminate]
RAPIDJSON_ASSERT(this != &rhs);

Full output from cmake and make attached.

cmake.txt
build.txt

@pah
Copy link
Contributor

pah commented Jun 22, 2016

Do you override RAPIDJSON_ASSERT with some kind of exception throwing mechanism?
The functions where this warnings are generated from are marked as RAPIDJSON_NOEXCEPT, which means that indeed throwing an exception from there will lead to a call to std::terminate.

@ragnar-ouchterlony
Copy link
Author

No. I have not done any conscious overriding at least. I can reproduce it by doing the following steps:

git clone https://github.com/miloyip/rapidjson
cd rapidjson
mkdir build
cd build
cmake -DRAPIDJSON_HAS_STDSTRING=ON ..
make

@pah
Copy link
Contributor

pah commented Jun 23, 2016

I have just added #667 with a proposed fix.

For document.h, I decided to keep the offending code, i.e. suppress the warning locally on GCC 6 and later (Clang might need to be added as well at some point).

For schema.h, the RAPIDJSON_NOEXCEPT annotation has been removed, as the corresponding constructor calls RAPIDJSON_NEW, which might indeed throw.

Some tests exposed -Wdangling-else warnings, which have been addressed, too.

miloyip added a commit that referenced this issue Jun 27, 2016
Fix warnings on GCC 6 and later (closes #666)
@ragnar-ouchterlony
Copy link
Author

Thanks for the fix.

But the change in readertest.cpp exposes another build problem for me.

[ 68%] Building CXX object test/unittest/CMakeFiles/unittest.dir/readertest.cpp.o
/extra/ragnar/source/rapidjson/test/unittest/readertest.cpp:32:1: error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
RAPIDJSON_DIAG_OFF(dangling-else)
^~~~~~~~~

And I am a bit confused about that flag, since my gcc (from Fedora 24) does not seem to have any "-Wdangling-else" as seen by "gcc --help=warnings". I can also not find any reference to it in the online gcc documentation: https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/Option-Summary.html

$ gcc --version
gcc (GCC) 6.1.1 20160621 (Red Hat 6.1.1-3)

@miloyip miloyip reopened this Jun 27, 2016
@pah
Copy link
Contributor

pah commented Jun 27, 2016

Ok, it seems that the -Wdangling-else warnings showed up on a GCC 7.x development version. For now, it should be safe to drop the corresponding suppression in readertest.cpp.

@ragnar-ouchterlony
Copy link
Author

Ah, I suspected as much, but did not find it easily.

@pah
Copy link
Contributor

pah commented Jun 27, 2016

I've raised the GCC version to suppress the warning in readertest.cpp to 7.x or later, see #669.
See this patch for the addition of the flag in April 2016.

@ragnar-ouchterlony
Copy link
Author

Great! Now I was able to build without problems.

@miloyip miloyip closed this as completed Jun 28, 2016
@miloyip
Copy link
Collaborator

miloyip commented Jun 28, 2016

Thanks @pah

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

3 participants