linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/exofs: Remove ignored __weak attribute
@ 2018-09-30 20:51 Nathan Chancellor
  2018-10-01 22:47 ` Nick Desaulniers
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nathan Chancellor @ 2018-09-30 20:51 UTC (permalink / raw)
  To: Boaz Harrosh, Andrew Morton
  Cc: linux-kernel, Nick Desaulniers, Nathan Chancellor

Clang warns that the __weak attribute is going to be ignored on
g_attr_inode_data because it's not in the correct location (needs to be
after the type).

In file included from fs/exofs/dir.c:35:
In file included from fs/exofs/exofs.h:41:
fs/exofs/common.h:186:21: warning: 'weak' attribute only applies to
variables, functions, and classes [-Wignored-attributes]
static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
                    ^

Turns out that GCC ignores the attribute too albeit silently because
moving the attribute after either osd_attr or g_attr_inode_data like
all other uses of __weak on variables in the kernel causes a build
error on both GCC and Clang because static variables cannot be weak
since weak definitions rely on not having internal linkage:

In file included from fs/exofs/namei.c:34:
In file included from fs/exofs/exofs.h:41:
fs/exofs/common.h:186:30: error: weak declaration cannot have internal
linkage
static const struct osd_attr __weak g_attr_inode_data = ATTR_DEF(
                             ^

Just remove the attribute because it hasn't been correct since the
initial addition of this file in commit b14f8ab28449 ("exofs: Kbuild,
Headers and osd utils").

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 fs/exofs/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exofs/common.h b/fs/exofs/common.h
index 7d88ef566213..45da96a1528d 100644
--- a/fs/exofs/common.h
+++ b/fs/exofs/common.h
@@ -183,7 +183,7 @@ struct exofs_fcb {
 #define EXOFS_INO_ATTR_SIZE	sizeof(struct exofs_fcb)
 
 /* This is the Attribute the fcb is stored in */
-static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
+static const struct osd_attr g_attr_inode_data = ATTR_DEF(
 	EXOFS_APAGE_FS_DATA,
 	EXOFS_ATTR_INODE_DATA,
 	EXOFS_INO_ATTR_SIZE);
-- 
2.19.0


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

* Re: [PATCH] fs/exofs: Remove ignored __weak attribute
  2018-09-30 20:51 [PATCH] fs/exofs: Remove ignored __weak attribute Nathan Chancellor
@ 2018-10-01 22:47 ` Nick Desaulniers
  2018-10-02 16:50 ` Boaz Harrosh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2018-10-01 22:47 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: ooo, Andrew Morton, LKML

On Sun, Sep 30, 2018 at 1:51 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns that the __weak attribute is going to be ignored on
> g_attr_inode_data because it's not in the correct location (needs to be
> after the type).
>
> In file included from fs/exofs/dir.c:35:
> In file included from fs/exofs/exofs.h:41:
> fs/exofs/common.h:186:21: warning: 'weak' attribute only applies to
> variables, functions, and classes [-Wignored-attributes]
> static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
>                     ^
>
> Turns out that GCC ignores the attribute too albeit silently because
> moving the attribute after either osd_attr or g_attr_inode_data like
> all other uses of __weak on variables in the kernel causes a build
> error on both GCC and Clang because static variables cannot be weak
> since weak definitions rely on not having internal linkage:
>
> In file included from fs/exofs/namei.c:34:
> In file included from fs/exofs/exofs.h:41:
> fs/exofs/common.h:186:30: error: weak declaration cannot have internal
> linkage
> static const struct osd_attr __weak g_attr_inode_data = ATTR_DEF(
>                              ^
>
> Just remove the attribute because it hasn't been correct since the
> initial addition of this file in commit b14f8ab28449 ("exofs: Kbuild,
> Headers and osd utils").
>
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  fs/exofs/common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/exofs/common.h b/fs/exofs/common.h
> index 7d88ef566213..45da96a1528d 100644
> --- a/fs/exofs/common.h
> +++ b/fs/exofs/common.h
> @@ -183,7 +183,7 @@ struct exofs_fcb {
>  #define EXOFS_INO_ATTR_SIZE    sizeof(struct exofs_fcb)
>
>  /* This is the Attribute the fcb is stored in */
> -static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
> +static const struct osd_attr g_attr_inode_data = ATTR_DEF(
>         EXOFS_APAGE_FS_DATA,
>         EXOFS_ATTR_INODE_DATA,
>         EXOFS_INO_ATTR_SIZE);
> --
> 2.19.0
>

LGTM, thank you for sending, Nathan.

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] fs/exofs: Remove ignored __weak attribute
  2018-09-30 20:51 [PATCH] fs/exofs: Remove ignored __weak attribute Nathan Chancellor
  2018-10-01 22:47 ` Nick Desaulniers
@ 2018-10-02 16:50 ` Boaz Harrosh
  2018-10-25 21:19 ` Nathan Chancellor
  2019-01-26  6:42 ` [PATCH RESEND] " Nathan Chancellor
  3 siblings, 0 replies; 5+ messages in thread
From: Boaz Harrosh @ 2018-10-02 16:50 UTC (permalink / raw)
  To: Nathan Chancellor, Andrew Morton; +Cc: linux-kernel, Nick Desaulniers

On 30/09/18 23:51, Nathan Chancellor wrote:
> Clang warns that the __weak attribute is going to be ignored on
> g_attr_inode_data because it's not in the correct location (needs to be
> after the type).
> 
> In file included from fs/exofs/dir.c:35:
> In file included from fs/exofs/exofs.h:41:
> fs/exofs/common.h:186:21: warning: 'weak' attribute only applies to
> variables, functions, and classes [-Wignored-attributes]
> static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
>                     ^
> 
> Turns out that GCC ignores the attribute too albeit silently because
> moving the attribute after either osd_attr or g_attr_inode_data like
> all other uses of __weak on variables in the kernel causes a build
> error on both GCC and Clang because static variables cannot be weak
> since weak definitions rely on not having internal linkage:
> 
> In file included from fs/exofs/namei.c:34:
> In file included from fs/exofs/exofs.h:41:
> fs/exofs/common.h:186:30: error: weak declaration cannot have internal
> linkage
> static const struct osd_attr __weak g_attr_inode_data = ATTR_DEF(
>                              ^
> 
> Just remove the attribute because it hasn't been correct since the
> initial addition of this file in commit b14f8ab28449 ("exofs: Kbuild,
> Headers and osd utils").
> 
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

ACK-by: Boaz Harrosh <ooo@electrozaur.com>

Yes! thanks
Boaz

> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  fs/exofs/common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/exofs/common.h b/fs/exofs/common.h
> index 7d88ef566213..45da96a1528d 100644
> --- a/fs/exofs/common.h
> +++ b/fs/exofs/common.h
> @@ -183,7 +183,7 @@ struct exofs_fcb {
>  #define EXOFS_INO_ATTR_SIZE	sizeof(struct exofs_fcb)
>  
>  /* This is the Attribute the fcb is stored in */
> -static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
> +static const struct osd_attr g_attr_inode_data = ATTR_DEF(
>  	EXOFS_APAGE_FS_DATA,
>  	EXOFS_ATTR_INODE_DATA,
>  	EXOFS_INO_ATTR_SIZE);
> 


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

* Re: [PATCH] fs/exofs: Remove ignored __weak attribute
  2018-09-30 20:51 [PATCH] fs/exofs: Remove ignored __weak attribute Nathan Chancellor
  2018-10-01 22:47 ` Nick Desaulniers
  2018-10-02 16:50 ` Boaz Harrosh
@ 2018-10-25 21:19 ` Nathan Chancellor
  2019-01-26  6:42 ` [PATCH RESEND] " Nathan Chancellor
  3 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2018-10-25 21:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Nick Desaulniers, Boaz Harrosh

On Sun, Sep 30, 2018 at 01:51:26PM -0700, Nathan Chancellor wrote:
> Clang warns that the __weak attribute is going to be ignored on
> g_attr_inode_data because it's not in the correct location (needs to be
> after the type).
> 
> In file included from fs/exofs/dir.c:35:
> In file included from fs/exofs/exofs.h:41:
> fs/exofs/common.h:186:21: warning: 'weak' attribute only applies to
> variables, functions, and classes [-Wignored-attributes]
> static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
>                     ^
> 
> Turns out that GCC ignores the attribute too albeit silently because
> moving the attribute after either osd_attr or g_attr_inode_data like
> all other uses of __weak on variables in the kernel causes a build
> error on both GCC and Clang because static variables cannot be weak
> since weak definitions rely on not having internal linkage:
> 
> In file included from fs/exofs/namei.c:34:
> In file included from fs/exofs/exofs.h:41:
> fs/exofs/common.h:186:30: error: weak declaration cannot have internal
> linkage
> static const struct osd_attr __weak g_attr_inode_data = ATTR_DEF(
>                              ^
> 
> Just remove the attribute because it hasn't been correct since the
> initial addition of this file in commit b14f8ab28449 ("exofs: Kbuild,
> Headers and osd utils").
> 
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  fs/exofs/common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/exofs/common.h b/fs/exofs/common.h
> index 7d88ef566213..45da96a1528d 100644
> --- a/fs/exofs/common.h
> +++ b/fs/exofs/common.h
> @@ -183,7 +183,7 @@ struct exofs_fcb {
>  #define EXOFS_INO_ATTR_SIZE	sizeof(struct exofs_fcb)
>  
>  /* This is the Attribute the fcb is stored in */
> -static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
> +static const struct osd_attr g_attr_inode_data = ATTR_DEF(
>  	EXOFS_APAGE_FS_DATA,
>  	EXOFS_ATTR_INODE_DATA,
>  	EXOFS_INO_ATTR_SIZE);
> -- 
> 2.19.0
> 

Hi Andrew,

Can you take this with Boaz's ack?

Thanks,
Nathan

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

* [PATCH RESEND] fs/exofs: Remove ignored __weak attribute
  2018-09-30 20:51 [PATCH] fs/exofs: Remove ignored __weak attribute Nathan Chancellor
                   ` (2 preceding siblings ...)
  2018-10-25 21:19 ` Nathan Chancellor
@ 2019-01-26  6:42 ` Nathan Chancellor
  3 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2019-01-26  6:42 UTC (permalink / raw)
  To: Boaz Harrosh, Andrew Morton, linux-kernel
  Cc: Nathan Chancellor, Nick Desaulniers

Clang warns that the __weak attribute is going to be ignored on
g_attr_inode_data because it's not in the correct location (needs to be
after the type).

In file included from fs/exofs/dir.c:35:
In file included from fs/exofs/exofs.h:41:
fs/exofs/common.h:186:21: warning: 'weak' attribute only applies to
variables, functions, and classes [-Wignored-attributes]
static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
                    ^

Turns out that GCC ignores the attribute too albeit silently because
moving the attribute after either osd_attr or g_attr_inode_data like
all other uses of __weak on variables in the kernel causes a build
error on both GCC and Clang because static variables cannot be weak
since weak definitions rely on not having internal linkage:

In file included from fs/exofs/namei.c:34:
In file included from fs/exofs/exofs.h:41:
fs/exofs/common.h:186:30: error: weak declaration cannot have internal
linkage
static const struct osd_attr __weak g_attr_inode_data = ATTR_DEF(
                             ^

Just remove the attribute because it hasn't been correct since the
initial addition of this file in commit b14f8ab28449 ("exofs: Kbuild,
Headers and osd utils").

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Boaz Harrosh <ooo@electrozaur.com>
---

Andrew, could you please pick this up? This warning is rather noisy when
doing allyesconfig builds.

 fs/exofs/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exofs/common.h b/fs/exofs/common.h
index 7d88ef566213..45da96a1528d 100644
--- a/fs/exofs/common.h
+++ b/fs/exofs/common.h
@@ -183,7 +183,7 @@ struct exofs_fcb {
 #define EXOFS_INO_ATTR_SIZE	sizeof(struct exofs_fcb)
 
 /* This is the Attribute the fcb is stored in */
-static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
+static const struct osd_attr g_attr_inode_data = ATTR_DEF(
 	EXOFS_APAGE_FS_DATA,
 	EXOFS_ATTR_INODE_DATA,
 	EXOFS_INO_ATTR_SIZE);
-- 
2.20.1


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

end of thread, other threads:[~2019-01-26  6:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-30 20:51 [PATCH] fs/exofs: Remove ignored __weak attribute Nathan Chancellor
2018-10-01 22:47 ` Nick Desaulniers
2018-10-02 16:50 ` Boaz Harrosh
2018-10-25 21:19 ` Nathan Chancellor
2019-01-26  6:42 ` [PATCH RESEND] " Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).