Skip to content
Permalink
Browse files
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/202201310402.vCWP8CUS-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
ojeda committed Feb 6, 2022
1 parent 929b4fd commit 614f533db2f380569e01a27b5064527a2f95728e
Showing 1 changed file with 9 additions and 2 deletions.
@@ -1,8 +1,13 @@
# SPDX-License-Identifier: GPL-2.0

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

# Missing prototypes are expected in the helpers since these are exported
# for Rust only, thus there is no header nor prototypes.
obj-$(CONFIG_RUST) += helpers.o
CFLAGS_REMOVE_helpers.o = -Wmissing-prototypes

always-$(CONFIG_RUST) += libmacros.so
no-clean-files += libmacros.so

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

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

0 comments on commit 614f533

Please sign in to comment.