rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: fix bindgen arguments
@ 2023-03-29 23:39 technoboy85
  2023-04-06 23:15 ` Miguel Ojeda
  0 siblings, 1 reply; 2+ messages in thread
From: technoboy85 @ 2023-03-29 23:39 UTC (permalink / raw)
  To: rust-for-linux
  Cc: linux-kernel, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
	Matteo Croce

From: Matteo Croce <teknoraver@meta.com>

bindgen renamed some arguments to be more inclusive.
Detect if bindgen uses the new syntax and use it,
otherwise fallback to the previous one.

Signed-off-by: Matteo Croce <teknoraver@meta.com>
---
 rust/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/rust/Makefile b/rust/Makefile
index ff70c4c916f8..3a4971d84b63 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -68,6 +68,11 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
 		--crate-name $(subst rustdoc-,,$@) \
 		@$(objtree)/include/generated/rustc_cfg $<
 
+bindgen-list = $(shell if $(BINDGEN) --help |grep -q -- --allowlist;			\
+	then echo "--blocklist-type '.*' --allowlist-var '' --allowlist-function";	\
+	else echo "--blacklist-type '.*' --whitelist-var '' --whitelist-function";	\
+	fi)
+
 # The `html_logo_url` and `html_favicon_url` forms of the `doc` attribute
 # can be used to specify a custom logo. However:
 #   - The given value is used as-is, thus it cannot be relative or a local file
@@ -300,8 +305,7 @@ $(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
 # given it is `libclang`; but for consistency, future Clang changes and/or
 # a potential future GCC backend for `bindgen`, we disable it too.
 $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_flags = \
-    --blacklist-type '.*' --whitelist-var '' \
-    --whitelist-function 'rust_helper_.*'
+    $(bindgen-list) 'rust_helper_.*'
 $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_cflags = \
     -I$(objtree)/$(obj) -Wno-missing-prototypes -Wno-missing-declarations
 $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; \
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rust: fix bindgen arguments
  2023-03-29 23:39 [PATCH] rust: fix bindgen arguments technoboy85
@ 2023-04-06 23:15 ` Miguel Ojeda
  0 siblings, 0 replies; 2+ messages in thread
From: Miguel Ojeda @ 2023-04-06 23:15 UTC (permalink / raw)
  To: technoboy85
  Cc: rust-for-linux, linux-kernel, Miguel Ojeda, Alex Gaynor,
	Wedson Almeida Filho, Matteo Croce

Hi Matteo,

On Thu, Mar 30, 2023 at 1:39 AM <technoboy85@gmail.com> wrote:
>
> bindgen renamed some arguments to be more inclusive.
> Detect if bindgen uses the new syntax and use it,
> otherwise fallback to the previous one.

We will be updating to a new `bindgen` version soon-ish, at which time
I will perform the change from one to the other directly, instead of
having to handle both cases.

But thanks for this patch!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-06 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-29 23:39 [PATCH] rust: fix bindgen arguments technoboy85
2023-04-06 23:15 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).