Skip to content

Commit 60f0f3c

Browse files
committed
rust: helpers: avoid -Wmissing-declarations in W=1 builds
Similar to commit 614f533 ("rust: helpers: avoid `-Wmissing-prototypes` in `W=1` builds"), though this one only applies to GCC. Link: https://lore.kernel.org/lkml/[email protected]/ Reported-by: kernel test robot <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent d66bb6b commit 60f0f3c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

rust/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ always-$(CONFIG_RUST) += exports_core_generated.h
66
# Missing prototypes are expected in the helpers since these are exported
77
# for Rust only, thus there is no header nor prototypes.
88
obj-$(CONFIG_RUST) += helpers.o
9-
CFLAGS_REMOVE_helpers.o = -Wmissing-prototypes
9+
CFLAGS_REMOVE_helpers.o = -Wmissing-prototypes -Wmissing-declarations
1010

1111
always-$(CONFIG_RUST) += libmacros.so
1212
no-clean-files += libmacros.so
@@ -269,11 +269,14 @@ $(objtree)/rust/bindings_generated.rs: $(srctree)/rust/kernel/bindings_helper.h
269269
$(srctree)/rust/bindgen_parameters FORCE
270270
$(call if_changed_dep,bindgen)
271271

272-
# See `CFLAGS_REMOVE_helpers.o` above for `-Wno-missing-prototypes`.
272+
# See `CFLAGS_REMOVE_helpers.o` above. In addition, Clang on C does not warn
273+
# with `-Wmissing-declarations` (unlike GCC), so it is not strictly needed here
274+
# given it is `libclang`; but for consistency, future Clang changes and/or
275+
# a potential future GCC backend for `bindgen`, we disable it too.
273276
$(objtree)/rust/bindings_helpers_generated.rs: private bindgen_target_flags = \
274277
--blacklist-type '.*' --whitelist-var '' --whitelist-function 'rust_helper_.*'
275278
$(objtree)/rust/bindings_helpers_generated.rs: private bindgen_target_cflags = \
276-
-I$(objtree)/rust/ -Wno-missing-prototypes
279+
-I$(objtree)/rust/ -Wno-missing-prototypes -Wno-missing-declarations
277280
$(objtree)/rust/bindings_helpers_generated.rs: private bindgen_target_extra = ; \
278281
sed -Ei 's/pub fn rust_helper_([a-zA-Z0-9_]*)/#[link_name="rust_helper_\1"]\n pub fn \1/g' $@
279282
$(objtree)/rust/bindings_helpers_generated.rs: $(srctree)/rust/helpers.c FORCE

0 commit comments

Comments
 (0)