Re: [PATCH rdma-core] verbs: Fix C++ compilation break

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

 



On Mon, Oct 09, 2017 at 03:12:00PM +0200, Nicolas Morey-Chaisemartin wrote:
>
>
> Le 09/10/2017 à 10:17, Leon Romanovsky a écrit :
> > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> >
> > The commit 983f80191923 ("verbs: fix compilation error with ICC") fixed
> > warning by using UINTPTR_MAX, however such change breaks compilation
> > of C++ applications.
> >
> > In C++ world, the UINTPTR_MAX is declared in <cstdint> and not stdint.h,
> > so in order to avoid messing with various defines to decide which header
> > file include: stdint.h or <cstdint>, we will check for the existence
> > of UINTPTR_MAX and will fallback to old implementation.
> >
> > Fixes: 983f80191923 ("verbs: fix compilation error with ICC")
> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > Cc: Nelio Laranjeiro <nelio.laranjeiro@xxxxxxxxx>
> > Cc: Adrien Mazarguil <adrien.mazarguil@xxxxxxxxx>
> > Cc: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx>
> > ---
> >  libibverbs/verbs.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> > index cc633a12..f540b660 100644
> > --- a/libibverbs/verbs.h
> > +++ b/libibverbs/verbs.h
> > @@ -82,7 +82,11 @@ union ibv_gid {
> >
> >  #define vext_field_avail(type, fld, sz) (offsetof(type, fld) < (sz))
> >
> > +#ifdef UINTPTR_MAX
> >  static void *__VERBS_ABI_IS_EXTENDED = (void *)UINTPTR_MAX;
> > +#else
> > +static void *__VERBS_ABI_IS_EXTENDED = ((uint8_t *) NULL) - 1;
> > +#endif
> >
> >  enum ibv_node_type {
> >  	IBV_NODE_UNKNOWN	= -1,
> > --
> > 2.14.2
> >
> > --
> > 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
> Wouldn't something like this solve the issue without messing up the code ?
>
> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> index 8cdf8ab5..c5d932bf 100644
> --- a/libibverbs/verbs.h
> +++ b/libibverbs/verbs.h
> @@ -44,6 +44,7 @@
>  #include <linux/types.h>
>  
>  #ifdef __cplusplus
> +#include  <cstdint>
>  #  define BEGIN_C_DECLS extern "C" {
>  #  define END_C_DECLS   }
>  #else /* !__cplusplus */
>

It will be enough, I'll resend the patch.

Thanks

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