diff --git a/crates/header-translator/framework-includes.h b/crates/header-translator/framework-includes.h index f4bb47113..22b1d3410 100644 --- a/crates/header-translator/framework-includes.h +++ b/crates/header-translator/framework-includes.h @@ -1,9 +1,3 @@ -// Workaround for clang < 13, only used in NSBundle.h -#define NS_FORMAT_ARGUMENT(A) - -// Workaround for clang < 13 -#define _Nullable_result _Nullable - #include #if TARGET_OS_OSX diff --git a/crates/header-translator/src/rust_type.rs b/crates/header-translator/src/rust_type.rs index 7e1858eaa..f6ab4a238 100644 --- a/crates/header-translator/src/rust_type.rs +++ b/crates/header-translator/src/rust_type.rs @@ -141,6 +141,10 @@ impl AttributeParser<'_, '_> { None } } + + fn nullable_result(&mut self, position: ParsePosition) -> bool { + self.strip("_Nullable_result", position) + } } impl Drop for AttributeParser<'_, '_> { @@ -584,6 +588,10 @@ impl Inner { let is_const = get_is_const(parser.is_const(ParsePosition::Suffix)); lifetime.update(parser.lifetime(ParsePosition::Suffix)); + + // TODO: Use _Nullable_result + let _nullable_result = parser.nullable_result(ParsePosition::Suffix); + let nullability = if let Some(nullability) = unexposed_nullability { nullability } else { @@ -672,6 +680,10 @@ impl Inner { let is_const = get_is_const(parser.is_const(ParsePosition::Suffix)); lifetime.update(parser.lifetime(ParsePosition::Suffix)); + + // TODO: Use _Nullable_result + let _nullable_result = parser.nullable_result(ParsePosition::Suffix); + let mut nullability = if let Some(nullability) = unexposed_nullability { nullability } else {