fs/exofs: Remove ignored __weak attribute
PATCH 1/1 fs/exofs: Remove ignored __weak attribute
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").
--- fs/exofs/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exofs/common.h +1 -1
@@ -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 );
Signature · 1 line
2.19.0
Quoted 50 lines · Nathan Chancellor
Clang warns that the
__weakattribute is going to be ignored ong_attr_inode_databecause 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 fromfs/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__weakosd_attrg_attr_inode_data= ATTR_DEF(^Turns out that GCC ignores the attribute too albeit silently because moving the attribute after either
osd_attrorg_attr_inode_datalike all other uses of__weakon 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 fromfs/exofs/exofs.h:41:fs/exofs/common.h:186:30: error: weak declaration cannot have internal linkage
static const structosd_attr__weakg_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 <[email protected]>Reviewed-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- fs/exofs/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/exofs/common.h +1
-2@@ -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 ); --
Quoted 2 lines
2.19.0
LGTM, thank you for sending, Nathan.
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 22 lines · Nathan Chancellor
Clang warns that the
__weakattribute is going to be ignored ong_attr_inode_databecause 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 fromfs/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__weakosd_attrg_attr_inode_data= ATTR_DEF(^Turns out that GCC ignores the attribute too albeit silently because moving the attribute after either
osd_attrorg_attr_inode_datalike all other uses of__weakon 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 fromfs/exofs/exofs.h:41:fs/exofs/common.h:186:30: error: weak declaration cannot have internal linkage
static const structosd_attr__weakg_attr_inode_data= ATTR_DEF(
Quoted 8 lines
^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 <[email protected]>Reviewed-by Nick Desaulniers <[email protected]>
Yes! thanks
Boaz
Quoted 19 lines
Signed-off-by Nathan Chancellor <[email protected]>--- fs/exofs/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/exofs/common.h +1
-1@@ -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 );
Quoted 51 lines · Nathan Chancellor
Clang warns that the
__weakattribute is going to be ignored ong_attr_inode_databecause 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 fromfs/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__weakosd_attrg_attr_inode_data= ATTR_DEF(^Turns out that GCC ignores the attribute too albeit silently because moving the attribute after either
osd_attrorg_attr_inode_datalike all other uses of__weakon 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 fromfs/exofs/exofs.h:41:fs/exofs/common.h:186:30: error: weak declaration cannot have internal linkage
static const structosd_attr__weakg_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 <[email protected]>Reviewed-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- fs/exofs/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/exofs/common.h +1
-1@@ -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 );Signature · 1 line
2.19.0
Hi Andrew,
Can you take this with Boaz's ack?
Thanks,
Nathan
PATCH RESEND 1/1 fs/exofs: Remove ignored __weak attribute
In reply to Nathan ChancellorClang 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").
---
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(-)
fs/exofs/common.h +1 -1
@@ -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 );
Signature · 1 line
2.20.1