Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: rust_is_available: remove warning for `bindgen` < 0.69.5 && libclang >= 19.1

It is not possible anymore to fall into the issue that this warning was
alerting about given the `bindgen` version bump.

Thus simplify by removing the machinery behind it, including tests.

Reviewed-by: Tamir Duberstein <tamird@kernel.org>
Link: https://patch.msgid.link/20260405235309.418950-20-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+1 -51
-15
scripts/rust_is_available.sh
··· 214 214 exit 1 215 215 fi 216 216 217 - if [ "$bindgen_libclang_cversion" -ge 1900100 ] && 218 - [ "$rust_bindings_generator_cversion" -lt 6905 ]; then 219 - # Distributions may have patched the issue (e.g. Debian did). 220 - if ! "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_libclang_concat.h | grep -q foofoo; then 221 - echo >&2 "***" 222 - echo >&2 "*** Rust bindings generator '$BINDGEN' < 0.69.5 together with libclang >= 19.1" 223 - echo >&2 "*** may not work due to a bug (https://github.com/rust-lang/rust-bindgen/pull/2824)," 224 - echo >&2 "*** unless patched (like Debian's)." 225 - echo >&2 "*** Your bindgen version: $rust_bindings_generator_version" 226 - echo >&2 "*** Your libclang version: $bindgen_libclang_version" 227 - echo >&2 "***" 228 - warning=1 229 - fi 230 - fi 231 - 232 217 # If the C compiler is Clang, then we can also check whether its version 233 218 # matches the `libclang` version used by the Rust bindings generator. 234 219 #
-3
scripts/rust_is_available_bindgen_libclang_concat.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #define F(x) int x##x 3 - F(foo);
+1 -33
scripts/rust_is_available_test.py
··· 54 54 """) 55 55 56 56 @classmethod 57 - def generate_bindgen(cls, version_stdout, libclang_stderr, libclang_concat_patched=False): 57 + def generate_bindgen(cls, version_stdout, libclang_stderr): 58 58 if libclang_stderr is None: 59 59 libclang_case = f"raise SystemExit({cls.bindgen_default_bindgen_libclang_failure_exit_code})" 60 60 else: 61 61 libclang_case = f"print({repr(libclang_stderr)}, file=sys.stderr)" 62 62 63 - if libclang_concat_patched: 64 - libclang_concat_case = "print('pub static mut foofoo: ::std::os::raw::c_int;')" 65 - else: 66 - libclang_concat_case = "pass" 67 - 68 63 return cls.generate_executable(f"""#!/usr/bin/env python3 69 64 import sys 70 65 if "rust_is_available_bindgen_libclang.h" in " ".join(sys.argv): 71 66 {libclang_case} 72 - elif "rust_is_available_bindgen_libclang_concat.h" in " ".join(sys.argv): 73 - {libclang_concat_case} 74 67 else: 75 68 print({repr(version_stdout)}) 76 69 """) ··· 247 254 bindgen = self.generate_bindgen_libclang("scripts/rust_is_available_bindgen_libclang.h:2:9: warning: clang version 10.0.0 [-W#pragma-messages], err: false") 248 255 result = self.run_script(self.Expected.FAILURE, { "BINDGEN": bindgen }) 249 256 self.assertIn(f"libclang (used by the Rust bindings generator '{bindgen}') is too old.", result.stderr) 250 - 251 - def test_bindgen_bad_libclang_concat(self): 252 - for (bindgen_version, libclang_version, expected_not_patched) in ( 253 - ("0.69.4", "18.0.0", self.Expected.SUCCESS), 254 - ("0.69.4", "19.1.0", self.Expected.SUCCESS_WITH_WARNINGS), 255 - ("0.69.4", "19.2.0", self.Expected.SUCCESS_WITH_WARNINGS), 256 - 257 - ("0.69.5", "18.0.0", self.Expected.SUCCESS), 258 - ("0.69.5", "19.1.0", self.Expected.SUCCESS), 259 - ("0.69.5", "19.2.0", self.Expected.SUCCESS), 260 - 261 - ("0.70.0", "18.0.0", self.Expected.SUCCESS), 262 - ("0.70.0", "19.1.0", self.Expected.SUCCESS), 263 - ("0.70.0", "19.2.0", self.Expected.SUCCESS), 264 - ): 265 - with self.subTest(bindgen_version=bindgen_version, libclang_version=libclang_version): 266 - cc = self.generate_clang(f"clang version {libclang_version}") 267 - libclang_stderr = f"scripts/rust_is_available_bindgen_libclang.h:2:9: warning: clang version {libclang_version} [-W#pragma-messages], err: false" 268 - bindgen = self.generate_bindgen(f"bindgen {bindgen_version}", libclang_stderr) 269 - result = self.run_script(expected_not_patched, { "BINDGEN": bindgen, "CC": cc }) 270 - if expected_not_patched == self.Expected.SUCCESS_WITH_WARNINGS: 271 - self.assertIn(f"Rust bindings generator '{bindgen}' < 0.69.5 together with libclang >= 19.1", result.stderr) 272 - 273 - bindgen = self.generate_bindgen(f"bindgen {bindgen_version}", libclang_stderr, libclang_concat_patched=True) 274 - result = self.run_script(self.Expected.SUCCESS, { "BINDGEN": bindgen, "CC": cc }) 275 257 276 258 def test_clang_matches_bindgen_libclang_different_bindgen(self): 277 259 bindgen = self.generate_bindgen_libclang("scripts/rust_is_available_bindgen_libclang.h:2:9: warning: clang version 999.0.0 [-W#pragma-messages], err: false")