Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571773 > unrolled thread

[PATCH] modules: mark __inittest/__exittest as __maybe_unused

Started byArnd Bergmann <arnd@arndb.de>
First post2017-02-01 18:10 +0100
Last post2017-02-07 02:00 +0100
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] modules: mark __inittest/__exittest as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2017-02-01 18:10 +0100
    Re: [PATCH] modules: mark __inittest/__exittest as __maybe_unused Rusty Russell <rusty@rustcorp.com.au> - 2017-02-02 10:30 +0100
      Re: [PATCH] modules: mark __inittest/__exittest as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2017-02-02 11:20 +0100
        Re: [PATCH] modules: mark __inittest/__exittest as __maybe_unused Rusty Russell <rusty@rustcorp.com.au> - 2017-02-02 20:20 +0100
    Re: [PATCH] modules: mark __inittest/__exittest as __maybe_unused Miroslav Benes <mbenes@suse.cz> - 2017-02-02 20:50 +0100
    Re: modules: mark __inittest/__exittest as __maybe_unused Jessica Yu <jeyu@redhat.com> - 2017-02-07 02:00 +0100

#1571773 — [PATCH] modules: mark __inittest/__exittest as __maybe_unused

FromArnd Bergmann <arnd@arndb.de>
Date2017-02-01 18:10 +0100
Subject[PATCH] modules: mark __inittest/__exittest as __maybe_unused
Message-ID<t66zU-fo-27@gated-at.bofh.it>
clang warns about unused inline functions by default:

arch/arm/crypto/aes-cipher-glue.c:68:1: warning: unused function '__inittest' [-Wunused-function]
arch/arm/crypto/aes-cipher-glue.c:69:1: warning: unused function '__exittest' [-Wunused-function]

As these appear in every single module, let's just disable the warnings by marking the
two functions as __maybe_unused.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/module.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 38b4b2c754c8..48a5c57c858e 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -126,13 +126,13 @@ extern void cleanup_module(void);
 
 /* Each module must use one module_init(). */
 #define module_init(initfn)					\
-	static inline initcall_t __inittest(void)		\
+	static inline initcall_t __maybe_unused __inittest(void)		\
 	{ return initfn; }					\
 	int init_module(void) __attribute__((alias(#initfn)));
 
 /* This is only required if you want to be unloadable. */
 #define module_exit(exitfn)					\
-	static inline exitcall_t __exittest(void)		\
+	static inline exitcall_t __maybe_unused __exittest(void)		\
 	{ return exitfn; }					\
 	void cleanup_module(void) __attribute__((alias(#exitfn)));
 
-- 
2.9.0

[toc] | [next] | [standalone]


#1572214

FromRusty Russell <rusty@rustcorp.com.au>
Date2017-02-02 10:30 +0100
Message-ID<t6lSi-1ZO-13@gated-at.bofh.it>
In reply to#1571773
Arnd Bergmann <arnd@arndb.de> writes:
> clang warns about unused inline functions by default:
>
> arch/arm/crypto/aes-cipher-glue.c:68:1: warning: unused function '__inittest' [-Wunused-function]
> arch/arm/crypto/aes-cipher-glue.c:69:1: warning: unused function '__exittest' [-Wunused-function]
>
> As these appear in every single module, let's just disable the warnings by marking the
> two functions as __maybe_unused.

Um, won't you have to do that to hundreds of kernel headers?  Why
module.h?

Confused,
Rusty.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  include/linux/module.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 38b4b2c754c8..48a5c57c858e 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -126,13 +126,13 @@ extern void cleanup_module(void);
>  
>  /* Each module must use one module_init(). */
>  #define module_init(initfn)					\
> -	static inline initcall_t __inittest(void)		\
> +	static inline initcall_t __maybe_unused __inittest(void)		\
>  	{ return initfn; }					\
>  	int init_module(void) __attribute__((alias(#initfn)));
>  
>  /* This is only required if you want to be unloadable. */
>  #define module_exit(exitfn)					\
> -	static inline exitcall_t __exittest(void)		\
> +	static inline exitcall_t __maybe_unused __exittest(void)		\
>  	{ return exitfn; }					\
>  	void cleanup_module(void) __attribute__((alias(#exitfn)));
>  
> -- 
> 2.9.0

[toc] | [prev] | [next] | [standalone]


#1572251

FromArnd Bergmann <arnd@arndb.de>
Date2017-02-02 11:20 +0100
Message-ID<t6mEG-2zZ-23@gated-at.bofh.it>
In reply to#1572214
On Thu, Feb 2, 2017 at 10:25 AM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
>> clang warns about unused inline functions by default:
>>
>> arch/arm/crypto/aes-cipher-glue.c:68:1: warning: unused function '__inittest' [-Wunused-function]
>> arch/arm/crypto/aes-cipher-glue.c:69:1: warning: unused function '__exittest' [-Wunused-function]
>>
>> As these appear in every single module, let's just disable the warnings by marking the
>> two functions as __maybe_unused.
>
> Um, won't you have to do that to hundreds of kernel headers?  Why
> module.h?

clang specifically warns about inline functions that are defined in a
.c file but not used
there, but it is sensible enough to not warn about unused inline
functions that are defined
in a header.

In an ARM allmodconfig build, I currently see 178 .c files[1] that
have unused inline functions.
The proper way to deal with them is probably to move the warning into
the "make W=1"
level to hide it by default and then do one driver at a time.

The module.h definitions are special because the inline function is
defined through a
macro that gets evaluated by almost every loadable module, and we get
a warning for
every one of them, which the subsystem maintainers cannot deal with by
changing their
code locally.

    Arnd

[1] http://pastebin.com/pnHvbHQ3

[toc] | [prev] | [next] | [standalone]


#1572688

FromRusty Russell <rusty@rustcorp.com.au>
Date2017-02-02 20:20 +0100
Message-ID<t6v5g-85X-3@gated-at.bofh.it>
In reply to#1572251
Arnd Bergmann <arnd@arndb.de> writes:
> On Thu, Feb 2, 2017 at 10:25 AM, Rusty Russell <rusty@rustcorp.com.au> wrote:
>> Arnd Bergmann <arnd@arndb.de> writes:
>>> clang warns about unused inline functions by default:
>>>
>>> arch/arm/crypto/aes-cipher-glue.c:68:1: warning: unused function '__inittest' [-Wunused-function]
>>> arch/arm/crypto/aes-cipher-glue.c:69:1: warning: unused function '__exittest' [-Wunused-function]
>>>
>>> As these appear in every single module, let's just disable the warnings by marking the
>>> two functions as __maybe_unused.
>>
>> Um, won't you have to do that to hundreds of kernel headers?  Why
>> module.h?
>
> clang specifically warns about inline functions that are defined in a
> .c file but not used
> there, but it is sensible enough to not warn about unused inline
> functions that are defined
> in a header.

Ah, I was confused because you patched the header :)

> The module.h definitions are special because the inline function is
> defined through a
> macro that gets evaluated by almost every loadable module, and we get
> a warning for
> every one of them, which the subsystem maintainers cannot deal with by
> changing their
> code locally.

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Thanks,
Rusty.

[toc] | [prev] | [next] | [standalone]


#1572708

FromMiroslav Benes <mbenes@suse.cz>
Date2017-02-02 20:50 +0100
Message-ID<t6vyi-8gz-21@gated-at.bofh.it>
In reply to#1571773
On Wed, 1 Feb 2017, Arnd Bergmann wrote:

> clang warns about unused inline functions by default:
> 
> arch/arm/crypto/aes-cipher-glue.c:68:1: warning: unused function '__inittest' [-Wunused-function]
> arch/arm/crypto/aes-cipher-glue.c:69:1: warning: unused function '__exittest' [-Wunused-function]
> 
> As these appear in every single module, let's just disable the warnings by marking the
> two functions as __maybe_unused.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Makes sense.

Reviewed-by: Miroslav Benes <mbenes@suse.cz>

Regards,
Miroslav

[toc] | [prev] | [next] | [standalone]


#1575294 — Re: modules: mark __inittest/__exittest as __maybe_unused

FromJessica Yu <jeyu@redhat.com>
Date2017-02-07 02:00 +0100
SubjectRe: modules: mark __inittest/__exittest as __maybe_unused
Message-ID<t82it-3XP-11@gated-at.bofh.it>
In reply to#1571773
+++ Arnd Bergmann [01/02/17 18:00 +0100]:
>clang warns about unused inline functions by default:
>
>arch/arm/crypto/aes-cipher-glue.c:68:1: warning: unused function '__inittest' [-Wunused-function]
>arch/arm/crypto/aes-cipher-glue.c:69:1: warning: unused function '__exittest' [-Wunused-function]
>
>As these appear in every single module, let's just disable the warnings by marking the
>two functions as __maybe_unused.
>
>Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thanks.

Jessica

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web