meson: Streamline silencing of warnings in bindgen generated code

Everyone was doing roughly the same.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34969>
This commit is contained in:
LingMan 2025-05-14 11:21:53 +02:00 committed by Marge Bot
parent 040ef8f5c9
commit 3fbee8bae6
6 changed files with 17 additions and 36 deletions

View file

@ -796,6 +796,17 @@ if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv')
'If your distribution does not ship a recent enough version, ' +
'you can install the latest version for your user with `cargo install bindgen-cli`.')
endif
bindgen_output_args = [
# can't do anything about it anyway
'--raw-line', '#![allow(clippy::all)]',
'--raw-line', '#![allow(improper_ctypes)]',
# Some bindgen versions assume `unsafe_op_in_unsafe_fn`
'--raw-line', '#![allow(unused_unsafe)]',
'--raw-line', '#![allow(non_camel_case_types)]',
'--raw-line', '#![allow(non_snake_case)]',
'--raw-line', '#![allow(non_upper_case_globals)]',
]
endif
if get_option('precomp-compiler') != 'system'

View file

@ -36,9 +36,7 @@ _compiler_binding_types = [
]
_compiler_bindgen_args = [
'--raw-line', '#![allow(non_camel_case_types)]',
'--raw-line', '#![allow(non_snake_case)]',
'--raw-line', '#![allow(non_upper_case_globals)]',
bindgen_output_args,
'--allowlist-var', 'NIR_.*',
'--allowlist-var', 'nir_.*_infos',
'--allowlist-var', 'rust_.*',

View file

@ -101,6 +101,7 @@ if with_tools.contains('etnaviv')
output : 'isa_bindings.rs',
include_directories : [inc_src],
args : [
bindgen_output_args,
'--disable-header-comment',
'--ignore-functions',
'--allowlist-type', 'etna_asm_result',
@ -116,10 +117,6 @@ if with_tools.contains('etnaviv')
isa_bindings_rs,
gnu_symbol_visibility : 'hidden',
rust_abi : 'rust',
rust_args: [
'-Anon_camel_case_types',
'-Anon_snake_case',
],
)
dep_indexmap = dependency('indexmap',

View file

@ -88,18 +88,8 @@ if with_platform_x11
]
endif
rusticl_gen_args = [
# can't do anything about it anyway
'-Aclippy::all',
'-Aimproper_ctypes',
# Some bindgen versions assume `unsafe_op_in_unsafe_fn`
'-Aunused_unsafe',
'-Anon_camel_case_types',
'-Anon_snake_case',
'-Anon_upper_case_globals',
]
rusticl_bindgen_args = [
bindgen_output_args,
'--no-convert-floats',
'--default-enum-style', 'rust',
'--with-derive-partialeq',
@ -175,9 +165,6 @@ rusticl_opencl_gen = static_library(
rusticl_opencl_bindings_rs,
gnu_symbol_visibility : 'hidden',
rust_abi : 'rust',
rust_args : [
rusticl_gen_args,
],
)
rusticl_llvm_bindings_rs = rust.bindgen(
@ -193,6 +180,7 @@ rusticl_llvm_bindings_rs = rust.bindgen(
dep_llvmspirvlib,
],
args : [
bindgen_output_args,
# we want to limit what to generate bindings for
'--generate', 'constructors,functions,types',
# and all types will be opaque
@ -210,9 +198,6 @@ rusticl_llvm_gen = static_library(
rusticl_llvm_bindings_rs,
gnu_symbol_visibility : 'hidden',
rust_abi : 'rust',
rust_args : [
rusticl_gen_args,
],
)
rusticl_libc_bindings_rs = rust.bindgen(
@ -372,9 +357,6 @@ libmesa_rust_gen = static_library(
idep_mesaclc,
],
rust_abi : 'rust',
rust_args : [
rusticl_gen_args,
],
)
libc_rust_gen = static_library(
@ -382,9 +364,6 @@ libc_rust_gen = static_library(
rusticl_libc_bindings_rs,
gnu_symbol_visibility : 'hidden',
rust_abi : 'rust',
rust_args : [
rusticl_gen_args,
],
)
libmesa_rust_util = static_library(

View file

@ -78,10 +78,8 @@ _nak_bindings_rs = rust.bindgen(
pre_args,
],
args : [
bindgen_output_args,
compiler_rs_bindgen_blocklist,
'--raw-line', '#![allow(non_camel_case_types)]',
'--raw-line', '#![allow(non_snake_case)]',
'--raw-line', '#![allow(non_upper_case_globals)]',
'--raw-line', 'use compiler::bindings::*;',
'--allowlist-type', 'drm.*',
'--allowlist-type', 'nak_.*',

View file

@ -59,9 +59,7 @@ _nil_bindings_rs = rust.bindgen(
],
include_directories : [inc_include, inc_src, include_directories('.')],
args: [
'--raw-line', '#![allow(non_camel_case_types)]',
'--raw-line', '#![allow(non_snake_case)]',
'--raw-line', '#![allow(non_upper_case_globals)]',
bindgen_output_args,
'--allowlist-function', 'util_format_description',
'--allowlist-function', 'util_format_get_blocksize',
'--allowlist-function', 'util_format_is_compressed',