diff mbox series

[1/3] cxl: Fixed defined but not used warnings

Message ID 20210830171726.2342558-1-ben.widawsky@intel.com
State Superseded
Headers show
Series [1/3] cxl: Fixed defined but not used warnings | expand

Commit Message

Ben Widawsky Aug. 30, 2021, 5:17 p.m. UTC
This fixes unused-const-variable warnings emitted by gcc when cxlmem.h
is used by pretty much all files except pci.c

Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
---
 include/uapi/linux/cxl_mem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Williams Aug. 30, 2021, 6:49 p.m. UTC | #1
On Mon, Aug 30, 2021 at 10:17 AM Ben Widawsky <ben.widawsky@intel.com> wrote:
>
> This fixes unused-const-variable warnings emitted by gcc when cxlmem.h
> is used by pretty much all files except pci.c
>
> Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
> ---
>  include/uapi/linux/cxl_mem.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/cxl_mem.h b/include/uapi/linux/cxl_mem.h
> index f6e8a005b113..1236dd9ffe23 100644
> --- a/include/uapi/linux/cxl_mem.h
> +++ b/include/uapi/linux/cxl_mem.h
> @@ -50,7 +50,7 @@ enum { CXL_CMDS };
>  #define ___C(a, b) { b }
>  static const struct {
>         const char *name;
> -} cxl_command_names[] = { CXL_CMDS };
> +} cxl_command_names[] __maybe_unused = { CXL_CMDS };

Since this is a uapi header does this need to be the raw
"__attribute__((__unused__))"?
Ben Widawsky Aug. 30, 2021, 7:06 p.m. UTC | #2
On 21-08-30 11:49:05, Dan Williams wrote:
> On Mon, Aug 30, 2021 at 10:17 AM Ben Widawsky <ben.widawsky@intel.com> wrote:
> >
> > This fixes unused-const-variable warnings emitted by gcc when cxlmem.h
> > is used by pretty much all files except pci.c
> >
> > Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
> > ---
> >  include/uapi/linux/cxl_mem.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/uapi/linux/cxl_mem.h b/include/uapi/linux/cxl_mem.h
> > index f6e8a005b113..1236dd9ffe23 100644
> > --- a/include/uapi/linux/cxl_mem.h
> > +++ b/include/uapi/linux/cxl_mem.h
> > @@ -50,7 +50,7 @@ enum { CXL_CMDS };
> >  #define ___C(a, b) { b }
> >  static const struct {
> >         const char *name;
> > -} cxl_command_names[] = { CXL_CMDS };
> > +} cxl_command_names[] __maybe_unused = { CXL_CMDS };
> 
> Since this is a uapi header does this need to be the raw
> "__attribute__((__unused__))"?

Good catch. I grepped uapi dir and interestingly didn't find other examples of
unused... Feeling a bit special snowflake now.
diff mbox series

Patch

diff --git a/include/uapi/linux/cxl_mem.h b/include/uapi/linux/cxl_mem.h
index f6e8a005b113..1236dd9ffe23 100644
--- a/include/uapi/linux/cxl_mem.h
+++ b/include/uapi/linux/cxl_mem.h
@@ -50,7 +50,7 @@  enum { CXL_CMDS };
 #define ___C(a, b) { b }
 static const struct {
 	const char *name;
-} cxl_command_names[] = { CXL_CMDS };
+} cxl_command_names[] __maybe_unused = { CXL_CMDS };
 
 /*
  * Here's how this actually breaks out: