2015-08-14 09:57:14

by Ioan-Adrian Ratiu

[permalink] [raw]
Subject: [PATCH] staging: lustre: ptlrpc: add missing include directive

Without including ptlrpc_internal.h, GCC gives prototype warnings
"pack_generic.c:642:5: warning: no previous prototype for ..."
and sparse also complains "pack_generic.c:642:5: warning: symbol
'lustre_unpack_req_ptlrpc_body' was not declared. ..."

Signed-off-by: Ioan-Adrian Ratiu <[email protected]>
---
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
index 2787bfd..84937ad 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
@@ -52,6 +52,8 @@
#include "../include/obd_cksum.h"
#include "../include/lustre/ll_fiemap.h"

+#include "ptlrpc_internal.h"
+
static inline int lustre_msg_hdr_size_v2(int count)
{
return cfs_size_round(offsetof(struct lustre_msg_v2,
--
2.1.4


2015-08-15 01:50:27

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: lustre: ptlrpc: add missing include directive

On Fri, Aug 14, 2015 at 12:57:06PM +0300, Ioan-Adrian Ratiu wrote:
> Without including ptlrpc_internal.h, GCC gives prototype warnings
> "pack_generic.c:642:5: warning: no previous prototype for ..."

It does? What version of gcc give you that, I don't see that here.

2015-08-15 08:13:30

by Ioan-Adrian Ratiu

[permalink] [raw]
Subject: Re: [PATCH] staging: lustre: ptlrpc: add missing include directive

On Fri, 14 Aug 2015 18:50:24 -0700
Greg KH <[email protected]> wrote:

> On Fri, Aug 14, 2015 at 12:57:06PM +0300, Ioan-Adrian Ratiu wrote:
> > Without including ptlrpc_internal.h, GCC gives prototype warnings
> > "pack_generic.c:642:5: warning: no previous prototype for ..."
>
> It does? What version of gcc give you that, I don't see that here.
>

Yes, but it's a non-default warning (-Wmissing-prototypes)

$ gcc --version
gcc (Gentoo 4.9.3 p1.0, pie-0.6.2) 4.9.3

When testing the above patch I've used Ubuntu Vivid Vervet's gcc
(also 4.9 I think, I don't have access to that machine right now).

To see the warn I'm adding "ccflags-y := -Wmissing-prototypes"
to a Makefile then "make SUBDIRS=..."

2015-08-15 10:11:10

by Oleg Drokin

[permalink] [raw]
Subject: Re: [HPDD-discuss] [PATCH] staging: lustre: ptlrpc: add missing include directive

Hello!

On Aug 15, 2015, at 4:13 AM, Ioan-Adrian Ratiu wrote:

>>> Without including ptlrpc_internal.h, GCC gives prototype warnings
>>> "pack_generic.c:642:5: warning: no previous prototype for ..."
>> It does? What version of gcc give you that, I don't see that here.
> Yes, but it's a non-default warning (-Wmissing-prototypes)
>
> $ gcc --version
> gcc (Gentoo 4.9.3 p1.0, pie-0.6.2) 4.9.3
>
> When testing the above patch I've used Ubuntu Vivid Vervet's gcc
> (also 4.9 I think, I don't have access to that machine right now).
>
> To see the warn I'm adding "ccflags-y := -Wmissing-prototypes"
> to a Makefile then "make SUBDIRS=?"

Duh, so essentially it tells you that you have a non-static function
that lacks a previously defined prototype, but because it's
non-static, it's likely used elsewhere and the prototype might get
out of sync with the actual function definition?

I guess it's no big deal to include the ptlrpc_internal.h there
to catch potential problems like that.

Thanks.

Bye,
Oleg-

2015-08-15 16:11:39

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: lustre: ptlrpc: add missing include directive

On Sat, Aug 15, 2015 at 11:13:39AM +0300, Ioan-Adrian Ratiu wrote:
> On Fri, 14 Aug 2015 18:50:24 -0700
> Greg KH <[email protected]> wrote:
>
> > On Fri, Aug 14, 2015 at 12:57:06PM +0300, Ioan-Adrian Ratiu wrote:
> > > Without including ptlrpc_internal.h, GCC gives prototype warnings
> > > "pack_generic.c:642:5: warning: no previous prototype for ..."
> >
> > It does? What version of gcc give you that, I don't see that here.
> >
>
> Yes, but it's a non-default warning (-Wmissing-prototypes)

Then you should say that, otherwise you have us worrying something is
really wrong with our build/compiler versions...

I've taken this patch, but next time please be more specific.

thanks,

greg k-h