Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | Disable address-of-packed-member warnings with gcc9 |
| 2 | |
| 3 | gcc9 has turned this warning into error when -Werror is used, lets paper |
| 4 | it over by turning it into a warning for now |
| 5 | |
| 6 | Fixes |
| 7 | error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 8 | |
| 9 | Upstream-Status: Pending |
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 11 | --- a/grub-core/commands/lsacpi.c |
| 12 | +++ b/grub-core/commands/lsacpi.c |
| 13 | @@ -26,6 +26,9 @@ |
| 14 | #include <grub/dl.h> |
| 15 | |
| 16 | #pragma GCC diagnostic ignored "-Wcast-align" |
| 17 | +#if __GNUC__ >= 9 |
| 18 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 19 | +#endif |
| 20 | |
| 21 | GRUB_MOD_LICENSE ("GPLv3+"); |
| 22 | |
| 23 | --- a/grub-core/commands/lspci.c |
| 24 | +++ b/grub-core/commands/lspci.c |
| 25 | @@ -26,6 +26,9 @@ |
| 26 | |
| 27 | GRUB_MOD_LICENSE ("GPLv3+"); |
| 28 | |
| 29 | +#if __GNUC__ >= 9 |
| 30 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 31 | +#endif |
| 32 | struct grub_pci_classname |
| 33 | { |
| 34 | int class; |
| 35 | @@ -171,7 +174,7 @@ grub_lspci_iter (grub_pci_device_t dev, |
| 36 | |
| 37 | if (space == 0) |
| 38 | continue; |
| 39 | - |
| 40 | + |
| 41 | switch (space & GRUB_PCI_ADDR_SPACE_MASK) |
| 42 | { |
| 43 | case GRUB_PCI_ADDR_SPACE_IO: |
| 44 | @@ -195,13 +198,13 @@ grub_lspci_iter (grub_pci_device_t dev, |
| 45 | (space & GRUB_PCI_ADDR_MEM_MASK), |
| 46 | space & GRUB_PCI_ADDR_MEM_PREFETCH |
| 47 | ? "prefetchable" : "non-prefetchable"); |
| 48 | - |
| 49 | + |
| 50 | } |
| 51 | else |
| 52 | grub_printf ("\t32-bit memory space %d at 0x%016llx [%s]\n", |
| 53 | (unsigned) ((reg - GRUB_PCI_REG_ADDRESSES) |
| 54 | / sizeof (grub_uint32_t)) - 1, |
| 55 | - (unsigned long long) |
| 56 | + (unsigned long long) |
| 57 | (space & GRUB_PCI_ADDR_MEM_MASK), |
| 58 | space & GRUB_PCI_ADDR_MEM_PREFETCH |
| 59 | ? "prefetchable" : "non-prefetchable"); |
| 60 | --- a/grub-core/fs/cpio_common.c |
| 61 | +++ b/grub-core/fs/cpio_common.c |
| 62 | @@ -26,7 +26,9 @@ |
| 63 | #include <grub/archelp.h> |
| 64 | |
| 65 | GRUB_MOD_LICENSE ("GPLv3+"); |
| 66 | - |
| 67 | +#if __GNUC__ >= 9 |
| 68 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 69 | +#endif |
| 70 | struct grub_archelp_data |
| 71 | { |
| 72 | grub_disk_t disk; |
| 73 | @@ -108,7 +110,7 @@ grub_cpio_get_link_target (struct grub_a |
| 74 | if (!ret) |
| 75 | return NULL; |
| 76 | |
| 77 | - err = grub_disk_read (data->disk, 0, data->dofs, data->size, |
| 78 | + err = grub_disk_read (data->disk, 0, data->dofs, data->size, |
| 79 | ret); |
| 80 | if (err) |
| 81 | { |
| 82 | --- a/grub-core/fs/hfs.c |
| 83 | +++ b/grub-core/fs/hfs.c |
| 84 | @@ -32,6 +32,9 @@ |
| 85 | #include <grub/fshelp.h> |
| 86 | |
| 87 | GRUB_MOD_LICENSE ("GPLv3+"); |
| 88 | +#if __GNUC__ >= 9 |
| 89 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 90 | +#endif |
| 91 | |
| 92 | #define GRUB_HFS_SBLOCK 2 |
| 93 | #define GRUB_HFS_EMBED_HFSPLUS_SIG 0x482B |
| 94 | @@ -882,7 +885,7 @@ grub_hfs_iterate_dir_it_dir (struct grub |
| 95 | { |
| 96 | struct grub_hfs_catalog_key *ckey = rec->key; |
| 97 | struct grub_hfs_iterate_dir_node_found_ctx *ctx = hook_arg; |
| 98 | - |
| 99 | + |
| 100 | /* Stop when the entries do not match anymore. */ |
| 101 | if (ckey->parent_dir != ctx->dir_be) |
| 102 | return 1; |
| 103 | @@ -1076,7 +1079,7 @@ macroman_to_utf8 (char *to, const grub_u |
| 104 | { |
| 105 | *optr++ = ':'; |
| 106 | continue; |
| 107 | - } |
| 108 | + } |
| 109 | if (!(*iptr & 0x80)) |
| 110 | { |
| 111 | *optr++ = *iptr; |
| 112 | @@ -1093,7 +1096,7 @@ utf8_to_macroman (grub_uint8_t *to, cons |
| 113 | grub_uint8_t *end = to + 31; |
| 114 | grub_uint8_t *optr = to; |
| 115 | const char *iptr = from; |
| 116 | - |
| 117 | + |
| 118 | while (*iptr && optr < end) |
| 119 | { |
| 120 | int i, clen; |
| 121 | @@ -1103,7 +1106,7 @@ utf8_to_macroman (grub_uint8_t *to, cons |
| 122 | *optr++ = '/'; |
| 123 | iptr++; |
| 124 | continue; |
| 125 | - } |
| 126 | + } |
| 127 | if (!(*iptr & 0x80)) |
| 128 | { |
| 129 | *optr++ = *iptr++; |
| 130 | @@ -1164,7 +1167,7 @@ lookup_file (grub_fshelp_node_t dir, |
| 131 | *foundnode = grub_malloc (sizeof (struct grub_fshelp_node)); |
| 132 | if (!*foundnode) |
| 133 | return grub_errno; |
| 134 | - |
| 135 | + |
| 136 | (*foundnode)->inode = grub_be_to_cpu32 (fdrec.dir.dirid); |
| 137 | (*foundnode)->fdrec = fdrec; |
| 138 | (*foundnode)->data = dir->data; |
| 139 | @@ -1265,7 +1268,7 @@ grub_hfs_dir (grub_device_t device, cons |
| 140 | .hook_data = hook_data |
| 141 | }; |
| 142 | grub_fshelp_node_t found = NULL; |
| 143 | - |
| 144 | + |
| 145 | grub_dl_ref (my_mod); |
| 146 | |
| 147 | data = grub_hfs_mount (device->disk); |
| 148 | @@ -1294,7 +1297,7 @@ grub_hfs_open (struct grub_file *file, c |
| 149 | { |
| 150 | struct grub_hfs_data *data; |
| 151 | grub_fshelp_node_t found = NULL; |
| 152 | - |
| 153 | + |
| 154 | grub_dl_ref (my_mod); |
| 155 | |
| 156 | data = grub_hfs_mount (file->device->disk); |
| 157 | --- a/grub-core/fs/hfsplus.c |
| 158 | +++ b/grub-core/fs/hfsplus.c |
| 159 | @@ -19,7 +19,7 @@ |
| 160 | |
| 161 | /* HFS+ is documented at http://developer.apple.com/technotes/tn/tn1150.html */ |
| 162 | |
| 163 | -#define grub_fshelp_node grub_hfsplus_file |
| 164 | +#define grub_fshelp_node grub_hfsplus_file |
| 165 | #include <grub/err.h> |
| 166 | #include <grub/file.h> |
| 167 | #include <grub/mm.h> |
| 168 | @@ -34,6 +34,9 @@ |
| 169 | |
| 170 | GRUB_MOD_LICENSE ("GPLv3+"); |
| 171 | |
| 172 | +#if __GNUC__ >= 9 |
| 173 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 174 | +#endif |
| 175 | /* The type of node. */ |
| 176 | enum grub_hfsplus_btnode_type |
| 177 | { |
| 178 | @@ -145,7 +148,7 @@ grub_hfsplus_read_block (grub_fshelp_nod |
| 179 | { |
| 180 | struct grub_hfsplus_btnode *nnode = 0; |
| 181 | grub_disk_addr_t blksleft = fileblock; |
| 182 | - struct grub_hfsplus_extent *extents = node->compressed |
| 183 | + struct grub_hfsplus_extent *extents = node->compressed |
| 184 | ? &node->resource_extents[0] : &node->extents[0]; |
| 185 | |
| 186 | while (1) |
| 187 | @@ -461,7 +464,7 @@ grub_hfsplus_cmp_extkey (struct grub_hfs |
| 188 | |
| 189 | if (extkey_a->type < extkey_b->type) |
| 190 | return -1; |
| 191 | - |
| 192 | + |
| 193 | akey = grub_be_to_cpu32 (extkey_a->start); |
| 194 | if (akey > extkey_b->start) |
| 195 | return 1; |
| 196 | @@ -548,7 +551,7 @@ grub_hfsplus_btree_search (struct grub_h |
| 197 | struct grub_hfsplus_key_internal *key, |
| 198 | int (*compare_keys) (struct grub_hfsplus_key *keya, |
| 199 | struct grub_hfsplus_key_internal *keyb), |
| 200 | - struct grub_hfsplus_btnode **matchnode, |
| 201 | + struct grub_hfsplus_btnode **matchnode, |
| 202 | grub_off_t *keyoffset) |
| 203 | { |
| 204 | grub_uint64_t currnode; |
| 205 | --- a/grub-core/fs/jfs.c |
| 206 | +++ b/grub-core/fs/jfs.c |
| 207 | @@ -28,6 +28,9 @@ |
| 208 | #include <grub/i18n.h> |
| 209 | |
| 210 | GRUB_MOD_LICENSE ("GPLv3+"); |
| 211 | +#if __GNUC__ >= 9 |
| 212 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 213 | +#endif |
| 214 | |
| 215 | #define GRUB_JFS_MAX_SYMLNK_CNT 8 |
| 216 | #define GRUB_JFS_FILETYPE_MASK 0170000 |
| 217 | --- a/grub-core/kern/efi/efi.c |
| 218 | +++ b/grub-core/kern/efi/efi.c |
| 219 | @@ -29,6 +29,9 @@ |
| 220 | #include <grub/mm.h> |
| 221 | #include <grub/loader.h> |
| 222 | |
| 223 | +#if __GNUC__ >= 9 |
| 224 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 225 | +#endif |
| 226 | /* The handle of GRUB itself. Filled in by the startup code. */ |
| 227 | grub_efi_handle_t grub_efi_image_handle; |
| 228 | |
| 229 | @@ -201,7 +204,7 @@ grub_efi_set_variable(const char *var, c |
| 230 | |
| 231 | r = grub_efi_system_table->runtime_services; |
| 232 | |
| 233 | - status = efi_call_5 (r->set_variable, var16, guid, |
| 234 | + status = efi_call_5 (r->set_variable, var16, guid, |
| 235 | (GRUB_EFI_VARIABLE_NON_VOLATILE |
| 236 | | GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS |
| 237 | | GRUB_EFI_VARIABLE_RUNTIME_ACCESS), |
| 238 | --- a/grub-core/loader/efi/chainloader.c |
| 239 | +++ b/grub-core/loader/efi/chainloader.c |
| 240 | @@ -41,6 +41,9 @@ |
| 241 | #endif |
| 242 | |
| 243 | GRUB_MOD_LICENSE ("GPLv3+"); |
| 244 | +#if __GNUC__ >= 9 |
| 245 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 246 | +#endif |
| 247 | |
| 248 | static grub_dl_t my_mod; |
| 249 | |
| 250 | --- a/grub-core/commands/usbtest.c |
| 251 | +++ b/grub-core/commands/usbtest.c |
| 252 | @@ -63,6 +63,10 @@ static const char *usb_devspeed[] = |
| 253 | "High" |
| 254 | }; |
| 255 | |
| 256 | +#if __GNUC__ >= 9 |
| 257 | +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" |
| 258 | +#endif |
| 259 | + |
| 260 | static grub_usb_err_t |
| 261 | grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid, |
| 262 | char **string) |