From 41526f68f3482f2b3a7aa581288bc86e9c6dcb43 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 30 Jun 2022 15:38:18 -0700 Subject: Adds a -Werror debug Autotools test and updates build modes (#1833) * Adds a -Werror debug Autotools test and updates build modes * Un-excludes the workflow files * Strip out -Werror from CFLAGS when running configure tests This causes spurious test failures when the configuration test programs raise warnings. --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++-- .github/workflows/pr-check.yml | 29 +++++++++++++++++++++++++++-- configure.ac | 10 ++++++++++ 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c99aba9..6fe8f0c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: strategy: # fail-fast: false matrix: - name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC", "Ubuntu Debug Autotools GCC", "Windows TS MSVC", "Ubuntu TS GCC", "TS Debug GCC", "macOS TS Clang", "TS Autotools GCC"] + name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC", "Ubuntu Debug Autotools GCC", "-Werror Ubuntu Debug Autotools GCC", "Windows TS MSVC", "Ubuntu TS GCC", "TS Debug GCC", "macOS TS Clang", "TS Autotools GCC"] include: - name: "Windows Latest MSVC" artifact: "Windows-MSVC.tar.xz" @@ -35,6 +35,7 @@ jobs: hl: ON parallel: OFF generator: "-G \"Visual Studio 17 2022\" -A x64" + flags: "" - name: "Ubuntu Latest GCC" artifact: "Linux.tar.xz" os: ubuntu-latest @@ -47,6 +48,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" + flags: "" - name: "macOS Latest Clang" artifact: "macOS.tar.xz" os: macos-latest @@ -59,6 +61,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/clang.cmake" generator: "-G Ninja" + flags: "" - name: "Ubuntu Debug GCC" artifact: "LinuxDBG.tar.xz" os: ubuntu-latest @@ -71,6 +74,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" + flags: "" - name: "Ubuntu Autotools GCC" artifact: "LinuxA.tar.xz" os: ubuntu-latest @@ -83,6 +87,7 @@ jobs: parallel: disable toolchain: "" generator: "autogen" + flags: "" - name: "Ubuntu Debug Autotools GCC" artifact: "LinuxA.tar.xz" os: ubuntu-latest @@ -95,6 +100,21 @@ jobs: parallel: disable toolchain: "" generator: "autogen" + flags: "" + # Build that ensures no new warnings sneak into the library. + - name: "-Werror Ubuntu Debug Autotools GCC" + artifact: "LinuxA.tar.xz" + os: ubuntu-latest + build_type: "debug" + cpp: disable + fortran: disable + java: disable + ts: disable + hl: enable + parallel: disable + toolchain: "" + generator: "autogen" + flags: "CFLAGS=-Werror" # Threadsafe runs - name: "Windows TS MSVC" artifact: "Windows-MSVCTS.tar.xz" @@ -108,6 +128,7 @@ jobs: hl: OFF parallel: OFF generator: "-G \"Visual Studio 16 2019\" -A x64" + flags: "" - name: "Ubuntu TS GCC" artifact: "LinuxTS.tar.xz" os: ubuntu-latest @@ -120,6 +141,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" + flags: "" - name: "macOS TS Clang" artifact: "macOSTS.tar.xz" os: macos-latest @@ -132,6 +154,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/clang.cmake" generator: "-G Ninja" + flags: "" - name: "TS Debug GCC" artifact: "LinuxTSDBG.tar.xz" os: ubuntu-latest @@ -144,6 +167,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" + flags: "" - name: "TS Autotools GCC" artifact: "LinuxATS.tar.xz" os: ubuntu-latest @@ -156,6 +180,7 @@ jobs: parallel: disable toolchain: "" generator: "autogen" + flags: "" name: ${{ matrix.name }} # The type of runner that the job will run on @@ -197,7 +222,7 @@ jobs: sh ./autogen.sh mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" - $GITHUB_WORKSPACE/configure --enable-build-mode=${{ matrix.build_type }} --enable-shared --${{ matrix.ts }}-threadsafe --${{ matrix.hl }}-hl --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java + ${{ matrix.flags }} $GITHUB_WORKSPACE/configure --enable-build-mode=${{ matrix.build_type }} --enable-shared --${{ matrix.ts }}-threadsafe --${{ matrix.hl }}-hl --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java shell: bash env: CC: gcc-11 diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index eab08cd..6b409f9 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -20,7 +20,7 @@ jobs: strategy: # fail-fast: false matrix: - name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC", "Ubuntu Debug Autotools GCC", "Windows TS MSVC", "Ubuntu TS GCC", "TS Debug GCC", "macOS TS Clang", "TS Autotools GCC"] + name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "Ubuntu Debug GCC", "macOS Latest Clang", "Ubuntu Autotools GCC", "Ubuntu Debug Autotools GCC", "-Werror Ubuntu Debug Autotools GCC", "Windows TS MSVC", "Ubuntu TS GCC", "TS Debug GCC", "macOS TS Clang", "TS Autotools GCC"] include: - name: "Windows Latest MSVC" artifact: "Windows-MSVC.tar.xz" @@ -34,6 +34,7 @@ jobs: hl: ON parallel: OFF generator: "-G \"Visual Studio 17 2022\" -A x64" + flags: "" - name: "Ubuntu Latest GCC" artifact: "Linux.tar.xz" os: ubuntu-latest @@ -46,6 +47,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" + flags: "" - name: "macOS Latest Clang" artifact: "macOS.tar.xz" os: macos-latest @@ -58,6 +60,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/clang.cmake" generator: "-G Ninja" + flags: "" - name: "Ubuntu Debug GCC" artifact: "LinuxDBG.tar.xz" os: ubuntu-latest @@ -70,6 +73,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" + flags: "" - name: "Ubuntu Autotools GCC" artifact: "LinuxA.tar.xz" os: ubuntu-latest @@ -82,6 +86,7 @@ jobs: parallel: disable toolchain: "" generator: "autogen" + flags: "" - name: "Ubuntu Debug Autotools GCC" artifact: "LinuxA.tar.xz" os: ubuntu-latest @@ -94,6 +99,21 @@ jobs: parallel: disable toolchain: "" generator: "autogen" + flags: "" + # Build that ensures no new warnings sneak into the library. + - name: "-Werror Ubuntu Debug Autotools GCC" + artifact: "LinuxDBG.tar.xz" + os: ubuntu-latest + build_type: "debug" + cpp: disable + fortran: disable + java: disable + ts: disable + hl: enable + parallel: disable + toolchain: "" + generator: "autogen" + flags: "CFLAGS=-Werror" # Threadsafe runs - name: "Windows TS MSVC" artifact: "Windows-MSVCTS.tar.xz" @@ -107,6 +127,7 @@ jobs: hl: OFF parallel: OFF generator: "-G \"Visual Studio 16 2019\" -A x64" + flags: "" - name: "Ubuntu TS GCC" artifact: "LinuxTS.tar.xz" os: ubuntu-latest @@ -119,6 +140,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" + flags: "" - name: "macOS TS Clang" artifact: "macOSTS.tar.xz" os: macos-latest @@ -131,6 +153,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/clang.cmake" generator: "-G Ninja" + flags: "" - name: "TS Debug GCC" artifact: "LinuxTSDBG.tar.xz" os: ubuntu-latest @@ -143,6 +166,7 @@ jobs: parallel: OFF toolchain: "config/toolchain/GCC.cmake" generator: "-G Ninja" + flags: "" - name: "TS Autotools GCC" artifact: "LinuxATS.tar.xz" os: ubuntu-latest @@ -155,6 +179,7 @@ jobs: parallel: disable toolchain: "" generator: "autogen" + flags: "" name: ${{ matrix.name }} # The type of runner that the job will run on @@ -196,7 +221,7 @@ jobs: sh ./autogen.sh mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" - $GITHUB_WORKSPACE/configure --enable-build-mode=${{ matrix.build_type }} --enable-shared --${{ matrix.ts }}-threadsafe --${{ matrix.hl }}-hl --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java + ${{ matrix.flags }} $GITHUB_WORKSPACE/configure --enable-build-mode=${{ matrix.build_type }} --enable-shared --${{ matrix.ts }}-threadsafe --${{ matrix.hl }}-hl --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java shell: bash env: CC: gcc-11 diff --git a/configure.ac b/configure.ac index fa99e5b..7c9d990 100644 --- a/configure.ac +++ b/configure.ac @@ -160,6 +160,8 @@ AM_JNIFLAGS="${AM_JNIFLAGS}" AM_JAVACFLAGS="${AM_JAVACFLAGS}" AM_JAVAFLAGS="${AM_JAVAFLAGS}" AM_LDFLAGS="${AM_LDFLAGS}" + +## Flags passed in by the user CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" FCFLAGS="${FCFLAGS}" @@ -181,6 +183,14 @@ saved_user_JAVAFLAGS="$JAVAFLAGS" saved_user_LDFLAGS="$LDFLAGS" saved_user_CPPFLAGS="$CPPFLAGS" +## Strip out -Werror from CFLAGS since that can cause checks to fail when +## compiling the test program fails due to warnings +CFLAGS="`echo $CFLAGS | sed -e 's/-Werror//g'`" +CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Werror//g'`" +FCFLAGS="`echo $FCFLAGS | sed -e 's/-Werror//g'`" +JAVACFLAGS="`echo $JAVACFLAGS | sed -e 's/-Werror//g'`" +CPPFLAGS="`echo $CPPFLAGS | sed -e 's/-Werror//g'`" + ## Support F9X variable to define Fortran compiler if FC variable is ## not used. This should be deprecated in the future. if test "x" = "x$FC"; then -- cgit v0.12