RFE: -pedantic library build in CI
While looking into issue 490, we've noticed that we are not currently testing with -Werror -pedantic
applied to the library build. We do so only for the tests (and even there a subset).
This issue is a request to get the GitLab CI jobs dirac-{gcc,clang}_wall
to perform pedantic checking of the library code, not just the user-facing headers as is currently done compiling a subset of the tests.
Comments (8)
-
reporter -
reporter The next issue I hit (still only seen on macOS, not Linux) is a complaint from logic in
utils/config/upcxx/gasnet_macros.sh
:conftest.cpp:6:54: error: empty macro arguments are a C99 feature [-Werror,-Wc99-extensions] _t1rMKHV81Bsp9aU1A_+GASNETT_NEVER_INLINE(/*fnname*/,/*declarator*/)+_t2z0dVmWCWoS2H2Ro_ ^ conftest.cpp:6:69: error: empty macro arguments are a C99 feature [-Werror,-Wc99-extensions] _t1rMKHV81Bsp9aU1A_+GASNETT_NEVER_INLINE(/*fnname*/,/*declarator*/)+_t2z0dVmWCWoS2H2Ro_ ^ 2 errors generated.
Again,
-std=c++11
seems to resolve this. -
reporter The good news is that excluding the two items (easily resolved using
-std=c++11
if attempting pedantic with Xcode), the only pedantic warnings (promoted to errors) seen are the ones in issue 490 (for which we have pull request 382 in testing right now) -
reporter - changed status to open
As hoped,
-std=c++11
gives a clean-pendantic
build on macOS.
So, I am proposing to apply the following change to thegitlab-ci.yml
after issue 490 has been resolved (to avoid the appearance of regression ondevelop
):commit 2e6e93457b0eb83c56bf1e04a08ea95a02a60a64 Author: Paul H. Hargrove <PHHargrove@lbl.gov> Date: Tue Sep 21 17:55:58 2021 -0700 Expand -pedantic coverage to include library builds diff --git a/gitlab-ci.yml b/gitlab-ci.yml index 8ba755f..261b91a 100644 --- a/gitlab-ci.yml +++ b/gitlab-ci.yml @@ -534,7 +534,7 @@ dirac-clang_wall: - export CC=clang CXX=clang++ - export CI_RUN_TESTS=0 - export CI_NO_TESTS="${CI_NO_TESTS:+$CI_NO_TESTS,}nodiscard,issue" - - export CI_EXTRAFLAGS="$CI_EXTRAFLAGS -pedantic -Wall -DUPCXX_USE_NODISCARD=0" + - export CXXFLAGS="-pedantic -Wall -DUPCXX_USE_NODISCARD=0" # Compile-only tester with extended compiler checks, # but a reduced set of tests (since many are not -Wall-clean). @@ -545,7 +545,7 @@ dirac-gcc_wall: - export CC=gcc CXX=g++ - export CI_RUN_TESTS=0 - export CI_NO_TESTS="${CI_NO_TESTS:+$CI_NO_TESTS,}nodiscard,issue" - - export CI_EXTRAFLAGS="$CI_EXTRAFLAGS -pedantic -Wall" + - export CXXFLAGS="-pedantic -Wall" # Compile-only tester with LTO and pedantic warnings enabled # NOTE: only SMP because amudp and ammpi libs lead to harmless ODR warnings @@ -592,6 +592,9 @@ macos_current-gcc: # Compile-only tester with extended compiler checks, # but a reduced set of tests (since many are not -Wall-clean). # Note: `-DUPCXX_USE_NODISCARD=0` prevents complaints that `[[nodiscard]]` requires C++17. +# Note: `-std=c++11` prevents complaints about `long long` (in udp-conduit) and +# empty macro arguments (in a probe in gasnet_macros.sh), both due to the +# default C++98 in effect when those are compiled. macos_current-xcode_wall: extends: [ .generic, .new_xcode, .macos_current ] variables: @@ -599,7 +602,7 @@ macos_current-xcode_wall: before_script: - export CI_RUN_TESTS=0 - export CI_NO_TESTS="${CI_NO_TESTS:+$CI_NO_TESTS,}nodiscard,issue" - - export CI_EXTRAFLAGS="$CI_EXTRAFLAGS -pedantic -Wall -DUPCXX_USE_NODISCARD=0" + - export CXXFLAGS="-std=c++11 -pedantic -Wall -DUPCXX_USE_NODISCARD=0" ################################################################################ ##
-
reporter The changes above have been committed, but they fail to add
-Werror
to the library compile. So, these three jobs may generate new warnings, but not the desired failure. This issue remains open pending additional work to address that. -
- changed milestone to 2022.3.0 release
Mass roll-over of open issues to next release milestone
-
- changed component to CI and Testing scripts
-
reporter - changed status to resolved
- Log in to comment
I am looking specifically at configuring with
CXXFLAGS='-Wall -Werror -pedantic'
for g++ andCXXFLAGS='-Wall -Werror -pedantic -DUPCXX_USE_NODISCARD=0'
for clang++.The first thing I hit was a complaint building GASNet's udp-conduit:
This was only seen on macOS, which is not part of the current scope (
dirac-{gcc,clang}_wall
are Linux), and probably easily resolved w/-std=c++11
. ```