From: technoboy85@gmail.com
To: rust-for-linux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Miguel Ojeda <ojeda@kernel.org>,
Alex Gaynor <alex.gaynor@gmail.com>,
Wedson Almeida Filho <wedsonaf@gmail.com>,
Matteo Croce <teknoraver@meta.com>
Subject: [PATCH] rust: fix bindgen arguments
Date: Thu, 30 Mar 2023 01:39:21 +0200 [thread overview]
Message-ID: <20230329233921.16729-1-technoboy85@gmail.com> (raw)
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
next reply other threads:[~2023-03-29 23:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 23:39 technoboy85 [this message]
2023-04-06 23:15 ` [PATCH] rust: fix bindgen arguments Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230329233921.16729-1-technoboy85@gmail.com \
--to=technoboy85@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=teknoraver@meta.com \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).