codegen: Properly track alignment of unions.

This makes us not unnecessarily add repr(align) to unions.

Closes #1498.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 031efe6..fbbf29c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,53 +9,56 @@
   - [Removed](#removed)
   - [Fixed](#fixed)
   - [Security](#security)
-- [0.47.3](#0473)
+- [0.48.0](#0480)
   - [Changed](#changed-1)
-- [0.47.2](#0472)
   - [Fixed](#fixed-1)
-- [0.47.1](#0471)
+- [0.47.3](#0473)
   - [Changed](#changed-2)
+- [0.47.2](#0472)
   - [Fixed](#fixed-2)
-- [0.47.0](#0470)
+- [0.47.1](#0471)
   - [Changed](#changed-3)
   - [Fixed](#fixed-3)
+- [0.47.0](#0470)
+  - [Changed](#changed-4)
+  - [Fixed](#fixed-4)
 - [0.33.1 .. 0.46.0](#0331--0460)
   - [Added](#added-1)
   - [Removed](#removed-1)
-  - [Changed](#changed-4)
-  - [Fixed](#fixed-4)
-- [0.33.1](#0331)
+  - [Changed](#changed-5)
   - [Fixed](#fixed-5)
+- [0.33.1](#0331)
+  - [Fixed](#fixed-6)
 - [0.33.0](#0330)
   - [Added](#added-2)
-  - [Changed](#changed-5)
+  - [Changed](#changed-6)
   - [Deprecated](#deprecated-1)
   - [Removed](#removed-2)
-  - [Fixed](#fixed-6)
+  - [Fixed](#fixed-7)
   - [Security](#security-1)
 - [0.32.2](#0322)
-  - [Fixed](#fixed-7)
-- [0.32.1](#0321)
   - [Fixed](#fixed-8)
+- [0.32.1](#0321)
+  - [Fixed](#fixed-9)
 - [0.32.0](#0320)
   - [Added](#added-3)
-  - [Changed](#changed-6)
-  - [Fixed](#fixed-9)
+  - [Changed](#changed-7)
+  - [Fixed](#fixed-10)
 - [0.31.0](#0310)
   - [Added](#added-4)
-  - [Changed](#changed-7)
+  - [Changed](#changed-8)
   - [Deprecated](#deprecated-2)
   - [Removed](#removed-3)
-  - [Fixed](#fixed-10)
+  - [Fixed](#fixed-11)
 - [0.30.0](#0300)
   - [Added](#added-5)
-  - [Changed](#changed-8)
+  - [Changed](#changed-9)
   - [Deprecated](#deprecated-3)
-  - [Fixed](#fixed-11)
+  - [Fixed](#fixed-12)
 - [0.29.0](#0290)
   - [Added](#added-6)
-  - [Changed](#changed-9)
-  - [Fixed](#fixed-12)
+  - [Changed](#changed-10)
+  - [Fixed](#fixed-13)
 
 <!-- END doctoc generated TOC please keep comment here to allow auto update -->
 
@@ -101,7 +104,12 @@
 * Default rust target was changed to 1.33, which means that bindgen can get much
   more often the layout of structs right. [#1529][]
 
+## Fixed
+
+* Bindgen will output repr(align) just when needed for unions. [#1498][]
+
 [#1529]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1529
+[#1498]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1498
 
 --------------------------------------------------------------------------------
 
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 2d71942..d7f98c1 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -1589,6 +1589,7 @@
             // TODO(emilio): It'd be nice to unify this with the struct path
             // above somehow.
             let layout = layout.expect("Unable to get layout information?");
+            struct_layout.saw_union(layout);
 
             if struct_layout.requires_explicit_align(layout) {
                 explicit_align = Some(layout.align);
@@ -1600,8 +1601,6 @@
                     _bindgen_union_align: #ty ,
                 }
             } else {
-                struct_layout.saw_union(layout);
-
                 quote! {
                     pub bindgen_union_field: #ty ,
                 }
diff --git a/src/codegen/struct_layout.rs b/src/codegen/struct_layout.rs
index 921ab21..29d281a 100644
--- a/src/codegen/struct_layout.rs
+++ b/src/codegen/struct_layout.rs
@@ -85,9 +85,9 @@
         name: &'a str,
     ) -> Self {
         StructLayoutTracker {
-            name: name,
-            ctx: ctx,
-            comp: comp,
+            name,
+            ctx,
+            comp,
             is_packed: comp.is_packed(ctx, &ty.layout(ctx)),
             latest_offset: 0,
             padding_count: 0,
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs
index 9f19d21..3a9e899 100644
--- a/tests/expectations/tests/16-byte-alignment.rs
+++ b/tests/expectations/tests/16-byte-alignment.rs
@@ -15,7 +15,6 @@
     pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union rte_ipv4_tuple__bindgen_ty_1 {
     pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
@@ -149,7 +148,6 @@
     pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union rte_ipv6_tuple__bindgen_ty_1 {
     pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs
index 40c56b9..5b5ed43 100644
--- a/tests/expectations/tests/anon_struct_in_union.rs
+++ b/tests/expectations/tests/anon_struct_in_union.rs
@@ -13,7 +13,6 @@
     pub u: s__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union s__bindgen_ty_1 {
     pub field: s__bindgen_ty_1_inner,
diff --git a/tests/expectations/tests/anon_union.rs b/tests/expectations/tests/anon_union.rs
index c086e73..a9b6029 100644
--- a/tests/expectations/tests/anon_union.rs
+++ b/tests/expectations/tests/anon_union.rs
@@ -33,7 +33,6 @@
     _unused: [u8; 0],
 }
 #[repr(C)]
-#[repr(align(8))]
 pub union TErrorResult__bindgen_ty_1 {
     pub mMessage: *mut TErrorResult_Message,
     pub mDOMExceptionInfo: *mut TErrorResult_DOMExceptionInfo,
diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs
index 3fda629..f52f0f8 100644
--- a/tests/expectations/tests/class.rs
+++ b/tests/expectations/tests/class.rs
@@ -335,7 +335,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union Union {
     pub d: f32,
diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs
index d055cfb..577dec6 100644
--- a/tests/expectations/tests/class_with_inner_struct.rs
+++ b/tests/expectations/tests/class_with_inner_struct.rs
@@ -54,7 +54,6 @@
     );
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union A__bindgen_ty_1 {
     pub f: ::std::os::raw::c_int,
@@ -89,7 +88,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union A__bindgen_ty_2 {
     pub d: ::std::os::raw::c_int,
@@ -233,7 +231,6 @@
     pub __bindgen_anon_1: C__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union C__bindgen_ty_1 {
     pub mFunc: C__bindgen_ty_1__bindgen_ty_1,
diff --git a/tests/expectations/tests/derive-debug-mangle-name.rs b/tests/expectations/tests/derive-debug-mangle-name.rs
index ca9e7e2..9c72fbb 100644
--- a/tests/expectations/tests/derive-debug-mangle-name.rs
+++ b/tests/expectations/tests/derive-debug-mangle-name.rs
@@ -15,7 +15,6 @@
     pub __bindgen_anon_1: perf_event_attr__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union perf_event_attr__bindgen_ty_1 {
     pub b: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/derive-partialeq-anonfield.rs b/tests/expectations/tests/derive-partialeq-anonfield.rs
index 1d38b0b..b5cb159 100644
--- a/tests/expectations/tests/derive-partialeq-anonfield.rs
+++ b/tests/expectations/tests/derive-partialeq-anonfield.rs
@@ -14,7 +14,6 @@
     pub __bindgen_anon_1: rte_mbuf__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(1))]
 #[derive(Copy, Clone)]
 pub union rte_mbuf__bindgen_ty_1 {
     _bindgen_union_align: [u8; 0usize],
diff --git a/tests/expectations/tests/derive-partialeq-pointer.rs b/tests/expectations/tests/derive-partialeq-pointer.rs
index ea1b88a..2ac23c8 100644
--- a/tests/expectations/tests/derive-partialeq-pointer.rs
+++ b/tests/expectations/tests/derive-partialeq-pointer.rs
@@ -41,7 +41,6 @@
     pub __bindgen_anon_1: c__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(1))]
 #[derive(Copy, Clone)]
 pub union c__bindgen_ty_1 {
     _bindgen_union_align: u8,
diff --git a/tests/expectations/tests/derive-partialeq-union.rs b/tests/expectations/tests/derive-partialeq-union.rs
index 5adbca1..a271f41 100644
--- a/tests/expectations/tests/derive-partialeq-union.rs
+++ b/tests/expectations/tests/derive-partialeq-union.rs
@@ -9,7 +9,6 @@
 
 /// Deriving PartialEq for rust unions is not supported.
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union ShouldNotDerivePartialEq {
     pub a: ::std::os::raw::c_char,
diff --git a/tests/expectations/tests/issue-1285.rs b/tests/expectations/tests/issue-1285.rs
index 666f617..77df620 100644
--- a/tests/expectations/tests/issue-1285.rs
+++ b/tests/expectations/tests/issue-1285.rs
@@ -12,7 +12,6 @@
     pub bar: foo__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 pub union foo__bindgen_ty_1 {
     pub a: ::std::os::raw::c_uint,
     pub b: ::std::os::raw::c_ushort,
diff --git a/tests/expectations/tests/issue-1498.rs b/tests/expectations/tests/issue-1498.rs
new file mode 100644
index 0000000..0f9ef68
--- /dev/null
+++ b/tests/expectations/tests/issue-1498.rs
@@ -0,0 +1,153 @@
+/* automatically generated by rust-bindgen */
+
+#![allow(
+    dead_code,
+    non_snake_case,
+    non_camel_case_types,
+    non_upper_case_globals
+)]
+
+#[repr(C, packed)]
+#[derive(Copy, Clone)]
+pub struct rte_memseg {
+    ///< Start physical address.
+    pub phys_addr: u64,
+    pub __bindgen_anon_1: rte_memseg__bindgen_ty_1,
+    ///< Length of the segment.
+    pub len: usize,
+    ///< The pagesize of underlying memory
+    pub hugepage_sz: u64,
+    ///< NUMA socket ID.
+    pub socket_id: i32,
+    ///< Number of channels.
+    pub nchannel: u32,
+    ///< Number of ranks.
+    pub nrank: u32,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union rte_memseg__bindgen_ty_1 {
+    ///< Start virtual address.
+    pub addr: *mut ::std::os::raw::c_void,
+    ///< Makes sure addr is always 64 bits
+    pub addr_64: u64,
+    _bindgen_union_align: u64,
+}
+#[test]
+fn bindgen_test_layout_rte_memseg__bindgen_ty_1() {
+    assert_eq!(
+        ::std::mem::size_of::<rte_memseg__bindgen_ty_1>(),
+        8usize,
+        concat!("Size of: ", stringify!(rte_memseg__bindgen_ty_1))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<rte_memseg__bindgen_ty_1>(),
+        8usize,
+        concat!("Alignment of ", stringify!(rte_memseg__bindgen_ty_1))
+    );
+    assert_eq!(
+        unsafe { &(*(::std::ptr::null::<rte_memseg__bindgen_ty_1>())).addr as *const _ as usize },
+        0usize,
+        concat!(
+            "Offset of field: ",
+            stringify!(rte_memseg__bindgen_ty_1),
+            "::",
+            stringify!(addr)
+        )
+    );
+    assert_eq!(
+        unsafe {
+            &(*(::std::ptr::null::<rte_memseg__bindgen_ty_1>())).addr_64 as *const _ as usize
+        },
+        0usize,
+        concat!(
+            "Offset of field: ",
+            stringify!(rte_memseg__bindgen_ty_1),
+            "::",
+            stringify!(addr_64)
+        )
+    );
+}
+impl Default for rte_memseg__bindgen_ty_1 {
+    fn default() -> Self {
+        unsafe { ::std::mem::zeroed() }
+    }
+}
+#[test]
+fn bindgen_test_layout_rte_memseg() {
+    assert_eq!(
+        ::std::mem::size_of::<rte_memseg>(),
+        44usize,
+        concat!("Size of: ", stringify!(rte_memseg))
+    );
+    assert_eq!(
+        ::std::mem::align_of::<rte_memseg>(),
+        1usize,
+        concat!("Alignment of ", stringify!(rte_memseg))
+    );
+    assert_eq!(
+        unsafe { &(*(::std::ptr::null::<rte_memseg>())).phys_addr as *const _ as usize },
+        0usize,
+        concat!(
+            "Offset of field: ",
+            stringify!(rte_memseg),
+            "::",
+            stringify!(phys_addr)
+        )
+    );
+    assert_eq!(
+        unsafe { &(*(::std::ptr::null::<rte_memseg>())).len as *const _ as usize },
+        16usize,
+        concat!(
+            "Offset of field: ",
+            stringify!(rte_memseg),
+            "::",
+            stringify!(len)
+        )
+    );
+    assert_eq!(
+        unsafe { &(*(::std::ptr::null::<rte_memseg>())).hugepage_sz as *const _ as usize },
+        24usize,
+        concat!(
+            "Offset of field: ",
+            stringify!(rte_memseg),
+            "::",
+            stringify!(hugepage_sz)
+        )
+    );
+    assert_eq!(
+        unsafe { &(*(::std::ptr::null::<rte_memseg>())).socket_id as *const _ as usize },
+        32usize,
+        concat!(
+            "Offset of field: ",
+            stringify!(rte_memseg),
+            "::",
+            stringify!(socket_id)
+        )
+    );
+    assert_eq!(
+        unsafe { &(*(::std::ptr::null::<rte_memseg>())).nchannel as *const _ as usize },
+        36usize,
+        concat!(
+            "Offset of field: ",
+            stringify!(rte_memseg),
+            "::",
+            stringify!(nchannel)
+        )
+    );
+    assert_eq!(
+        unsafe { &(*(::std::ptr::null::<rte_memseg>())).nrank as *const _ as usize },
+        40usize,
+        concat!(
+            "Offset of field: ",
+            stringify!(rte_memseg),
+            "::",
+            stringify!(nrank)
+        )
+    );
+}
+impl Default for rte_memseg {
+    fn default() -> Self {
+        unsafe { ::std::mem::zeroed() }
+    }
+}
diff --git a/tests/expectations/tests/issue-493.rs b/tests/expectations/tests/issue-493.rs
index 02ed7ed..e7e5c55 100644
--- a/tests/expectations/tests/issue-493.rs
+++ b/tests/expectations/tests/issue-493.rs
@@ -83,7 +83,6 @@
     pub __data_: *mut basic_string_value_type,
 }
 #[repr(C)]
-#[repr(align(1))]
 pub union basic_string___short__bindgen_ty_1 {
     pub __size_: ::std::os::raw::c_uchar,
     pub __lx: basic_string_value_type,
diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs
index 9ea5e5c..aa0420a 100644
--- a/tests/expectations/tests/jsval_layout_opaque.rs
+++ b/tests/expectations/tests/jsval_layout_opaque.rs
@@ -176,7 +176,6 @@
     JS_WHY_MAGIC_COUNT = 18,
 }
 #[repr(C)]
-#[repr(align(8))]
 #[derive(Copy, Clone)]
 pub union jsval_layout {
     pub asBits: u64,
@@ -259,7 +258,6 @@
     pub payload: jsval_layout__bindgen_ty_2__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union jsval_layout__bindgen_ty_2__bindgen_ty_1 {
     pub i32: i32,
diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs
index 734839f..5582c7d 100644
--- a/tests/expectations/tests/layout_eth_conf.rs
+++ b/tests/expectations/tests/layout_eth_conf.rs
@@ -1830,7 +1830,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union rte_eth_conf__bindgen_ty_2 {
     pub vmdq_dcb_tx_conf: rte_eth_vmdq_dcb_tx_conf,
diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs
index 8bfda72..6ed1d13 100644
--- a/tests/expectations/tests/layout_mbuf.rs
+++ b/tests/expectations/tests/layout_mbuf.rs
@@ -180,7 +180,6 @@
 /// or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
 /// config option.
 #[repr(C)]
-#[repr(align(2))]
 #[derive(Copy, Clone)]
 pub union rte_mbuf__bindgen_ty_1 {
     ///< Atomically accessed refcnt
@@ -230,7 +229,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union rte_mbuf__bindgen_ty_2 {
     ///< L2/L3/L4 and tunnel information.
@@ -415,7 +413,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union rte_mbuf__bindgen_ty_3 {
     ///< RSS hash result if RSS enabled
@@ -435,7 +432,6 @@
     pub hi: u32,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
     pub __bindgen_anon_1: rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1,
@@ -672,7 +668,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(8))]
 #[derive(Copy, Clone)]
 pub union rte_mbuf__bindgen_ty_4 {
     ///< Can be used for external metadata
@@ -720,7 +715,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(8))]
 #[derive(Copy, Clone)]
 pub union rte_mbuf__bindgen_ty_5 {
     ///< combined for easy fetch
diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs
index 2279853..d0328d3 100644
--- a/tests/expectations/tests/struct_with_anon_union.rs
+++ b/tests/expectations/tests/struct_with_anon_union.rs
@@ -13,7 +13,6 @@
     pub bar: foo__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo__bindgen_ty_1 {
     pub a: ::std::os::raw::c_uint,
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
index 90ee13e..abb0bd3 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
@@ -13,7 +13,6 @@
     pub __bindgen_anon_1: foo__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo__bindgen_ty_1 {
     pub a: ::std::os::raw::c_uint,
diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs
index ddbbe77..73787d8 100644
--- a/tests/expectations/tests/struct_with_nesting.rs
+++ b/tests/expectations/tests/struct_with_nesting.rs
@@ -14,7 +14,6 @@
     pub __bindgen_anon_1: foo__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo__bindgen_ty_1 {
     pub b: ::std::os::raw::c_uint,
diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs
index b0f1290..3a76d51 100644
--- a/tests/expectations/tests/typeref.rs
+++ b/tests/expectations/tests/typeref.rs
@@ -60,7 +60,6 @@
     pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
 }
 #[repr(C)]
-#[repr(align(8))]
 pub union mozilla_StyleShapeSource__bindgen_ty_1 {
     pub mPosition: *mut mozilla_Position,
     pub mFragmentOrURL: *mut mozilla_FragmentOrURL,
diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs
index c3b541a..b0d3ac9 100644
--- a/tests/expectations/tests/union-in-ns.rs
+++ b/tests/expectations/tests/union-in-ns.rs
@@ -12,7 +12,6 @@
     #[allow(unused_imports)]
     use self::super::root;
     #[repr(C)]
-    #[repr(align(4))]
     #[derive(Copy, Clone)]
     pub union bar {
         pub baz: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/union_bitfield.rs b/tests/expectations/tests/union_bitfield.rs
index d3a94b1..d6f52ef 100644
--- a/tests/expectations/tests/union_bitfield.rs
+++ b/tests/expectations/tests/union_bitfield.rs
@@ -90,7 +90,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union U4 {
     pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
@@ -138,7 +137,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union B {
     pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u32>,
diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs
index ee6e4e2..1a3ad71 100644
--- a/tests/expectations/tests/union_dtor.rs
+++ b/tests/expectations/tests/union_dtor.rs
@@ -8,7 +8,6 @@
 )]
 
 #[repr(C)]
-#[repr(align(8))]
 pub union UnionWithDtor {
     pub mFoo: ::std::os::raw::c_int,
     pub mBar: *mut ::std::os::raw::c_void,
diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs
index 40e374c..e6f4e22 100644
--- a/tests/expectations/tests/union_fields.rs
+++ b/tests/expectations/tests/union_fields.rs
@@ -8,7 +8,6 @@
 )]
 
 #[repr(C)]
-#[repr(align(8))]
 #[derive(Copy, Clone)]
 pub union nsStyleUnion {
     pub mInt: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/union_template.rs b/tests/expectations/tests/union_template.rs
index eea3b0e..a8af8b9 100644
--- a/tests/expectations/tests/union_template.rs
+++ b/tests/expectations/tests/union_template.rs
@@ -14,7 +14,6 @@
     pub __bindgen_anon_1: NastyStruct__bindgen_ty_2,
 }
 #[repr(C)]
-#[repr(align(8))]
 pub union NastyStruct__bindgen_ty_1 {
     pub mFoo: *mut ::std::os::raw::c_void,
     pub mDummy: ::std::os::raw::c_ulong,
@@ -26,7 +25,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(8))]
 pub union NastyStruct__bindgen_ty_2 {
     pub wat: ::std::os::raw::c_short,
     pub wut: *mut ::std::os::raw::c_int,
@@ -43,7 +41,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(8))]
 pub union Whatever {
     pub mTPtr: *mut ::std::os::raw::c_void,
     pub mInt: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs
index ede6acf..a145133 100644
--- a/tests/expectations/tests/union_with_anon_struct.rs
+++ b/tests/expectations/tests/union_with_anon_struct.rs
@@ -8,7 +8,6 @@
 )]
 
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo {
     pub bar: foo__bindgen_ty_1,
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
index d08a7ff..f97f122 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
@@ -90,7 +90,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo {
     pub a: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs
index df1b34f..aa2abc8 100644
--- a/tests/expectations/tests/union_with_anon_union.rs
+++ b/tests/expectations/tests/union_with_anon_union.rs
@@ -8,14 +8,12 @@
 )]
 
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo {
     pub bar: foo__bindgen_ty_1,
     _bindgen_union_align: u32,
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo__bindgen_ty_1 {
     pub a: ::std::os::raw::c_uint,
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
index 79f6624..a1267b3 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
@@ -8,7 +8,6 @@
 )]
 
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union pixel {
     pub rgba: ::std::os::raw::c_uint,
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs
index c81afa1..c6272c1 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs
@@ -8,7 +8,6 @@
 )]
 
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo {
     pub a: ::std::os::raw::c_uint,
@@ -16,7 +15,6 @@
     _bindgen_union_align: u32,
 }
 #[repr(C)]
-#[repr(align(2))]
 #[derive(Copy, Clone)]
 pub union foo__bindgen_ty_1 {
     pub b: ::std::os::raw::c_ushort,
diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs
index 40eed80..c31a69f 100644
--- a/tests/expectations/tests/union_with_big_member.rs
+++ b/tests/expectations/tests/union_with_big_member.rs
@@ -8,7 +8,6 @@
 )]
 
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union WithBigArray {
     pub a: ::std::os::raw::c_int,
@@ -54,7 +53,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union WithBigArray2 {
     pub a: ::std::os::raw::c_int,
@@ -100,7 +98,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union WithBigMember {
     pub a: ::std::os::raw::c_int,
diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs
index e11aff2..0a4fd91 100644
--- a/tests/expectations/tests/union_with_nesting.rs
+++ b/tests/expectations/tests/union_with_nesting.rs
@@ -8,7 +8,6 @@
 )]
 
 #[repr(C)]
-#[repr(align(4))]
 #[derive(Copy, Clone)]
 pub union foo {
     pub a: ::std::os::raw::c_uint,
@@ -22,7 +21,6 @@
     pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
 }
 #[repr(C)]
-#[repr(align(2))]
 #[derive(Copy, Clone)]
 pub union foo__bindgen_ty_1__bindgen_ty_1 {
     pub b1: ::std::os::raw::c_ushort,
@@ -72,7 +70,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(2))]
 #[derive(Copy, Clone)]
 pub union foo__bindgen_ty_1__bindgen_ty_2 {
     pub c1: ::std::os::raw::c_ushort,
diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs
index 133065e..563258a 100644
--- a/tests/expectations/tests/use-core.rs
+++ b/tests/expectations/tests/use-core.rs
@@ -50,7 +50,6 @@
     }
 }
 #[repr(C)]
-#[repr(align(8))]
 #[derive(Copy, Clone)]
 pub union _bindgen_ty_1 {
     pub bar: ::std::os::raw::c_int,
diff --git a/tests/headers/issue-1498.h b/tests/headers/issue-1498.h
new file mode 100644
index 0000000..aceabbd
--- /dev/null
+++ b/tests/headers/issue-1498.h
@@ -0,0 +1,17 @@
+typedef unsigned long uint64_t;
+typedef uint64_t size_t;
+typedef unsigned uint32_t;
+typedef int int32_t;
+
+struct rte_memseg {
+    uint64_t phys_addr;      /**< Start physical address. */
+    union {
+        void *addr;         /**< Start virtual address. */
+        uint64_t addr_64;   /**< Makes sure addr is always 64 bits */
+    };
+    size_t len;               /**< Length of the segment. */
+    uint64_t hugepage_sz;       /**< The pagesize of underlying memory */
+    int32_t socket_id;          /**< NUMA socket ID. */
+    uint32_t nchannel;          /**< Number of channels. */
+    uint32_t nrank;             /**< Number of ranks. */
+} __attribute__((__packed__));