Skip to contentSkip to conversation

verbs: Fix declaration of C++ include file in C-block

PATCH Applied Leon Romanovsky 2 participants 2 messages Oct 25, 2017 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 verbs: Fix declaration of C++ include file in C-block

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>

The include of limits.h in case of C++ application throws the following error during the compilation.

/usr/include/c++/4.8.2/limits:303:3: error: template with C linkage
template<typename _Tp>
^

The reason to such failure is the location of limits.c, it is supposed to be included outside of C-block, so let's move it to avoid the error.

Fixes 6a74285158a1 ("verbs: Fix C++ compilation break")
---
 libibverbs/verbs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
libibverbs/verbs.h +4 -1
index 4e2f338a..52c8e3c6 100644
@@ -44,6 +44,10 @@
 #include <linux/types.h>
 #include <stdint.h>
 
+#ifdef __cplusplus
+#include <limits>
+#endif
+
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
 #  define END_C_DECLS   }
@@ -83,7 +87,6 @@ union ibv_gid {
 #define vext_field_avail(type, fld, sz) (offsetof(type, fld) < (sz))
 
 #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)

--
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20171025092323.20082-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

Applied
#2 lore raw
Quoted 10 lines · Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>

The include of limits.h in case of C++ application throws the following
error during the compilation.

/usr/include/c++/4.8.2/limits:303:3: error: template with C linkage
template<typename _Tp>
^

Quoted 7 lines

The reason to such failure is the location of limits.c, it is supposed
to be included outside of C-block, so let's move it to avoid the error.

Fixes 6a74285158a1 ("verbs: Fix C++ compilation break")

Thanks, applied.

Signature · 8 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html