Re: [PATCH rdma-core] verbs: Fix warning from gcc-8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 13, 2018 at 10:42:45AM -0600, Jason Gunthorpe wrote:
> On Thu, Jul 12, 2018 at 07:38:34AM +0300, Leon Romanovsky wrote:
> > On Wed, Jul 11, 2018 at 01:57:04PM -0600, Jason Gunthorpe wrote:
> > > On Wed, Jul 11, 2018 at 10:09:05PM +0300, Leon Romanovsky wrote:
> > > > On Wed, Jul 11, 2018 at 11:20:12AM -0600, Jason Gunthorpe wrote:
> > > > > gcc-8 now warns on the void (*)(void) cast, use the less pedantically
> > > > > correct (void *) cast instead.
> > > > >
> > > > > ../libibverbs/dummy_ops.c:526:28: warning: cast between incompatible function types from ‘struct ibv_pd * (* const)(struct ibv_context *)’ to ‘void * (*)(void)’ [-Wcast-function-type]
> > > > >     (ptr)->_compat_##name = (void *(*)(void))ops->name;    \
> > > > >
> > > > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> > > > >  libibverbs/dummy_ops.c | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > >
> > > > I don't see such warning on my systems,
> > > > ➜  patches gcc --version
> > > > gcc (GCC) 8.1.1 20180502 (Red Hat 8.1.1-1)
> > > >
> > > > What should I enable to see it?
> > >
> > > No idea, maybe they reverted the warning or RH turned it off or ??
> >
> > It looks so,
> > ➜  gcc -Q --help=warning | grep "Wcast-function-type"
> >   -Wcast-function-type                  [disabled]
> >
> > >
> > > I see it here:
> > >
> > > gcc version 8.1.0 (Ubuntu 8.1.0-5ubuntu1~16.04)
> > >
> > > As does travis when building the suse package
> >
> > You need to add this warning to CmakeList.txt
> > https://github.com/linux-rdma/rdma-core/blob/master/CMakeLists.txt#L165
>
> Maybe we should just disable it from CMake, if the thinking is that
> this is not a good warning to use..

I think that this warning is valuable for us, because it catches wrong
usage of declared function signatures and we don't have much places
like this, so it is easy to fix instead of hide.

Thanks

>
> Jason
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux