diff mbox

sparse: ignore indirect_branch attribute

Message ID c97d360f-a0d2-8c0d-b951-e064843ff4d8@infradead.org (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Randy Dunlap Feb. 13, 2018, 9:52 p.m. UTC
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(+)



--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Luc Van Oostenryck Feb. 13, 2018, 10:12 p.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck Feb. 15, 2018, 8:42 p.m. UTC | #2
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
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- 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)