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

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

 



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



[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