Skip to content

Commit 04b7859

Browse files
authored
Merge pull request #567 from ojeda/ci-werror
Fix remaining bindgen warnings & enable `WERROR` in the CI
2 parents 795c733 + 5d6948b commit 04b7859

16 files changed

+41
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ jobs:
313313
314314
- run: make ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_LLVM_IAS }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_SYSROOT }} -j3
315315

316+
# Make sure `CONFIG_WERROR` was enabled
317+
- run: grep -F 'CONFIG_WERROR=y' ${{ env.BUILD_DIR }}.config
318+
316319
# Run
317320
- run: ${{ env.BUILD_DIR }}usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
318321

@@ -438,6 +441,8 @@ jobs:
438441
439442
# Report
440443
- run: |
444+
cat ${{ env.BUILD_DIR }}.config
445+
441446
ls -l \
442447
${{ env.BUILD_DIR }}samples/rust/*.o \
443448
${{ env.BUILD_DIR }}samples/rust/*.ko \

.github/workflows/kernel-arm-debug.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,3 +1828,5 @@ CONFIG_RUST_OPT_LEVEL_2=y
18281828
CONFIG_RUST_BUILD_ASSERT_DENY=y
18291829
# end of Rust hacking
18301830
# end of Kernel hacking
1831+
1832+
CONFIG_WERROR=y

.github/workflows/kernel-arm-release.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,3 +1786,5 @@ CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C=y
17861786
CONFIG_RUST_BUILD_ASSERT_DENY=y
17871787
# end of Rust hacking
17881788
# end of Kernel hacking
1789+
1790+
CONFIG_WERROR=y

.github/workflows/kernel-arm64-debug-thinlto.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,3 +1477,5 @@ CONFIG_RUST_OPT_LEVEL_1=y
14771477
CONFIG_RUST_BUILD_ASSERT_DENY=y
14781478
# end of Rust hacking
14791479
# end of Kernel hacking
1480+
1481+
CONFIG_WERROR=y

.github/workflows/kernel-arm64-debug.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,3 +1472,5 @@ CONFIG_RUST_OPT_LEVEL_1=y
14721472
CONFIG_RUST_BUILD_ASSERT_DENY=y
14731473
# end of Rust hacking
14741474
# end of Kernel hacking
1475+
1476+
CONFIG_WERROR=y

.github/workflows/kernel-arm64-release-thinlto.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,3 +1394,5 @@ CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C=y
13941394
CONFIG_RUST_BUILD_ASSERT_DENY=y
13951395
# end of Rust hacking
13961396
# end of Kernel hacking
1397+
1398+
CONFIG_WERROR=y

.github/workflows/kernel-arm64-release.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,3 +1389,5 @@ CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C=y
13891389
CONFIG_RUST_BUILD_ASSERT_DENY=y
13901390
# end of Rust hacking
13911391
# end of Kernel hacking
1392+
1393+
CONFIG_WERROR=y

.github/workflows/kernel-ppc64le-debug.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,3 +1593,5 @@ CONFIG_RUST_BUILD_ASSERT_ALLOW=y
15931593
# CONFIG_RUST_BUILD_ASSERT_WARN is not set
15941594
# end of Rust hacking
15951595
# end of Kernel hacking
1596+
1597+
CONFIG_WERROR=y

.github/workflows/kernel-ppc64le-release.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,3 +1497,5 @@ CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C=y
14971497
CONFIG_RUST_BUILD_ASSERT_DENY=y
14981498
# end of Rust hacking
14991499
# end of Kernel hacking
1500+
1501+
CONFIG_WERROR=y

.github/workflows/kernel-riscv64-debug.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,3 +1321,5 @@ CONFIG_RUST_BUILD_ASSERT_ALLOW=y
13211321
# CONFIG_RUST_BUILD_ASSERT_WARN is not set
13221322
# end of Rust hacking
13231323
# end of Kernel hacking
1324+
1325+
CONFIG_WERROR=y

.github/workflows/kernel-riscv64-release.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,3 +1236,5 @@ CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C=y
12361236
CONFIG_RUST_BUILD_ASSERT_DENY=y
12371237
# end of Rust hacking
12381238
# end of Kernel hacking
1239+
1240+
CONFIG_WERROR=y

.github/workflows/kernel-x86_64-debug-thinlto.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,3 +1544,5 @@ CONFIG_RUST_BUILD_ASSERT_ALLOW=y
15441544
# CONFIG_RUST_BUILD_ASSERT_WARN is not set
15451545
# end of Rust hacking
15461546
# end of Kernel hacking
1547+
1548+
CONFIG_WERROR=y

.github/workflows/kernel-x86_64-debug.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,3 +1547,5 @@ CONFIG_RUST_BUILD_ASSERT_ALLOW=y
15471547
# CONFIG_RUST_BUILD_ASSERT_WARN is not set
15481548
# end of Rust hacking
15491549
# end of Kernel hacking
1550+
1551+
CONFIG_WERROR=y

.github/workflows/kernel-x86_64-release-thinlto.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,3 +1444,5 @@ CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C=y
14441444
CONFIG_RUST_BUILD_ASSERT_DENY=y
14451445
# end of Rust hacking
14461446
# end of Kernel hacking
1447+
1448+
CONFIG_WERROR=y

.github/workflows/kernel-x86_64-release.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,3 +1439,5 @@ CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C=y
14391439
CONFIG_RUST_BUILD_ASSERT_DENY=y
14401440
# end of Rust hacking
14411441
# end of Kernel hacking
1442+
1443+
CONFIG_WERROR=y

rust/Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,11 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
211211
-Wno-packed-not-aligned -Wno-format-truncation -Wno-format-overflow \
212212
-Wno-stringop-truncation -Wno-unused-but-set-variable \
213213
-Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized \
214-
-Werror=designated-init -Wno-zero-length-bounds -Wimplicit-fallthrough=% \
215-
--param=% --param asan-%
214+
-Werror=designated-init -Wno-zero-length-bounds \
215+
-Wno-alloc-size-larger-than --param=% --param asan-%
216+
217+
# We need to keep the quotes for this one -- it comes from a `Kconfig`
218+
bindgen_skip_c_flags += "-Wimplicit-fallthrough=%"
216219

217220
# PowerPC
218221
bindgen_skip_c_flags += -mtraceback=no -mno-pointers-to-nested-functions \
@@ -226,7 +229,9 @@ BINDGEN_TARGET_riscv := riscv64-linux-gnu
226229
BINDGEN_TARGET_x86 := x86_64-linux-gnu
227230
BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
228231

229-
bindgen_extra_c_flags = --target=$(BINDGEN_TARGET) -Wno-address-of-packed-member
232+
bindgen_extra_c_flags = --target=$(BINDGEN_TARGET) \
233+
-Wno-address-of-packed-member \
234+
-Wno-gnu-variable-sized-type-not-at-end
230235
bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags), $(c_flags)) \
231236
$(bindgen_extra_c_flags)
232237
endif

0 commit comments

Comments
 (0)