From dd76a35f11a6c0d08e9c3721fde346cc27192451 Mon Sep 17 00:00:00 2001 From: Matt Staveley-Taylor Date: Tue, 15 Oct 2024 02:14:41 +0200 Subject: [PATCH] ci: check public headers compile with c89 pedantic errors --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2aed69db9..040c098fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,22 @@ jobs: - name: Build mlibc run: 'xbstrap install ${{matrix.builds}}' working-directory: build/ + - name: Check public headers conform to C89/C99/C11 + if: ${{matrix.builds == 'mlibc-headers-only'}} + working-directory: build/ + run: | + GCC_ARCH="${{matrix.arch}}" + case "$GCC_ARCH" in + "x86") + GCC_ARCH="i686" + ;; + esac + ALL_HDRS="packages/${{matrix.builds}}/usr/include/**.h" + GCC_ARGS="$GCC_ARCH-linux-mlibc-gcc -x c -S /dev/null -o /dev/null -I packages/${{matrix.builds}}/usr/include -I packages/linux-headers/usr/include -nostdlib" + # For C89, exclude complex.h, and -Wlong-long + printf -- '-include\0%s\0' $ALL_HDRS | sed 's/complex.h/stdio.h/' | xargs -0 $GCC_ARGS -std=c89 -Wno-long-long + printf -- '-include\0%s\0' $ALL_HDRS | xargs -0 $GCC_ARGS -std=c99 + printf -- '-include\0%s\0' $ALL_HDRS | xargs -0 $GCC_ARGS -std=c11 - name: Test mlibc run: 'meson test -v -C pkg-builds/${{matrix.builds}}' working-directory: build/