summaryrefslogtreecommitdiff
path: root/test cases/rust/12 bindgen/src
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-09-22 13:40:35 -0700
committerDylan Baker <dylan@pnwbakers.com>2023-09-25 13:05:04 -0700
commitd5546bdceaa2f3040d16a33fcbd824ba94b8cfde (patch)
tree89578b4aaa9869e6a7b02de8955554445c175ecf /test cases/rust/12 bindgen/src
parentc1ac252f4ffecc381abe24e13584e1c48516e0eb (diff)
downloadmeson-d5546bdceaa2f3040d16a33fcbd824ba94b8cfde.tar.gz
rust: apply global, project, and environment C args to bindgen
This means that arguments set via `add_global_arguments`, `add_project_arguments` and by either the `-Dc_args` or `CFLAGS` are applied to bindgen as well. This can be important when, among other things, #defines are set via these mechanisms. Fixes: #12065
Diffstat (limited to 'test cases/rust/12 bindgen/src')
-rw-r--r--test cases/rust/12 bindgen/src/global-project.h10
-rw-r--r--test cases/rust/12 bindgen/src/global.c5
-rw-r--r--test cases/rust/12 bindgen/src/global.rs14
3 files changed, 29 insertions, 0 deletions
diff --git a/test cases/rust/12 bindgen/src/global-project.h b/test cases/rust/12 bindgen/src/global-project.h
new file mode 100644
index 000000000..6084e8ed6
--- /dev/null
+++ b/test cases/rust/12 bindgen/src/global-project.h
@@ -0,0 +1,10 @@
+#ifndef GLOBAL_ARG
+char * success(void);
+#endif
+#ifndef PROJECT_ARG
+char * success(void);
+#endif
+#ifndef CMD_ARG
+char * success(void);
+#endif
+int success(void);
diff --git a/test cases/rust/12 bindgen/src/global.c b/test cases/rust/12 bindgen/src/global.c
new file mode 100644
index 000000000..10f6676f7
--- /dev/null
+++ b/test cases/rust/12 bindgen/src/global.c
@@ -0,0 +1,5 @@
+#include "src/global-project.h"
+
+int success(void) {
+ return 0;
+}
diff --git a/test cases/rust/12 bindgen/src/global.rs b/test cases/rust/12 bindgen/src/global.rs
new file mode 100644
index 000000000..4b70b1ecc
--- /dev/null
+++ b/test cases/rust/12 bindgen/src/global.rs
@@ -0,0 +1,14 @@
+// SPDX-license-identifer: Apache-2.0
+// Copyright © 2023 Intel Corporation
+
+#![allow(non_upper_case_globals)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+
+include!("global-project.rs");
+
+fn main() {
+ unsafe {
+ std::process::exit(success());
+ };
+}