[PATCH] libata: shut up -Woverride-init warning
From: Arnd Bergmann
Date: Wed Jun 08 2016 - 04:41:06 EST
In general, the -Woverride-init is helpful to catch bugs with drivers that
unintentially initialize the same field in a structure more than once.
In case of libata, it conflicts with the intended use of the ATA_BASE_SHT()
macro, causing warnings about code that works as designed:
drivers/ata/ahci.c:107:555: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci.c:107:685: error: initialized field overwritten [-Werror=override-init]
drivers/ata/acard-ahci.c:86:567: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_platform.c:37:555: error: initialized field overwritten [-Werror=override-init]
drivers/ata/sata_sil24.c:388:15: error: initialized field overwritten [-Werror=override-init]
drivers/ata/sata_highbank.c:456:573: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_brcmstb.c:282:565: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_ceva.c:162:565: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_imx.c:526:563: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_mvebu.c:98:567: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_sunxi.c:175:567: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_st.c:145:561: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_tegra.c:295:567: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_xgene.c:731:567: error: initialized field overwritten [-Werror=override-init]
drivers/ata/ahci_qoriq.c:148:567: error: initialized field overwritten [-Werror=override-init]
drivers/ata/sata_mv.c:683:15: error: initialized field overwritten [-Werror=override-init]
drivers/ata/sata_nv.c:395:15: error: initialized field overwritten [-Werror=override-init]
drivers/ata/sata_nv.c:398:21: error: initialized field overwritten [-Werror=override-init]
drivers/ata/sata_nv.c:403:15: error: initialized field overwritten [-Werror=override-init]
drivers/ata/sata_nv.c:406:21: error: initialized field overwritten [-Werror=override-init]
drivers/ata/pata_atiixp.c:254:18: error: initialized field overwritten [-Werror=override-init]
drivers/ata/pata_cs5520.c:107:18: error: initialized field overwritten [-Werror=override-init]
drivers/ata/pata_sc1200.c:210:18: error: initialized field overwritten [-Werror=override-init]
drivers/ata/pata_serverworks.c:256:18: error: initialized field overwritten [-Werror=override-init]
This adds a #pragma GCC diagnostic ignored "-Woverride-init" next to the
definition to let gcc know that it shouldn't warn about duplicate initializers
in files that include this header.
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0e8a8000b45f..038b1ee7485f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1342,6 +1342,7 @@ extern struct device_attribute *ata_common_sdev_attrs[];
* edge driver's module reference, otherwise the driver can be unloaded
* even if the scsi_device is being accessed.
*/
+#pragma GCC diagnostic ignored "-Woverride-init"
#define ATA_BASE_SHT(drv_name) \
.module = THIS_MODULE, \
.name = drv_name, \