Explorar el Código

CI: add -Werror to "GCC C/C++ Standards Check" (#1804)

Present version of the configure.in file is old and issues compiler
warnings, thus errors out. The -Werror flag must thus be given
to 'make'.

The compiler flag -fPIC is needed for -Werror to work.
nilason hace 3 años
padre
commit
6a34ab17a1
Se han modificado 2 ficheros con 12 adiciones y 4 borrados
  1. 9 1
      .github/workflows/build_ubuntu-20.04.sh
  2. 3 3
      .github/workflows/gcc.yml

+ 9 - 1
.github/workflows/build_ubuntu-20.04.sh

@@ -16,6 +16,14 @@ if [ -z "$1" ]; then
     exit 1
 fi
 
+# Adding -Werror to make's CFLAGS is a workaround for configuring with
+# an old version of configure, which issues compiler warnings and
+# errors out. This may be removed with upgraded configure.in file.
+makecmd="make"
+if [[ "$#" -eq 2 ]]; then
+    makecmd="make CFLAGS='$CFLAGS $2' CXXFLAGS='$CXXFLAGS $2'"
+fi
+
 # non-existent variables as an errors
 set -u
 
@@ -42,5 +50,5 @@ export INSTALL_PREFIX=$1
     --with-fftw \
     --with-netcdf
 
-make
+eval $makecmd
 make install

+ 3 - 3
.github/workflows/gcc.yml

@@ -42,7 +42,7 @@ jobs:
       - name: Build
         env:
           # TODO: -pedantic-errors here won't go through ./configure (with GNU C)
-          CFLAGS: "-std=${{ matrix.c }}"
+          CFLAGS: "-std=${{ matrix.c }} -fPIC"
           # TODO: -pedantic-errors here won't compile
-          CXXFLAGS: "-std=${{ matrix.cpp }}"
-        run: .github/workflows/build_ubuntu-20.04.sh $HOME/install
+          CXXFLAGS: "-std=${{ matrix.cpp }} -fPIC"
+        run: .github/workflows/build_ubuntu-20.04.sh $HOME/install -Werror