Linux SPARSE checker discussions
 help / color / mirror / Atom feed
* [PATCH] sparse: ignore indirect_branch attribute
@ 2018-02-13 21:52 Randy Dunlap
  2018-02-13 22:12 ` Luc Van Oostenryck
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2018-02-13 21:52 UTC (permalink / raw)
  To: Linux-Sparse, Christopher Li, Linus Torvalds

From: Randy Dunlap <rdunlap@infradead.org>

Teach sparse about the "indirect_branch" attribute as used in
Linux kernel:
#define __noretpoline __attribute__((indirect_branch("keep")))
and tell sparse to ignore it.

This eliminates over 148K warnings (which also cause the
0day bot to send error reports uselessly).

Or does sparse need to do something with it?

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
 gcc-attr-list.h |    1 +
 1 file changed, 1 insertion(+)

--- sparse-2018-02-13.orig/gcc-attr-list.h
+++ sparse-2018-02-13/gcc-attr-list.h
@@ -62,6 +62,7 @@ GCC_ATTR(hidden)
 GCC_ATTR(hot)
 GCC_ATTR(hotpatch)
 GCC_ATTR(ifunc)
+GCC_ATTR(indirect_branch)
 GCC_ATTR(init_priority)
 GCC_ATTR(interfacearm)
 GCC_ATTR(internal)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sparse: ignore indirect_branch attribute
  2018-02-13 21:52 [PATCH] sparse: ignore indirect_branch attribute Randy Dunlap
@ 2018-02-13 22:12 ` Luc Van Oostenryck
  2018-02-15 20:42   ` Luc Van Oostenryck
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2018-02-13 22:12 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Linux-Sparse, Christopher Li, Linus Torvalds

On Tue, Feb 13, 2018 at 01:52:54PM -0800, Randy Dunlap wrote:
> From: Randy Dunlap <rdunlap@infradead.org>
> 
> Teach sparse about the "indirect_branch" attribute as used in
> Linux kernel:
> #define __noretpoline __attribute__((indirect_branch("keep")))
> and tell sparse to ignore it.
> 
> This eliminates over 148K warnings (which also cause the
> 0day bot to send error reports uselessly).

Sigh.
I think that these unknown attribute warnings are useless
in general and even more so for the kernel. The kernel should
have "-Wno-unknown-attribute" in its CHECKFLAGS.
 
> Or does sparse need to do something with it?

No, it's the only thing needed. Thanks.

I've applied it in my dev tree and will push it in a few
days to the stable tree where I collect all pending changes:
	git://github.com/lucvoo/sparse.git

-- Luc

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sparse: ignore indirect_branch attribute
  2018-02-13 22:12 ` Luc Van Oostenryck
@ 2018-02-15 20:42   ` Luc Van Oostenryck
  0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2018-02-15 20:42 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Linux-Sparse

On Tue, Feb 13, 2018 at 11:12:47PM +0100, Luc Van Oostenryck wrote:
> On Tue, Feb 13, 2018 at 01:52:54PM -0800, Randy Dunlap wrote:
> > From: Randy Dunlap <rdunlap@infradead.org>
> > 
> > Teach sparse about the "indirect_branch" attribute as used in
> > Linux kernel:
> > #define __noretpoline __attribute__((indirect_branch("keep")))
> > and tell sparse to ignore it.
> > 
> > This eliminates over 148K warnings (which also cause the
> > 0day bot to send error reports uselessly).

FWIW, I've pushed this to my stable tree:
	https://github.com/lucvoo/sparse 
	git://github.com/lucvoo/sparse.git
together with a patch making '-Wunknown-attribute' off by default.

-- Luc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-15 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-13 21:52 [PATCH] sparse: ignore indirect_branch attribute Randy Dunlap
2018-02-13 22:12 ` Luc Van Oostenryck
2018-02-15 20:42   ` Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox