Received: from list by lists.gnu.org with archive (Exim 4.71) id 1hEVmx-0003cy-O3 for mharc-grub-devel@gnu.org; Thu, 11 Apr 2019 05:14:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEVmt-0003aE-IE for grub-devel@gnu.org; Thu, 11 Apr 2019 05:14:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEVms-0001JF-Cb for grub-devel@gnu.org; Thu, 11 Apr 2019 05:14:27 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:41406) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hEVms-0001HS-11 for grub-devel@gnu.org; Thu, 11 Apr 2019 05:14:26 -0400 Received: from mercury.suse.de (prva10-snat226-2.provo.novell.com [137.65.226.36]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Thu, 11 Apr 2019 03:14:13 -0600 From: Michael Chang To: grub-devel@gnu.org Subject: [PATCH v2 2/8] jfs: disable gcc9 -Waddress-of-packed-member Date: Thu, 11 Apr 2019 17:14:03 +0800 Message-Id: <20190411091409.17129-3-mchang@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190411091409.17129-1-mchang@suse.com> References: <20190411091409.17129-1-mchang@suse.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.81 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2019 09:14:28 -0000 Disable the -Wadress-of-packaed-member diagnostic for the grub_jfs_getent function since the result is found to be false postive. The leaf is read into memory as continous chunks in size of 32 bytes and the pointer to its base is aligned, which also guarentee its member leaf->namepart is aligned. [ 60s] ../grub-core/fs/jfs.c: In function 'grub_jfs_getent': [ 60s] ../grub-core/fs/jfs.c:557:44: error: taking address of packed member of 'struct grub_jfs_leaf_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member] [ 60s] 557 | le_to_cpu16_copy (filename + strpos, leaf->namepart, len < diro->data->namecomponentlen ? len [ 60s] | ~~~~^~~~~~~~~~ [ 60s] ../grub-core/fs/jfs.c:570:48: error: taking address of packed member of 'struct grub_jfs_leaf_next_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member] [ 60s] 570 | le_to_cpu16_copy (filename + strpos, next_leaf->namepart, len < 15 ? len : 15); [ 60s] | ~~~~~~~~~^~~~~~~~~~ [ 60s] cc1: all warnings being treated as errors Signed-off-by: Michael Chang --- grub-core/fs/jfs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c index 09bc5608d..d5a6d6527 100644 --- a/grub-core/fs/jfs.c +++ b/grub-core/fs/jfs.c @@ -505,6 +505,10 @@ le_to_cpu16_copy (grub_uint16_t *out, grub_uint16_t *in, grub_size_t len) *out++ = grub_le_to_cpu16 (*in++); } +#if __GNUC__ >= 9 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" +#endif /* Read in the next dirent from the directory described by DIRO. */ static grub_err_t @@ -582,6 +586,9 @@ grub_jfs_getent (struct grub_jfs_diropen *diro) return 0; } +#if __GNUC__ >= 9 +#pragma GCC diagnostic pop +#endif /* Read LEN bytes from the file described by DATA starting with byte POS. Return the amount of read bytes in READ. */ -- 2.16.4