-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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 tests with warnings as errors enabled #2245
Build tests with warnings as errors enabled #2245
Conversation
FYI: These are the flags I check regularly: https://github.com/nlohmann/json/blob/develop/Makefile#L93. |
0aaf600
to
f3ecb6a
Compare
1ad4d1a
to
08f93bd
Compare
727d993
to
49844f2
Compare
14d56b7
to
1d15d7c
Compare
GCC 7.0 and higher complain when compiled in release mode about the unused result of parse-like functions. This makes totally sense as these are marked with JSON_HEDLEY_WARN_UNUSED_RESULT. Store the result in a json object named _ to silence that warning.
Co-authored-by: James Moore <james.moore@veracityuk.com>
Clang on Windows comes in two flavours, one which pretens to be like GCC and one which pretends to be like MSVC. We need to distinguish these two so that we can pass the correct compiler flags. Co-authored-by: James Moore <james.moore@veracityuk.com>
This currently produces In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.27.29110\include\ciso646:9: In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.27.29110\include\yvals.h:9: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.27.29110\include\yvals_core.h:494:2: error: STL1000: Unexpected compiler version, expected Clang 10.0.0 or newer. #error STL1000: Unexpected compiler version, expected Clang 10.0.0 or newer. and that is very likely due to the new -pedantic flag when compiling. Let's remove this compiler as it clearly is not meant to be used with these MSVC headers.
1d15d7c
to
e226460
Compare
@nlohmann Ready. |
@@ -15,20 +15,6 @@ jobs: | |||
- name: test | |||
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure | |||
|
|||
clang9: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove Clang 9?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message explains why, see e226460.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the problem be that windows-latest doesn't remain the same? Newer versions of Visual studio's standard c++ library also require newer versions of clang, so when testing llvm on windows, a fixed version of clang should probably be paired with a fixed version of the VS toolchain.
@@ -29,6 +29,10 @@ SOFTWARE. | |||
|
|||
#include "doctest_compatibility.h" | |||
|
|||
#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) | |||
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need this after JSON_TESTS_PRIVATE
was introduced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a look if I find time.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Is it possible to override this? |
@MBalszun Not as of now. But a patch is welcome to add a cmake option JSON_WARNINGS_AS_ERRORS defaulting to ON. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
So, what is the state here? Can this be merged? I see there is a merge conflict, but github doesn't show me what it is. |
I am currently overworking the targets for the CI. The goal is to move everything from the individual Travis/AppVeyor/GitHub Actions files as well as the project's Makefile into some CMake-based targets. This includes the warning flags for GCC and Clang I linked in #2245 (comment). Then I think we only need to add a similar target for MSVC. I will open a PR to make the proposal visible. It is not done yet, but I think it will tackle most issues described here (apart of MSVC). |
See #2561. |
Thanks for the update. I wasn't aware that all the warning flags for gcc and clang are set in a separate make file. That aside: You are aware tha travis.org is being shut down and that travis.com won't provide unlimited CI time for open source projects anymore right? Or have you negotiated a deal with them? |
I have no deal with travis. If they stop working the way they used to, I will rely on AppVeyor and GitHub Actions. In the meantime, I see whether I can get a self-hosted runner to work so that I can automate as many system-independent tests as possible. |
I'm trying to resurrect #1900.
#if DOCTEST_CLANG >=
->#if DOCTEST_CLANG && DOCTEST_CLANG >=
Close #1798.