All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core v1] verbs: Fix C++ compilation break
@ 2017-10-10  8:14 Leon Romanovsky
  0 siblings, 0 replies; only message in thread
From: Leon Romanovsky @ 2017-10-10  8:14 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
	Jason Gunthorpe, Nelio Laranjeiro, Adrien Mazarguil,
	Nicolas Morey-Chaisemartin

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The commit 983f80191923 ("verbs: fix compilation error with ICC") fixed
warning by using UINTPTR_MAX, however such change breaks compilation
of C++ applications.

On some systems, the stdint.h contains the following ifdef to protect UINTPTR_MAX
"#if !defined __cplusplus || defined __STDC_LIMIT_MACROS"

The simple inclusion of <cstdint> header is not enough too to fix
compilation error, because that file was added in C++11 standard and
it produces following error while using it:

/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires
compiler and library support for the ISO C++ 2011 standard. This support is currently
experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

So let's fix C++ compilation break by using numeric_limits to avoid __STDC_LIMIT_MACROS.

Fixes: 983f80191923 ("verbs: fix compilation error with ICC")
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Nelio Laranjeiro <nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Cc: Adrien Mazarguil <adrien.mazarguil-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Cc: Nicolas Morey-Chaisemartin <NMoreyChaisemartin-l3A5Bk7waGM@public.gmane.org>
---
Travis CI failure is a false alarm (checkpatch):
https://github.com/linux-rdma/rdma-core/pull/224

Changes from v0:
 * Updated commit message to better reflect the issue
 * Used Jason's code, so added his SOB
---
 libibverbs/verbs.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index cc633a12..4e2f338a 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -82,7 +82,12 @@ union ibv_gid {

 #define vext_field_avail(type, fld, sz) (offsetof(type, fld) < (sz))

-static void *__VERBS_ABI_IS_EXTENDED = (void *)UINTPTR_MAX;
+#ifdef __cplusplus
+#include <limits>
+#define __VERBS_ABI_IS_EXTENDED ((void *)std::numeric_limits<uintptr_t>::max())
+#else
+#define __VERBS_ABI_IS_EXTENDED ((void *)UINTPTR_MAX)
+#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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-10  8:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10  8:14 [PATCH rdma-core v1] verbs: Fix C++ compilation break Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.