linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: ooo@electrozaur.com,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] libosd: Remove ignored __weak attribute
Date: Mon, 1 Oct 2018 15:47:55 -0700	[thread overview]
Message-ID: <CAKwvOdmCHEB945Lr26mWt9J7jYXDo89wUt=r0UT7mZ-WcroMLA@mail.gmail.com> (raw)
In-Reply-To: <20180930205448.26205-1-natechancellor@gmail.com>

On Sun, Sep 30, 2018 at 1:55 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns that the __weak attribute is going to be ignored on
> osd_root_object because it's not in the correct location (needs to be
> after the type).
>
> ./include/scsi/osd_types.h:31:21: warning: 'weak' attribute only applies
> to variables, functions, and classes [-Wignored-attributes]
> static const struct __weak osd_obj_id osd_root_object = {0, 0};
>                     ^
>
> Turns out that GCC ignores the attribute too albeit silently because
> moving the attribute after either osd_obj_id or osd_root_object 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:
>
> ./include/scsi/osd_types.h:31:32: error: weak declaration cannot have
> internal linkage
> static const struct osd_obj_id __weak osd_root_object = {0, 0};
>                                ^
>
> Just remove the attribute because it hasn't been correct since the
> initial addition of this file in commit de258bf5e638 ("[SCSI] libosd:
> OSDv1 Headers").
>
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  include/scsi/osd_types.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
> index 48e8a165e136..6b6fdcafa6cc 100644
> --- a/include/scsi/osd_types.h
> +++ b/include/scsi/osd_types.h
> @@ -28,7 +28,7 @@ struct osd_obj_id {
>         osd_id id;
>  };
>
> -static const struct __weak osd_obj_id osd_root_object = {0, 0};
> +static const struct osd_obj_id osd_root_object = {0, 0};
>
>  struct osd_attr {
>         u32 attr_page;
> --
> 2.19.0
>

LGTM, thank you for sending, Nathan.
-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2018-10-01 22:48 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-30 20:54 [PATCH] libosd: Remove ignored __weak attribute Nathan Chancellor
2018-10-01 22:47 ` Nick Desaulniers [this message]
2018-10-02  1:16 ` Bart Van Assche
2018-10-02  6:55   ` Nathan Chancellor
2018-10-02 14:56   ` Christoph Hellwig
2018-10-02 16:59     ` Boaz Harrosh
2018-10-02 17:24   ` Nick Desaulniers
2018-10-02 17:57     ` Bart Van Assche
2018-10-02 22:33       ` Nick Desaulniers
2018-10-02 23:06         ` Bart Van Assche
2018-10-25 21:31           ` Nathan Chancellor
2018-10-25 22:02             ` Nick Desaulniers
2018-10-25 22:55               ` Nathan Chancellor
2018-10-26 17:54                 ` Nick Desaulniers
2018-10-26 18:01                   ` Bart Van Assche
2018-10-26 18:05                     ` Nathan Chancellor
2018-10-26 18:31                       ` Nick Desaulniers
2018-10-26 19:22                         ` Linus Torvalds
2018-10-26 20:05                           ` Nick Desaulniers
2018-10-26 20:42                             ` Linus Torvalds
2018-10-26 21:02                               ` Nick Desaulniers
2018-10-26 21:00                     ` Nick Desaulniers
2018-10-26 21:30                       ` Bart Van Assche
2018-10-26 21:36                         ` Nick Desaulniers
2018-10-26 21:59                           ` Bart Van Assche
2018-10-26 22:07                             ` Nick Desaulniers
2018-10-26 22:24                               ` Bart Van Assche
2018-10-27 13:28                                 ` Martin K. Petersen
2018-10-28 15:44                                   ` Christoph Hellwig
2018-11-01  1:05                                   ` Boaz Harrosh
2018-10-27  3:35                               ` Theodore Y. Ts'o
2018-10-27  6:15                                 ` Bart Van Assche
2018-10-27  6:25                                   ` Nathan Chancellor
2018-11-01  1:15                   ` Boaz Harrosh
2018-11-01  1:39             ` Boaz Harrosh
2018-11-01  1:44               ` Nathan Chancellor
2019-01-26  6:47 ` [PATCH RESEND] " Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKwvOdmCHEB945Lr26mWt9J7jYXDo89wUt=r0UT7mZ-WcroMLA@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=natechancellor@gmail.com \
    --cc=ooo@electrozaur.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).