|
42 | 42 | persist-credentials: false |
43 | 43 | - name: Install pcre2grep |
44 | 44 | run: sudo apt-get update && sudo apt-get install -y --no-install-recommends pcre2-utils |
45 | | - # Check for trailing whitespace |
46 | | - - name: Trailing whitespace |
47 | | - run: find simde/ \( -name '*.c' -o -name '*.h' \) -exec grep -nP '\s+$' {} + && exit 1 || exit 0 |
48 | | - # We use spaces, not tabs. I don't want to start a holy war here; |
49 | | - # I don't actually have a strong preference between the two, but I |
50 | | - # do have a strong preference for consistency, so don't @ me. |
51 | | - - name: Tabs |
52 | | - run: find simde/ \( -name '*.c' -o -name '*.h' \) -exec grep -nP '\t' {} + && exit 1 || exit 0 |
53 | | - # s/8/16/ will result in this if the input is x86. |
54 | | - - name: Bad substitutions |
55 | | - run: git grep -i 'x''1''6''6' && exit 1 || exit 0 |
56 | | - - name: Incorrect assertions in test/ |
57 | | - run: grep -PR '(?<=[^a-zA-Z0-9_])simde_assert_u?int(8|16|32|64)(?>[^a-zA-Z0-9_])' test/ && exit 1 || exit 0 |
58 | | - # Check to make sure no source files have the executable bit set |
59 | | - - name: Executable sources |
60 | | - run: find \( -name '*.c' -o -name '*.h' \) -executable | grep -q '.' && exit 1 || exit 0 |
61 | | - # Make sure neon.h includes all the NEON headers. |
62 | | - - name: Missing NEON includes |
63 | | - run: for f in simde/arm/neon/*.h; do grep -q "include \"neon/$(basename "$f")\"" simde/arm/neon.h || (echo "Missing $f" && exit 1); done |
64 | | - # Make sure sve.h includes all the SVE headers. |
65 | | - - name: Missing SVE includes |
66 | | - run: for f in simde/arm/sve/*.h; do grep -q "include \"sve/$(basename "$f")\"" simde/arm/sve.h || (echo "Missing $f" && exit 1); done |
67 | | - # Make sure msa.h includes all the MSA headers. |
68 | | - - name: Missing MSA includes |
69 | | - run: for f in simde/mips/msa/*.h; do grep -q "include \"msa/$(basename "$f")\"" simde/mips/msa.h || (echo "Missing $f" && exit 1); done |
70 | | - # Make sure we can find the expected header guards. It's easy to miss this when doing C&P |
71 | | - - name: Header guards |
72 | | - run: | |
73 | | - while IFS= read -r -d '' file |
74 | | - do |
75 | | - grep -q "$(echo "$file" | tr '[:lower:]' '[:upper:]' | tr '[:punct:]' '_')" "$file" || (echo "Missing or incorrect header guard in $file" && exit 1) |
76 | | - done < <(find simde/*/ -name '*.h' -print0) |
77 | | - # There should be an empty line at the end of every file |
78 | | - - name: Newline at EOF |
79 | | - run: | |
80 | | - while IFS= read -r -d '' file |
81 | | - do |
82 | | - if [ -n "$(tail -c 1 "$file")" ] |
83 | | - then echo "No newline at end of $file" && exit 1 |
84 | | - fi |
85 | | - done < <(find simde -name '*.h' -print0) |
86 | | - # Don't #ifndef ; use !defined(...) instead. ifndef leads to annoying inconsistencies |
87 | | - - name: ifndef |
88 | | - run: | |
89 | | - while IFS= read -r -d '' file |
90 | | - do |
91 | | - grep -qP '^ *# *ifndef ' "${file}" && exit 1 || exit 0 |
92 | | - done < <(find simde -name '*.h' -print0) |
93 | | - # List of headers we want Meson to install |
94 | | - - name: Meson install headers |
95 | | - run: | |
96 | | - while IFS= read -r -d '' file |
97 | | - do |
98 | | - grep -qF "$(basename "${file}" .h)" meson.build || (echo "${file} missing from top-level meson.build" && exit 1) |
99 | | - done < <(find simde -name '*.h' -print0) |
100 | | - # Make sure we don't accidentally use `vector ...` instead of SIMDE_POWER_ALTIVEC_VECTOR(...) |
101 | | - - name: AltiVec raw vector keyword |
102 | | - run: find simde/ \( -name '*.c' -o -name '*.h' \) -exec grep -nP 'vector( +)((bool|signed|unsigned) +)?(double|float|long long|long|int|short|char)' {} + && exit 1 || exit 0 |
103 | | - # Check indentation of preprocessor directives. |
104 | | - - name: Preprocessor directive indentation |
105 | | - run: find simde/*/ -name 'avx*.h' -exec pcre2grep -M '{\n#' {} + && exit 1 || exit 0 |
106 | | - - name: Stray `&& 0` |
107 | | - run: git grep ' && 0' simde/ test/ && exit 1 || exit 0 |
| 45 | + - name: Check formatting |
| 46 | + run: .github/workflows/formatting.bash |
108 | 47 |
|
109 | 48 | x86: |
110 | 49 | runs-on: ubuntu-24.04 |
|
0 commit comments