Skip to content

Commit

Permalink
some fixes update
Browse files Browse the repository at this point in the history
* fn funtions
* extern struct
* none_argname
  • Loading branch information
kassane committed Sep 29, 2024
1 parent 458ef3c commit d156169
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
14 changes: 9 additions & 5 deletions src/bindgen/cdecl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ impl CDecl {
t
);
if config.language != Language::Zig {
self.type_qualifers = "const".to_owned();
"const".clone_into(&mut self.type_qualifers);
}
"const".clone_into(&mut self.type_qualifers);
}

assert!(
Expand All @@ -143,9 +142,8 @@ impl CDecl {
t
);
if config.language != Language::Zig {
self.type_qualifers = "const".to_owned();
"const".clone_into(&mut self.type_qualifers);
}
"const".clone_into(&mut self.type_qualifers);
}

assert!(
Expand Down Expand Up @@ -241,7 +239,7 @@ impl CDecl {

// When we have an identifier, put a space between the type and the declarators
if ident.is_some() {
if config.language == Language::Zig && self.declarators.is_empty() {
if config.language == Language::Zig {
out.write("");
} else {
out.write(" ");
Expand All @@ -268,6 +266,9 @@ impl CDecl {
if !self.type_qualifers.is_empty() {
write!(out, "{}", self.type_qualifers);
} else {
if ident.is_none() && config.language == Language::Zig {
out.write("_");
}
if config.language != Language::Zig {
out.write("_");
}
Expand Down Expand Up @@ -295,6 +296,9 @@ impl CDecl {
if next_is_pointer && config.language != Language::Zig {
out.write("(");
}
if !next_is_pointer && config.language == Language::Zig {
out.write("fn ");
}
is_functors = true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/bindgen/ir/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,9 +811,9 @@ impl Enum {
write!(out, " {} ", note);
}

if config.language != Language::C || config.language != Language::Zig || config.style.generate_tag() {
write!(out, " {}", self.export_name());
}
// if config.language != Language::C || config.language != Language::Zig || config.style.generate_tag() {
// write!(out, " {}", self.export_name());
// }

out.open_brace();

Expand Down
12 changes: 1 addition & 11 deletions src/bindgen/ir/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ impl Field {
}
}

pub fn from_type(ty: Type) -> Field {
Field {
name: "".to_string(),
ty,
cfg: None,
annotations: AnnotationSet::new(),
documentation: Documentation::none(),
}
}

pub fn load(field: &syn::Field, self_path: &Path) -> Result<Option<Field>, String> {
Ok(if let Some(mut ty) = Type::load(&field.ty)? {
ty.replace_self_with(self_path);
Expand All @@ -52,4 +42,4 @@ impl Field {
None
})
}
}
}

0 comments on commit d156169

Please sign in to comment.