Skip to content

Commit

Permalink
add panic to check whether parser even sees it
Browse files Browse the repository at this point in the history
  • Loading branch information
scovich authored and emilio committed May 7, 2024
1 parent 98eefa7 commit 0c82a32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/bindgen/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ fn is_skip_item_attr(attr: &syn::Meta) -> bool {
if let syn::Lit::Str(ref content) = name_value.lit {
// FIXME(emilio): Maybe should use the general annotation
// mechanism, but it seems overkill for this.
if content.value().contains("XXX") {
panic!("*** XXX *** {}", content.value());
}
if content.value().trim() == "cbindgen:ignore" {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/rust/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ pub const NOT_IGNORED_CONST: u32 = 0;
pub struct StructWithIgnoredImplMembers;

impl StructWithIgnoredImplMembers {
/// cbindgen:ignore
/// XXX associated method cbindgen:ignore
#[no_mangle]
pub extern "C" fn ignored_associated_method() {}

#[no_mangle]
pub extern "C" fn no_ignore_associated_method() {}

/// cbindgen:ignore
/// XXX associated constant cbindgen:ignore
pub const IGNORED_INNER_CONST: u32 = 0;

pub const NOT_IGNORED_INNER_CONST: u32 = 0;
Expand Down

0 comments on commit 0c82a32

Please sign in to comment.