identify: Fix gcc9 unaligned warning.

Warning: taking address of packed member of 'struct spdk_nvme_health_information_page'
and 'spdk_nvme_ctrlr_data' may result in an unaligned pointer value [-Waddress-of-packed-member]

So add __attribute__((aligned)) following with  __attribute__((packed)) to avoid this kind of
GCC9 warning.

This related to issue #822.

Change-Id: I6117c1e50a137d29cd60ebbad5c15d9093d21670
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458535
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
yidong0635 2019-06-19 06:00:13 -04:00 committed by Ben Walker
parent 1750a0859b
commit 98cc02fd05

View File

@ -935,7 +935,7 @@ enum spdk_nvme_flush_broadcast {
SPDK_NVME_FLUSH_BROADCAST_SUPPORTED = 3
};
struct __attribute__((packed)) spdk_nvme_ctrlr_data {
struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data {
/* bytes 0-255: controller capabilities and features */
/** pci vendor id */
@ -1853,7 +1853,7 @@ SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_critical_warning_state) == 1, "Incorre
/**
* SMART / health information page (\ref SPDK_NVME_LOG_HEALTH_INFORMATION)
*/
struct __attribute__((packed)) spdk_nvme_health_information_page {
struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_health_information_page {
union spdk_nvme_critical_warning_state critical_warning;
uint16_t temperature;