[PATCH] procfs: disable -Woverride-init warning

From: Arnd Bergmann
Date: Wed Jun 08 2016 - 07:44:51 EST


This warning finds some actual bugs, but the usage in procfs is intended,
so we get a false positive output many lines like:

fs/proc/task_mmu.c: In function 'show_smap_vma_flags':
fs/proc/task_mmu.c:629:2403: error: initialized field overwritten [-Werror=override-init]
fs/proc/task_mmu.c:629:2403: note: (near initialization for 'mnemonics[0]')
fs/proc/task_mmu.c:630:2403: error: initialized field overwritten [-Werror=override-init]
fs/proc/task_mmu.c:630:2403: note: (near initialization for 'mnemonics[1]')
fs/proc/task_mmu.c:631:2403: error: initialized field overwritten [-Werror=override-init]
fs/proc/task_mmu.c:631:2403: note: (near initialization for 'mnemonics[2]')

This uses a #pragma to turn off the warning, as a preparation for
eventually enabling the gcc flag by default for the kernel.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index ee3efb229ef6..661dca5a0042 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -616,6 +616,7 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
return 0;
}

+#pragma GCC diagnostic ignored "-Woverride-init"
static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
{
/*
@@ -682,6 +683,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
}
seq_putc(m, '\n');
}
+#pragma GCC diagnostic warning "-Woverride-init"

#ifdef CONFIG_HUGETLB_PAGE
static int smaps_hugetlb_range(pte_t *pte, unsigned long hmask,