Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly allowing specific initializer overrides #639

Open
nathanchance opened this issue Aug 14, 2019 · 3 comments
Open

Explicitly allowing specific initializer overrides #639

nathanchance opened this issue Aug 14, 2019 · 3 comments
Labels
feature-request Not a bug per-se

Comments

@nathanchance
Copy link
Member

-Winitializer-overrides/-Woverride-init tends to get disabled because it is seen as noisy:

https://lore.kernel.org/lkml/20190806193434.965-1-cai@lca.pw/

https://lore.kernel.org/lkml/20190807105307.GB54191@lakrids.cambridge.arm.com/

Mark Rutland requested some attribute or intrinsic that would make it clear to the developer and clang that an override was intended so that the warning could be silenced on a per-assignment basis; this would allow a range initializer to be used but individual members could be selectively overridden.

See his email for more information:

https://lore.kernel.org/lkml/20190809083251.GA48423@lakrids.cambridge.arm.com/

This issue is to gather initial feedback into how possible/feasible this is then file an LLVM bug.

@nathanchance nathanchance added the enhancement New feature or request label Aug 14, 2019
@nickdesaulniers
Copy link
Member

nickdesaulniers commented Aug 27, 2019

fengguang pushed a commit to 0day-ci/linux that referenced this issue Aug 29, 2019
When compiling a kernel with W=1, there are several of those warnings
due to arm64 override a field by purpose. Just disable those warnings
for both GCC and Clang of this file, so it will help dig "gems" hidden
in the W=1 warnings by reducing some noises.

mm/init-mm.c:39:2: warning: initializer overrides prior initialization
of this subobject [-Winitializer-overrides]
        INIT_MM_CONTEXT(init_mm)
        ^~~~~~~~~~~~~~~~~~~~~~~~
./arch/arm64/include/asm/mmu.h:133:9: note: expanded from macro
'INIT_MM_CONTEXT'
        .pgd = init_pg_dir,
               ^~~~~~~~~~~
mm/init-mm.c:30:10: note: previous initialization is here
        .pgd            = swapper_pg_dir,
                          ^~~~~~~~~~~~~~

Note: there is a side project trying to support explicitly allowing
specific initializer overrides in Clang, but there is no guarantee it
will happen or not.

ClangBuiltLinux#639

Signed-off-by: Qian Cai <cai@lca.pw>
rgushchin pushed a commit to rgushchin/linux that referenced this issue Sep 5, 2019
When compiling a kernel with W=1, there are several of those warnings due
to arm64 overriding a field on purpose.  Just disable those warnings for
both GCC and Clang of this file, so it will help dig "gems" hidden in the
W=1 warnings by reducing some noises.

mm/init-mm.c:39:2: warning: initializer overrides prior initialization
of this subobject [-Winitializer-overrides]
        INIT_MM_CONTEXT(init_mm)
        ^~~~~~~~~~~~~~~~~~~~~~~~
./arch/arm64/include/asm/mmu.h:133:9: note: expanded from macro
'INIT_MM_CONTEXT'
        .pgd = init_pg_dir,
               ^~~~~~~~~~~
mm/init-mm.c:30:10: note: previous initialization is here
        .pgd            = swapper_pg_dir,
                          ^~~~~~~~~~~~~~

Note: there is a side project trying to support explicitly allowing
specific initializer overrides in Clang, but there is no guarantee it
will happen or not.

ClangBuiltLinux#639

Link: http://lkml.kernel.org/r/1566920867-27453-1-git-send-email-cai@lca.pw
Signed-off-by: Qian Cai <cai@lca.pw>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fengguang pushed a commit to 0day-ci/linux that referenced this issue Sep 24, 2019
When compiling a kernel with W=1, there are several of those warnings due
to arm64 overriding a field on purpose.  Just disable those warnings for
both GCC and Clang of this file, so it will help dig "gems" hidden in the
W=1 warnings by reducing some noises.

mm/init-mm.c:39:2: warning: initializer overrides prior initialization
of this subobject [-Winitializer-overrides]
        INIT_MM_CONTEXT(init_mm)
        ^~~~~~~~~~~~~~~~~~~~~~~~
./arch/arm64/include/asm/mmu.h:133:9: note: expanded from macro
'INIT_MM_CONTEXT'
        .pgd = init_pg_dir,
               ^~~~~~~~~~~
mm/init-mm.c:30:10: note: previous initialization is here
        .pgd            = swapper_pg_dir,
                          ^~~~~~~~~~~~~~

Note: there is a side project trying to support explicitly allowing
specific initializer overrides in Clang, but there is no guarantee it
will happen or not.

ClangBuiltLinux#639

Link: http://lkml.kernel.org/r/1566920867-27453-1-git-send-email-cai@lca.pw
Signed-off-by: Qian Cai <cai@lca.pw>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
torvalds pushed a commit to torvalds/linux that referenced this issue Sep 25, 2019
When compiling a kernel with W=1, there are several of those warnings due
to arm64 overriding a field on purpose.  Just disable those warnings for
both GCC and Clang of this file, so it will help dig "gems" hidden in the
W=1 warnings by reducing some noises.

mm/init-mm.c:39:2: warning: initializer overrides prior initialization
of this subobject [-Winitializer-overrides]
        INIT_MM_CONTEXT(init_mm)
        ^~~~~~~~~~~~~~~~~~~~~~~~
./arch/arm64/include/asm/mmu.h:133:9: note: expanded from macro
'INIT_MM_CONTEXT'
        .pgd = init_pg_dir,
               ^~~~~~~~~~~
mm/init-mm.c:30:10: note: previous initialization is here
        .pgd            = swapper_pg_dir,
                          ^~~~~~~~~~~~~~

Note: there is a side project trying to support explicitly allowing
specific initializer overrides in Clang, but there is no guarantee it
will happen or not.

ClangBuiltLinux#639

Link: http://lkml.kernel.org/r/1566920867-27453-1-git-send-email-cai@lca.pw
Signed-off-by: Qian Cai <cai@lca.pw>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
@nickdesaulniers nickdesaulniers added feature-request Not a bug per-se and removed enhancement New feature or request labels Sep 25, 2019
@nickdesaulniers
Copy link
Member

b57a775 landed in 5.4

@arndb
Copy link

arndb commented Feb 15, 2021

There are only a handful such warnings that remain in the kernel, in particular for drivers/ide. Need to rebase an old patch of mine to turn that off as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Not a bug per-se
Projects
None yet
Development

No branches or pull requests

3 participants