It should generally be possible to build OVS with mostly c99 standard
and without GNU extensions.

It's not a pure c99 build, because some non-standard features from
POSIX variants are always enabled if available via
AC_USE_SYSTEM_EXTENSIONS.  Without them we'll not have some essentials
like RW locks, for example.

'-std=c99' doesn't disable all the GNU extensions, only some of them.
It's technically possible to use '-fgnuc-version=0' with clang to
fully disable all the extensions, but it is causing build assertions
with the version of clang provided in Ubuntu 20.04 in GHA (some
issue with packed structures not being correctly packed).  We may
use this option in the future after the base image upgrade.

Signed-off-by: Ilya Maximets <[email protected]>
---
 .ci/linux-build.sh                   | 4 ++++
 .github/workflows/build-and-test.yml | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 99850a943..8227a5748 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -82,6 +82,10 @@ if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
     install_dpdk
 fi
 
+if [ "$STD" ]; then
+    CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} -std=$STD"
+fi
+
 if [ "$CC" = "clang" ]; then
     CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} -Wno-error=unused-command-line-argument"
 elif [ "$M32" ]; then
diff --git a/.github/workflows/build-and-test.yml 
b/.github/workflows/build-and-test.yml
index 47d239f10..bc5494e86 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -85,6 +85,7 @@ jobs:
       LIBS:        ${{ matrix.libs }}
       M32:         ${{ matrix.m32 }}
       OPTS:        ${{ matrix.opts }}
+      STD:         ${{ matrix.std }}
       TESTSUITE:   ${{ matrix.testsuite }}
 
     name: linux ${{ join(matrix.*, ' ') }}
@@ -100,6 +101,11 @@ jobs:
           - compiler:     clang
             opts:         --disable-ssl
 
+          - compiler:     gcc
+            std:          c99
+          - compiler:     clang
+            std:          c99
+
           - compiler:     gcc
             testsuite:    test
           - compiler:     clang
-- 
2.40.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to