summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2019-02-23 06:59:43 +0100
committerGitHub <noreply@github.com>2019-02-23 06:59:43 +0100
commitf4f47d52cbce45af177958e76ef9a4a17e922bc4 (patch)
tree4cbdf487f5af7913478cae56aa678e73c468fd73
parent9fb016e32bfc2cd917c907e8b9e892eed89b24c7 (diff)
parent592c7cb5eb1a2578464bf6d4892546f7e0bf4b4b (diff)
Merge pull request #1525 from emilio/llvm-bug-workaroundv0.47.2
Work-around https://bugs.llvm.org/show_bug.cgi?id=40813.
-rw-r--r--CHANGELOG.md76
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/clang.rs47
-rw-r--r--tests/expectations/tests/bug-1529681.rs27
-rw-r--r--tests/headers/bug-1529681.hpp8
6 files changed, 127 insertions, 35 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96fb0f67..f020aa0f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,46 +9,51 @@
- [Removed](#removed)
- [Fixed](#fixed)
- [Security](#security)
-- [0.47.0](#0470)
- - [Changed](#changed-1)
+- [0.47.2](#0472)
- [Fixed](#fixed-1)
+- [0.47.1](#0471)
+ - [Changed](#changed-1)
+ - [Fixed](#fixed-2)
+- [0.47.0](#0470)
+ - [Changed](#changed-2)
+ - [Fixed](#fixed-3)
- [0.33.1 .. 0.46.0](#0331--0460)
- [Added](#added-1)
- [Removed](#removed-1)
- - [Changed](#changed-2)
- - [Fixed](#fixed-2)
+ - [Changed](#changed-3)
+ - [Fixed](#fixed-4)
- [0.33.1](#0331)
- - [Fixed](#fixed-3)
+ - [Fixed](#fixed-5)
- [0.33.0](#0330)
- [Added](#added-2)
- - [Changed](#changed-3)
+ - [Changed](#changed-4)
- [Deprecated](#deprecated-1)
- [Removed](#removed-2)
- - [Fixed](#fixed-4)
+ - [Fixed](#fixed-6)
- [Security](#security-1)
- [0.32.2](#0322)
- - [Fixed](#fixed-5)
+ - [Fixed](#fixed-7)
- [0.32.1](#0321)
- - [Fixed](#fixed-6)
+ - [Fixed](#fixed-8)
- [0.32.0](#0320)
- [Added](#added-3)
- - [Changed](#changed-4)
- - [Fixed](#fixed-7)
+ - [Changed](#changed-5)
+ - [Fixed](#fixed-9)
- [0.31.0](#0310)
- [Added](#added-4)
- - [Changed](#changed-5)
+ - [Changed](#changed-6)
- [Deprecated](#deprecated-2)
- [Removed](#removed-3)
- - [Fixed](#fixed-8)
+ - [Fixed](#fixed-10)
- [0.30.0](#0300)
- [Added](#added-5)
- - [Changed](#changed-6)
+ - [Changed](#changed-7)
- [Deprecated](#deprecated-3)
- - [Fixed](#fixed-9)
+ - [Fixed](#fixed-11)
- [0.29.0](#0290)
- [Added](#added-6)
- - [Changed](#changed-7)
- - [Fixed](#fixed-10)
+ - [Changed](#changed-8)
+ - [Fixed](#fixed-12)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -84,6 +89,43 @@ Released YYYY/MM/DD
--------------------------------------------------------------------------------
+# 0.47.2
+
+Released 2019/02/22
+
+## Fixed
+
+* @flowbish fixed code generation for nested function prototypes. [#1508][]
+* Some complex C++ constructs no longer panic on code generation [#1513][]
+* Implicit template parameters are now appended to base classes [#1515][]
+* @flier fixed single-argument block pointers [#1519][]
+* Bindgen won't panic when parsing an undeduced auto type [#1525][]
+
+[#1508]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1508
+[#1513]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1513
+[#1515]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1515
+[#1519]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1519
+[#1525]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1525
+
+--------------------------------------------------------------------------------
+
+# 0.47.1
+
+Released 2019/02/02
+
+## Changed
+
+* @luser improved the error message when rustfmt cannot be found [#1501][]
+
+## Fixed
+
+* Reverted `clang-sys` update for regressions [#1505][]
+
+[#1505]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1505
+[#1501]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1501
+
+--------------------------------------------------------------------------------
+
# 0.47.0
Released 2019/01/19
diff --git a/Cargo.lock b/Cargo.lock
index 8b8107c7..d22dcde0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -49,7 +49,7 @@ dependencies = [
[[package]]
name = "bindgen"
-version = "0.47.1"
+version = "0.47.2"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cexpr 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/Cargo.toml b/Cargo.toml
index 08552799..16ed8bea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ readme = "README.md"
repository = "https://github.com/rust-lang/rust-bindgen"
documentation = "https://docs.rs/bindgen"
homepage = "https://rust-lang.github.io/rust-bindgen/"
-version = "0.47.1"
+version = "0.47.2"
build = "build.rs"
include = [
diff --git a/src/clang.rs b/src/clang.rs
index 10bf054a..40ba60e8 100644
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -931,18 +931,37 @@ impl Type {
unsafe { clang_isConstQualifiedType(self.x) != 0 }
}
+ #[inline]
+ fn is_non_deductible_auto_type(&self) -> bool {
+ self.kind() == CXType_Auto && self.canonical_type() == *self
+ }
+
+ #[inline]
+ fn clang_size_of(&self) -> c_longlong {
+ if self.is_non_deductible_auto_type() {
+ return -6; // Work-around https://bugs.llvm.org/show_bug.cgi?id=40813
+ }
+ unsafe { clang_Type_getSizeOf(self.x) }
+ }
+
+ #[inline]
+ fn clang_align_of(&self) -> c_longlong {
+ if self.is_non_deductible_auto_type() {
+ return -6; // Work-around https://bugs.llvm.org/show_bug.cgi?id=40813
+ }
+ unsafe { clang_Type_getAlignOf(self.x) }
+ }
+
/// What is the size of this type? Paper over invalid types by returning `0`
/// for them.
pub fn size(&self) -> usize {
- unsafe {
- let val = clang_Type_getSizeOf(self.x);
- if val < 0 { 0 } else { val as usize }
- }
+ let val = self.clang_size_of();
+ if val < 0 { 0 } else { val as usize }
}
/// What is the size of this type?
pub fn fallible_size(&self) -> Result<usize, LayoutError> {
- let val = unsafe { clang_Type_getSizeOf(self.x) };
+ let val = self.clang_size_of();
if val < 0 {
Err(LayoutError::from(val as i32))
} else {
@@ -953,21 +972,17 @@ impl Type {
/// What is the alignment of this type? Paper over invalid types by
/// returning `0`.
pub fn align(&self) -> usize {
- unsafe {
- let val = clang_Type_getAlignOf(self.x);
- if val < 0 { 0 } else { val as usize }
- }
+ let val = self.clang_align_of();
+ if val < 0 { 0 } else { val as usize }
}
/// What is the alignment of this type?
pub fn fallible_align(&self) -> Result<usize, LayoutError> {
- unsafe {
- let val = clang_Type_getAlignOf(self.x);
- if val < 0 {
- Err(LayoutError::from(val as i32))
- } else {
- Ok(val as usize)
- }
+ let val = self.clang_align_of();
+ if val < 0 {
+ Err(LayoutError::from(val as i32))
+ } else {
+ Ok(val as usize)
}
}
diff --git a/tests/expectations/tests/bug-1529681.rs b/tests/expectations/tests/bug-1529681.rs
new file mode 100644
index 00000000..81a32093
--- /dev/null
+++ b/tests/expectations/tests/bug-1529681.rs
@@ -0,0 +1,27 @@
+/* automatically generated by rust-bindgen */
+
+#![allow(
+ dead_code,
+ non_snake_case,
+ non_camel_case_types,
+ non_upper_case_globals
+)]
+
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct BrowsingContext {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_BrowsingContext() {
+ assert_eq!(
+ ::std::mem::size_of::<BrowsingContext>(),
+ 1usize,
+ concat!("Size of: ", stringify!(BrowsingContext))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<BrowsingContext>(),
+ 1usize,
+ concat!("Alignment of ", stringify!(BrowsingContext))
+ );
+}
diff --git a/tests/headers/bug-1529681.hpp b/tests/headers/bug-1529681.hpp
new file mode 100644
index 00000000..17fa849a
--- /dev/null
+++ b/tests/headers/bug-1529681.hpp
@@ -0,0 +1,8 @@
+// bindgen-flags: -- -std=c++14
+//
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1529681
+// https://bugs.llvm.org/show_bug.cgi?id=40813
+
+class BrowsingContext {
+ auto Tie(void* aUnused) const;
+};