summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poveda <christian.poveda@ferrous-systems.com>2022-09-01 10:59:06 -0500
committerEmilio Cobos Álvarez <emilio@crisal.io>2022-09-22 20:25:33 -1000
commit3da6026afd5715715feeb4a8668a91024d71830e (patch)
treea04578f52f7a66eba9f61db732afbc2696b8fca4
parentb8f3920ad11b82673d06f2d25bb663e2b7efe491 (diff)
gate `_Noreturn` detection behind `--enable-fucntion-attribute-detection`
-rw-r--r--src/ir/function.rs4
-rw-r--r--tests/headers/noreturn.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/ir/function.rs b/src/ir/function.rs
index 6b59649c..b829e601 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -381,7 +381,9 @@ impl FunctionSig {
) -> Result<Self, ParseError> {
use clang_sys::*;
debug!("FunctionSig::from_ty {:?} {:?}", ty, cursor);
- let is_divergent = cursor.has_no_return_attr();
+
+ let is_divergent = ctx.options().enable_function_attribute_detection &&
+ cursor.has_no_return_attr();
// Skip function templates
let kind = cursor.kind();
diff --git a/tests/headers/noreturn.h b/tests/headers/noreturn.h
index 9ce68518..0e4819e2 100644
--- a/tests/headers/noreturn.h
+++ b/tests/headers/noreturn.h
@@ -1,3 +1,4 @@
+// bindgen-flags: --enable-function-attribute-detection
_Noreturn void f(void);
// TODO (pvdrz): figure out how to handle this case.
__attribute__((noreturn)) void g(void);