diff --git a/Cargo.toml b/Cargo.toml index 545c530..ac80fe7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ctest2" -version = "0.4.2" +version = "0.4.3" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/JohnTitor/ctest2" diff --git a/src/lib.rs b/src/lib.rs index 51e0ceb..c5c65ca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1168,6 +1168,7 @@ impl<'a> Generator<'a> { fn rust2c(&self, ty: &str) -> String { match ty { + "c_longdouble" | "c_long_double" => format!("long double"), t if t.starts_with("c_") => match &ty[2..].replace("long", " long")[..] { s if s.starts_with('u') => format!("unsigned {}", &s[1..]), "short" => "short".to_string(), diff --git a/testcrate/src/t1.h b/testcrate/src/t1.h index 2fc4e17..79afebd 100644 --- a/testcrate/src/t1.h +++ b/testcrate/src/t1.h @@ -172,3 +172,8 @@ typedef struct timeval tv; char message[LOG_MAX_LINE_LENGTH]; } log_record_t; + +typedef struct +{ + long double inner; +} LongDoubleWrap; diff --git a/testcrate/src/t1.rs b/testcrate/src/t1.rs index bd84cff..7489699 100644 --- a/testcrate/src/t1.rs +++ b/testcrate/src/t1.rs @@ -196,3 +196,14 @@ struct log_record_t { tv: timeval, message: [c_char; LOG_MAX_LINE_LENGTH], } + +#[cfg(not(any(target_pointer_width = "16", target_pointer_width = "32")))] +#[repr(C, align(16))] +struct LongDoubleWrap { + inner: u128, +} +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] +#[repr(C)] +struct LongDoubleWrap { + inner: c_double, +}