Skip to content

Commit 93eaff2

Browse files
authored
Merge pull request #6342 from jsquyres/pr/v3.0.x/make-mpi.h-a-little-friendlier-to-c++
v3.0.x: mpi.h.in: use C++ static_cast<> where appropriate
2 parents de445d3 + f9c9f53 commit 93eaff2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ompi/include/mpi.h.in

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
12+
* Copyright (c) 2007-2019 Cisco Systems, Inc. All rights reserved
1313
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
1414
* Copyright (c) 2009-2012 Oak Rigde National Laboratory. All rights reserved.
1515
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
@@ -310,7 +310,11 @@
310310
* when building OMPI).
311311
*/
312312
#if !OMPI_BUILDING
313+
#if defined(c_plusplus) || defined(__cplusplus)
314+
#define OMPI_PREDEFINED_GLOBAL(type, global) (static_cast<type> (static_cast<void *> (&(global))))
315+
#else
313316
#define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))
317+
#endif
314318
#else
315319
#define OMPI_PREDEFINED_GLOBAL(type, global) ((type) &(global))
316320
#endif
@@ -768,8 +772,13 @@ enum {
768772
*/
769773
#define MPI_INFO_ENV OMPI_PREDEFINED_GLOBAL(MPI_Info, ompi_mpi_info_env)
770774

775+
#if defined(c_plusplus) || defined(__cplusplus)
776+
#define MPI_STATUS_IGNORE (static_cast<MPI_Status *> (0))
777+
#define MPI_STATUSES_IGNORE (static_cast<MPI_Status *> (0))
778+
#else
771779
#define MPI_STATUS_IGNORE ((MPI_Status *) 0)
772780
#define MPI_STATUSES_IGNORE ((MPI_Status *) 0)
781+
#endif
773782

774783
/*
775784
* Special MPI_T handles

0 commit comments

Comments
 (0)