diff --git a/README.md b/README.md index e3e79ca..b85c419 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ language = "[C|C++]" style = "[Both|Type|Tag]" # How the generated documentation should be commented. # C uses /* */; C++ uses //; Doxy is like C but with leading * per line. -documentation_style = "[C, C++, Doxy]" +documentation_style = "[C, C99, C++, Doxy]" [defines] diff --git a/src/bindgen/config.rs b/src/bindgen/config.rs index 9576526..d227a31 100644 --- a/src/bindgen/config.rs +++ b/src/bindgen/config.rs @@ -104,6 +104,7 @@ deserialize_enum_str!(Layout); #[derive(Debug, Clone, PartialEq, Copy)] pub enum DocumentationStyle { C, + C99, Doxy, Cxx, Auto, @@ -115,6 +116,7 @@ impl FromStr for DocumentationStyle { fn from_str(s: &str) -> Result { match s.to_lowercase().as_ref() { "c" => Ok(DocumentationStyle::C), + "c99" => Ok(DocumentationStyle::C99), "cxx" => Ok(DocumentationStyle::Cxx), "c++" => Ok(DocumentationStyle::Cxx), "doxy" => Ok(DocumentationStyle::Doxy), diff --git a/src/bindgen/ir/documentation.rs b/src/bindgen/ir/documentation.rs index a0a4224..1a67b78 100644 --- a/src/bindgen/ir/documentation.rs +++ b/src/bindgen/ir/documentation.rs @@ -67,6 +67,7 @@ impl Source for Documentation { match style { DocumentationStyle::C => out.write(""), DocumentationStyle::Doxy => out.write(" *"), + DocumentationStyle::C99 => out.write("//"), DocumentationStyle::Cxx => out.write("///"), DocumentationStyle::Auto => unreachable!(), // Auto case should always be covered } diff --git a/tests/expectations/both/docstyle_c99.c b/tests/expectations/both/docstyle_c99.c new file mode 100644 index 0000000..111f78a --- /dev/null +++ b/tests/expectations/both/docstyle_c99.c @@ -0,0 +1,7 @@ +#include +#include +#include +#include + +// The root of all evil. +void root(void); diff --git a/tests/expectations/docstyle_c99.c b/tests/expectations/docstyle_c99.c new file mode 100644 index 0000000..111f78a --- /dev/null +++ b/tests/expectations/docstyle_c99.c @@ -0,0 +1,7 @@ +#include +#include +#include +#include + +// The root of all evil. +void root(void); diff --git a/tests/expectations/docstyle_c99.cpp b/tests/expectations/docstyle_c99.cpp new file mode 100644 index 0000000..c953b40 --- /dev/null +++ b/tests/expectations/docstyle_c99.cpp @@ -0,0 +1,10 @@ +#include +#include +#include + +extern "C" { + +// The root of all evil. +void root(); + +} // extern "C" diff --git a/tests/expectations/tag/docstyle_c99.c b/tests/expectations/tag/docstyle_c99.c new file mode 100644 index 0000000..111f78a --- /dev/null +++ b/tests/expectations/tag/docstyle_c99.c @@ -0,0 +1,7 @@ +#include +#include +#include +#include + +// The root of all evil. +void root(void); diff --git a/tests/rust/docstyle_c99.rs b/tests/rust/docstyle_c99.rs new file mode 100644 index 0000000..2b66147 --- /dev/null +++ b/tests/rust/docstyle_c99.rs @@ -0,0 +1,4 @@ +/// The root of all evil. +#[no_mangle] +pub extern "C" fn root() { +} diff --git a/tests/rust/docstyle_c99.toml b/tests/rust/docstyle_c99.toml new file mode 100644 index 0000000..c94138b --- /dev/null +++ b/tests/rust/docstyle_c99.toml @@ -0,0 +1 @@ +documentation_style = "c99"