Skip to content

Commit

Permalink
ci: check public headers conform to c++ ISO standards
Browse files Browse the repository at this point in the history
  • Loading branch information
64 committed Nov 3, 2024
1 parent eb70663 commit 3c2b3f1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Build mlibc
run: 'xbstrap install ${{matrix.builds}}'
working-directory: build/
- name: Check public headers conform to C89/C99/C11
- name: Check public headers conform to ISO standards with pedantic warnings
if: ${{matrix.builds == 'mlibc-headers-only'}}
working-directory: build/
run: |
Expand All @@ -64,12 +64,18 @@ jobs:
;;
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 -Werror -Wpedantic -Wsystem-headers"
GCC_ARGS="-S /dev/null -o /dev/null -I packages/${{matrix.builds}}/usr/include -I packages/linux-headers/usr/include -nostdlib -Werror -Wpedantic -Wsystem-headers"
GCC_C_ARGS="$GCC_ARCH-linux-mlibc-gcc -x c $GCC_ARGS"
GCC_CXX_ARGS="$GCC_ARCH-linux-mlibc-g++ -x c++ $GCC_ARGS"
# 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
printf -- '-include\0%s\0' $ALL_HDRS | sed 's/complex.h/stdio.h/' | xargs -0 $GCC_C_ARGS -std=c89 -Wno-long-long
printf -- '-include\0%s\0' $ALL_HDRS | xargs -0 $GCC_C_ARGS -std=c99
printf -- '-include\0%s\0' $ALL_HDRS | xargs -0 $GCC_C_ARGS -std=c11
printf -- '-include\0%s\0' $ALL_HDRS | xargs -0 $GCC_CXX_ARGS -std=c++98
printf -- '-include\0%s\0' $ALL_HDRS | xargs -0 $GCC_CXX_ARGS -std=c++11
printf -- '-include\0%s\0' $ALL_HDRS | xargs -0 $GCC_CXX_ARGS -std=c++14
printf -- '-include\0%s\0' $ALL_HDRS | xargs -0 $GCC_CXX_ARGS -std=c++17
- name: Test mlibc
run: 'meson test -v -C pkg-builds/${{matrix.builds}}'
working-directory: build/
Expand Down

0 comments on commit 3c2b3f1

Please sign in to comment.