Skip to content

Commit 02cd80e

Browse files
authored
Merge pull request #7248 from raffenet/4.3.x-fixes
[4.3.x] misc: fixes for C++ bindings and handle conversion ABI
2 parents f763d57 + 069bf94 commit 02cd80e

File tree

1 file changed

+68
-18
lines changed

1 file changed

+68
-18
lines changed

src/include/mpi.h.in

Lines changed: 68 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,24 @@
7777
#define MPICH_CALC_VERSION(MAJOR, MINOR, REVISION, TYPE, PATCH) \
7878
(((MAJOR) * 10000000) + ((MINOR) * 100000) + ((REVISION) * 1000) + ((TYPE) * 100) + (PATCH))
7979

80+
#if !defined(INT8_C)
81+
/* stdint.h was not included, see if we can get it */
82+
# if defined(__cplusplus)
83+
# if __cplusplus >= 201103
84+
# include <cstdint>
85+
# endif
86+
# endif
87+
#endif
88+
89+
#if !defined(INT8_C)
90+
/* stdint.h was not included, see if we can get it */
91+
# if defined(__STDC_VERSION__)
92+
# if __STDC_VERSION__ >= 199901
93+
# include <stdint.h>
94+
# endif
95+
# endif
96+
#endif
97+
8098
/* Keep C++ compilers from getting confused */
8199
#if defined(__cplusplus)
82100
extern "C" {
@@ -105,24 +123,6 @@ extern "C" {
105123
# define MPICH_ATTR_TYPE_TAG_MUST_BE_NULL()
106124
#endif
107125

108-
#if !defined(INT8_C)
109-
/* stdint.h was not included, see if we can get it */
110-
# if defined(__cplusplus)
111-
# if __cplusplus >= 201103
112-
# include <cstdint>
113-
# endif
114-
# endif
115-
#endif
116-
117-
#if !defined(INT8_C)
118-
/* stdint.h was not included, see if we can get it */
119-
# if defined(__STDC_VERSION__)
120-
# if __STDC_VERSION__ >= 199901
121-
# include <stdint.h>
122-
# endif
123-
# endif
124-
#endif
125-
126126
#if defined(INT8_C)
127127
/* stdint.h was included, so we can annotate these types */
128128
# define MPICH_ATTR_TYPE_TAG_STDINT(type) MPICH_ATTR_TYPE_TAG(type)
@@ -1028,6 +1028,56 @@ typedef struct MPIX_Iov {
10281028
#include <mpi_proto.h>
10291029

10301030
@HAVE_ROMIO@
1031+
1032+
/* The f2c and c2f APIs exist as real functions, but these macros allows
1033+
* for backward MPICH ABI compatibility.
1034+
*/
1035+
/* exclude these macros from MPICH internal */
1036+
#ifndef MPICHCONF_H_INCLUDED
1037+
#define MPI_Comm_c2f(comm) (MPI_Fint)(comm)
1038+
#define MPI_Comm_f2c(comm) (MPI_Comm)(comm)
1039+
#define MPI_Type_c2f(datatype) (MPI_Fint)(datatype)
1040+
#define MPI_Type_f2c(datatype) (MPI_Datatype)(datatype)
1041+
#define MPI_Group_c2f(group) (MPI_Fint)(group)
1042+
#define MPI_Group_f2c(group) (MPI_Group)(group)
1043+
#define MPI_Info_c2f(info) (MPI_Fint)(info)
1044+
#define MPI_Info_f2c(info) (MPI_Info)(info)
1045+
#define MPI_Request_f2c(request) (MPI_Request)(request)
1046+
#define MPI_Request_c2f(request) (MPI_Fint)(request)
1047+
#define MPI_Op_c2f(op) (MPI_Fint)(op)
1048+
#define MPI_Op_f2c(op) (MPI_Op)(op)
1049+
#define MPI_Errhandler_c2f(errhandler) (MPI_Fint)(errhandler)
1050+
#define MPI_Errhandler_f2c(errhandler) (MPI_Errhandler)(errhandler)
1051+
#define MPI_Win_c2f(win) (MPI_Fint)(win)
1052+
#define MPI_Win_f2c(win) (MPI_Win)(win)
1053+
#define MPI_Message_c2f(msg) ((MPI_Fint)(msg))
1054+
#define MPI_Message_f2c(msg) ((MPI_Message)(msg))
1055+
#define MPI_Session_c2f(session) (MPI_Fint)(session)
1056+
#define MPI_Session_f2c(session) (MPI_Session)(session)
1057+
1058+
/* PMPI versions of the handle transfer functions. See section 4.17 */
1059+
#define PMPI_Comm_c2f(comm) (MPI_Fint)(comm)
1060+
#define PMPI_Comm_f2c(comm) (MPI_Comm)(comm)
1061+
#define PMPI_Type_c2f(datatype) (MPI_Fint)(datatype)
1062+
#define PMPI_Type_f2c(datatype) (MPI_Datatype)(datatype)
1063+
#define PMPI_Group_c2f(group) (MPI_Fint)(group)
1064+
#define PMPI_Group_f2c(group) (MPI_Group)(group)
1065+
#define PMPI_Info_c2f(info) (MPI_Fint)(info)
1066+
#define PMPI_Info_f2c(info) (MPI_Info)(info)
1067+
#define PMPI_Request_f2c(request) (MPI_Request)(request)
1068+
#define PMPI_Request_c2f(request) (MPI_Fint)(request)
1069+
#define PMPI_Op_c2f(op) (MPI_Fint)(op)
1070+
#define PMPI_Op_f2c(op) (MPI_Op)(op)
1071+
#define PMPI_Errhandler_c2f(errhandler) (MPI_Fint)(errhandler)
1072+
#define PMPI_Errhandler_f2c(errhandler) (MPI_Errhandler)(errhandler)
1073+
#define PMPI_Win_c2f(win) (MPI_Fint)(win)
1074+
#define PMPI_Win_f2c(win) (MPI_Win)(win)
1075+
#define PMPI_Message_c2f(msg) ((MPI_Fint)(msg))
1076+
#define PMPI_Message_f2c(msg) ((MPI_Message)(msg))
1077+
#define PMPI_Session_c2f(session) (MPI_Fint)(session)
1078+
#define PMPI_Session_f2c(session) (MPI_Session)(session)
1079+
#endif
1080+
10311081
#endif /* BUILD_MPI_ABI */
10321082

10331083
#if defined(__cplusplus)

0 commit comments

Comments
 (0)