Skip to content

Commit

Permalink
Remove lower-version clang workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Sep 1, 2023
1 parent 94d8ac1 commit bffd0db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 0 additions & 6 deletions crates/header-translator/framework-includes.h
Original file line number Diff line number Diff line change
@@ -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 <TargetConditionals.h>

#if TARGET_OS_OSX
Expand Down
12 changes: 12 additions & 0 deletions crates/header-translator/src/rust_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ impl AttributeParser<'_, '_> {
None
}
}

fn nullable_result(&mut self, position: ParsePosition) -> bool {
self.strip("_Nullable_result", position)
}
}

impl Drop for AttributeParser<'_, '_> {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit bffd0db

Please sign in to comment.