Commit 4d746230 authored by Josh Chase's avatar Josh Chase Committed by Ryan Hunt
Browse files

Use typedef for C enums as for structs

parent 1bf2abbe
......@@ -162,7 +162,11 @@ impl Source for Enum {
};
if config.language == Language::C {
out.write(&format!("enum {}", self.name));
if size.is_none() {
out.write("typedef enum");
} else {
out.write(&format!("enum {}", self.name));
}
} else {
if let Some(prim) = size {
out.write(&format!("enum class {} : {}", self.name, prim));
......@@ -183,7 +187,13 @@ impl Source for Enum {
out.new_line();
out.write("Sentinel /* this must be last for serialization purposes. */");
}
out.close_brace(true);
if config.language == Language::C && size.is_none() {
out.close_brace(false);
out.write(&format!(" {};", self.name));
} else {
out.close_brace(true);
}
if config.language == Language::C {
if let Some(prim) = size {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment