Skip to content

Commit 614f533

Browse files
committed
rust: helpers: avoid -Wmissing-prototypes in W=1 builds
`W=1` cannot be enabled in the CI with `WERROR`, given unrelated warnings, sadly. Link: https://lore.kernel.org/lkml/[email protected]/ Reported-by: kernel test robot <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 929b4fd commit 614f533

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

rust/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3-
obj-$(CONFIG_RUST) += core.o compiler_builtins.o helpers.o
3+
obj-$(CONFIG_RUST) += core.o compiler_builtins.o
44
always-$(CONFIG_RUST) += exports_core_generated.h
55

6+
# Missing prototypes are expected in the helpers since these are exported
7+
# for Rust only, thus there is no header nor prototypes.
8+
obj-$(CONFIG_RUST) += helpers.o
9+
CFLAGS_REMOVE_helpers.o = -Wmissing-prototypes
10+
611
always-$(CONFIG_RUST) += libmacros.so
712
no-clean-files += libmacros.so
813

@@ -253,9 +258,11 @@ quiet_cmd_bindgen_helper = BINDGEN $@
253258
--use-core --with-derive-default --ctypes-prefix c_types \
254259
--no-debug '.*' \
255260
--size_t-is-usize -o $@ -- $(bindgen_c_flags_final) \
256-
-I$(objtree)/rust/ -DMODULE; \
261+
-I$(objtree)/rust/ -DMODULE $(bindgen_target_cflags); \
257262
sed -Ei 's/pub fn rust_helper_([a-zA-Z0-9_]*)/\#[link_name="rust_helper_\1"]\n pub fn \1/g' $@
258263

264+
# See `CFLAGS_REMOVE_helpers.o` above.
265+
$(objtree)/rust/bindings_helpers_generated.rs: private bindgen_target_cflags = -Wno-missing-prototypes
259266
$(objtree)/rust/bindings_helpers_generated.rs: $(srctree)/rust/helpers.c FORCE
260267
$(call if_changed_dep,bindgen_helper)
261268

0 commit comments

Comments
 (0)