ceph: undefine pr_fmt before redefining it
diff mbox series

Message ID 20190802172335.24553-1-jlayton@kernel.org
State New
Headers show
Series
  • ceph: undefine pr_fmt before redefining it
Related show

Commit Message

Jeff Layton Aug. 2, 2019, 5:23 p.m. UTC
The preprocessor throws a warning here in some cases:

In file included from fs/ceph/super.h:5,
                 from fs/ceph/io.c:16:
./include/linux/ceph/ceph_debug.h:5: warning: "pr_fmt" redefined
    5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
      |
In file included from ./include/linux/kernel.h:15,
                 from fs/ceph/io.c:12:
./include/linux/printk.h:288: note: this is the location of the previous definition
  288 | #define pr_fmt(fmt) fmt
      |

Since we do mean to redefine it, make that explicit by undefining it
first.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/ceph/ceph_debug.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Ilya Dryomov Aug. 5, 2019, 9:07 a.m. UTC | #1
On Fri, Aug 2, 2019 at 7:23 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> The preprocessor throws a warning here in some cases:
>
> In file included from fs/ceph/super.h:5,
>                  from fs/ceph/io.c:16:
> ./include/linux/ceph/ceph_debug.h:5: warning: "pr_fmt" redefined
>     5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>       |
> In file included from ./include/linux/kernel.h:15,
>                  from fs/ceph/io.c:12:
> ./include/linux/printk.h:288: note: this is the location of the previous definition
>   288 | #define pr_fmt(fmt) fmt
>       |
>
> Since we do mean to redefine it, make that explicit by undefining it
> first.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  include/linux/ceph/ceph_debug.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
> index d5a5da838caf..fa4a84e0e018 100644
> --- a/include/linux/ceph/ceph_debug.h
> +++ b/include/linux/ceph/ceph_debug.h
> @@ -2,6 +2,7 @@
>  #ifndef _FS_CEPH_DEBUG_H
>  #define _FS_CEPH_DEBUG_H
>
> +#undef pr_fmt
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
>  #include <linux/string.h>

Hi Jeff,

Looks like fs/ceph/io.c is a new file you are working on?  ceph_debug.h
should be included at the top of every file.

Thanks,

                Ilya
Jeff Layton Aug. 5, 2019, 10:22 a.m. UTC | #2
On Mon, 2019-08-05 at 11:07 +0200, Ilya Dryomov wrote:
> On Fri, Aug 2, 2019 at 7:23 PM Jeff Layton <jlayton@kernel.org> wrote:
> > The preprocessor throws a warning here in some cases:
> > 
> > In file included from fs/ceph/super.h:5,
> >                  from fs/ceph/io.c:16:
> > ./include/linux/ceph/ceph_debug.h:5: warning: "pr_fmt" redefined
> >     5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> >       |
> > In file included from ./include/linux/kernel.h:15,
> >                  from fs/ceph/io.c:12:
> > ./include/linux/printk.h:288: note: this is the location of the previous definition
> >   288 | #define pr_fmt(fmt) fmt
> >       |
> > 
> > Since we do mean to redefine it, make that explicit by undefining it
> > first.
> > 
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> >  include/linux/ceph/ceph_debug.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
> > index d5a5da838caf..fa4a84e0e018 100644
> > --- a/include/linux/ceph/ceph_debug.h
> > +++ b/include/linux/ceph/ceph_debug.h
> > @@ -2,6 +2,7 @@
> >  #ifndef _FS_CEPH_DEBUG_H
> >  #define _FS_CEPH_DEBUG_H
> > 
> > +#undef pr_fmt
> >  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > 
> >  #include <linux/string.h>
> 
> Hi Jeff,
> 
> Looks like fs/ceph/io.c is a new file you are working on?  ceph_debug.h
> should be included at the top of every file.
> 
> Thanks,
> 
>                 Ilya

Yes, io.c is a new file I'm working on, though I had seen something
similar when working on the tracepoints that I posted recently.

If I include ceph_debug.h first though, this does go away though, so
I'll drop this patch then.

Thanks,

Patch
diff mbox series

diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
index d5a5da838caf..fa4a84e0e018 100644
--- a/include/linux/ceph/ceph_debug.h
+++ b/include/linux/ceph/ceph_debug.h
@@ -2,6 +2,7 @@ 
 #ifndef _FS_CEPH_DEBUG_H
 #define _FS_CEPH_DEBUG_H
 
+#undef pr_fmt
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/string.h>