Skip to content

Commit 3d76b23

Browse files
gpaulsenjsquyres
authored andcommitted
mpi.h.in: Revamp MPI-1 removed function warnings
Refs #6278. This commit is intended to be cherry-picked to v4.0.x and the following commit will ammend to this functionality for master's removal. Changes the prototypes for MPI removed functions in the following ways: There are 4 cases: 1) User wants MPI-1 compatibility (--enable-mpi1-compatibility) MPI_Address (and friends) are declared in mpi.h with deprecation notice 2) User does not want MPI-1 compatibility, and has a C11-capable compiler Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using _Static_assert C11 feature 3) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, but the compiler supports error function attributes. Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using error function attribute. 4) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, or a compiler that supports error function attributes. Do not declare MPI_Address (etc.) in mpi.h at all. Unless the user is compiling with something like -Werror, this will allow the user's code to compile. We are choosing this because it seems like a losing battle to make some kind of compile time error that is friendly to the user (and doesn't make it look like mpi.h itself is broken). On v4.0.x, this will allow the user code to both compile (albeit with a warning) and link (because the MPI_Address will be in the MPI library because we are preserving ABI back to 3.0.x). On master/v5.0.x, this will allow the user code to compile, but it will fail to link (because the MPI_Address symbol will not be in the MPI library). Signed-off-by: Geoffrey Paulsen <[email protected]>
1 parent 29fa66c commit 3d76b23

11 files changed

+214
-32
lines changed

ompi/include/mpi.h.in

Lines changed: 104 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Copyright (c) 2015 University of Houston. All rights reserved.
2020
* Copyright (c) 2015-2018 Research Organization for Information Science
2121
* and Technology (RIST). All rights reserved.
22-
* Copyright (c) 2017-2018 IBM Corporation. All rights reserved.
22+
* Copyright (c) 2017-2019 IBM Corporation. All rights reserved.
2323
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
2424
* $COPYRIGHT$
2525
*
@@ -280,9 +280,50 @@
280280
# define __mpi_interface_deprecated__(msg) __attribute__((__deprecated__))
281281
# endif
282282
# endif
283-
# if OMPI_ENABLE_MPI1_COMPAT
284-
# define __mpi_interface_removed__(msg) __mpi_interface_deprecated__(msg)
283+
# endif
284+
285+
/* For MPI removed APIs, there is no generally portable way to cause
286+
* the C compiler to error with a nice message, on the _usage_ of
287+
* one of these symbols. We've gone with tiered appraoch:
288+
*
289+
* If the user configured with --enable-mpi1-compatibility,
290+
* just emit a compiletime warning (via the deprecation function
291+
* attribute) that they're using an MPI1 removed function.
292+
*
293+
* Otherwise, we'd like to issue a fatal error directing the user
294+
* that they've used an MPI1 removed function. If the user's
295+
* compiler supports C11 _Static_assert feature, we #define
296+
* the MPI routines to instead be a call to _Static_assert
297+
* with an appropreate message suggesting the new MPI3 equivalent.
298+
*
299+
* Otherwise, if the user's compiler supports the error function
300+
* attribute, define the MPI routines with that error attribute.
301+
* This is supported by most modern GNU compilers.
302+
*
303+
* Finally if the compiler doesn't support any of those, just
304+
* Don't declare those MPI routines at all in mpi.h
305+
*
306+
* Don't do MACRO magic for building Profiling library as it
307+
* interferes with the above.
308+
*/
309+
# if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING)
310+
# define OMPI_OMIT_MPI1_COMPAT_DECLS 0
311+
# define OMPI_REMOVED_USE_STATIC_ASSERT 0
312+
# define __mpi_interface_removed__(func, newfunc) __mpi_interface_deprecated__(#func " was removed in MPI-3.0. Use " #newfunc " instead. continuing...")
313+
# else
314+
# if (__STDC_VERSION__ >= 201112L)
315+
# define OMPI_OMIT_MPI1_COMPAT_DECLS 1
316+
# define OMPI_REMOVED_USE_STATIC_ASSERT 1
317+
# define OMPI_REMOVED_STATIC_ASSERT_MSG(func, newfunc) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.")
318+
# else
319+
# if OPAL_HAVE_ATTRIBUTE_ERROR
285320
# define OMPI_OMIT_MPI1_COMPAT_DECLS 0
321+
# define OMPI_REMOVED_USE_STATIC_ASSERT 0
322+
# define __mpi_interface_removed__(func, newfunc) __attribute__((__error__(#func " was removed in MPI-3.0. Use " #newfunc " instead.")))
323+
# else
324+
# define OMPI_OMIT_MPI1_COMPAT_DECLS 1
325+
# define OMPI_REMOVED_USE_STATIC_ASSERT 0
326+
# endif
286327
# endif
287328
# endif
288329
# endif
@@ -298,7 +339,15 @@
298339
#endif
299340

300341
#if !defined(__mpi_interface_removed__)
301-
# define __mpi_interface_removed__(msg)
342+
# define __mpi_interface_removed__(A,B)
343+
#endif
344+
345+
#if !defined(OMPI_REMOVED_STATIC_ASSERT_MSG)
346+
# define OMPI_REMOVED_STATIC_ASSERT_MSG(func, newfunc)
347+
#endif
348+
349+
#if !defined(OMPI_REMOVED_USE_STATIC_ASSERT)
350+
# define OMPI_REMOVED_USE_STATIC_ASSERT 0
302351
#endif
303352

304353
#if !defined(OMPI_OMIT_MPI1_COMPAT_DECLS)
@@ -1005,22 +1054,32 @@ OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_env;
10051054
OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUS_IGNORE;
10061055
OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE;
10071056

1008-
#if !OMPI_OMIT_MPI1_COMPAT_DECLS
10091057
/*
10101058
* Removed datatypes. These datatypes are only available if Open MPI
10111059
* was configured with --enable-mpi1-compatibility.
10121060
*
10131061
* These datatypes were formally removed from the MPI specification
10141062
* and should no longer be used in MPI applications.
10151063
*/
1016-
#define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub)
1017-
#define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb)
1064+
#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING)
1065+
# define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub)
1066+
# define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb)
1067+
1068+
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb;
1069+
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub;
1070+
1071+
#else
1072+
/* If not building or configured --enable-mpi1-compatibility, then
1073+
* we don't want these datatypes, instead we define MPI_UB and
1074+
* MPI_LB to our Static Assert message if the compiler supports
1075+
* that staticly assert with a nice message.
1076+
*/
1077+
# if (OMPI_REMOVED_USE_STATIC_ASSERT)
1078+
# define MPI_UB OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_UB, MPI_Type_create_resized);
1079+
# define MPI_LB OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_LB, MPI_Type_create_resized);
1080+
# endif /* OMPI_REMOVED_USE_STATIC_ASSERT */
1081+
#endif /* Removed datatypes */
10181082

1019-
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb
1020-
__mpi_interface_removed__("MPI_LB was removed in MPI-3.0; use MPI_Type_create_resized instead.");
1021-
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub
1022-
__mpi_interface_removed__("MPI_UB was removed in MPI-3.0; use MPI_Type_create_resized instead.");
1023-
#endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */
10241083

10251084
/*
10261085
* MPI predefined handles
@@ -2696,61 +2755,74 @@ typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...);
26962755
* and should no longer be used in MPI applications.
26972756
*/
26982757
OMPI_DECLSPEC int MPI_Address(void *location, MPI_Aint *address)
2699-
__mpi_interface_removed__("MPI_Address was removed in MPI-3.0; use MPI_Get_address instead.");
2758+
__mpi_interface_removed__(MPI_Address, MPI_Get_address);
27002759
OMPI_DECLSPEC int PMPI_Address(void *location, MPI_Aint *address)
2701-
__mpi_interface_removed__("PMPI_Address was removed in MPI-3.0; use MPI_Get_address instead.");
2760+
__mpi_interface_removed__(PMPI_Address, PMPI_Get_address);
27022761
OMPI_DECLSPEC int MPI_Errhandler_create(MPI_Handler_function *function,
27032762
MPI_Errhandler *errhandler)
2704-
__mpi_interface_removed__("MPI_Errhandler_create was removed in MPI-3.0; use MPI_Comm_create_errhandler instead.");
2763+
__mpi_interface_removed__(MPI_Errhandler_create, MPI_Comm_create_errhandler);
27052764
OMPI_DECLSPEC int PMPI_Errhandler_create(MPI_Handler_function *function,
27062765
MPI_Errhandler *errhandler)
2707-
__mpi_interface_removed__("PMPI_Errhandler_create was removed in MPI-3.0; use PMPI_Comm_create_errhandler instead.");
2766+
__mpi_interface_removed__(PMPI_Errhandler_create, PMPI_Comm_create_errhandler);
27082767
OMPI_DECLSPEC int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)
2709-
__mpi_interface_removed__("MPI_Errhandler_get was removed in MPI-3.0; use MPI_Comm_get_errhandler instead.");
2768+
__mpi_interface_removed__(MPI_Errhandler_get, MPI_Comm_get_errhandler);
27102769
OMPI_DECLSPEC int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)
2711-
__mpi_interface_removed__("PMPI_Errhandler_get was removed in MPI-3.0; use PMPI_Comm_get_errhandler instead.");
2770+
__mpi_interface_removed__(PMPI_Errhandler_get, PMPI_Comm_get_errhandler);
27122771
OMPI_DECLSPEC int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
2713-
__mpi_interface_removed__("MPI_Errhandler_set was removed in MPI-3.0; use MPI_Comm_set_errhandler instead.");
2772+
__mpi_interface_removed__(MPI_Errhandler_set, MPI_Comm_set_errhandler);
27142773
OMPI_DECLSPEC int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
2715-
__mpi_interface_removed__("PMPI_Errhandler_set was removed in MPI-3.0; use PMPI_Comm_set_errhandler instead.");
2774+
__mpi_interface_removed__(PMPI_Errhandler_set, PMPI_Comm_set_errhandler);
27162775
OMPI_DECLSPEC int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent)
2717-
__mpi_interface_removed__("MPI_Type_extent was removed in MPI-3.0; use MPI_Type_get_extent instead.");
2776+
__mpi_interface_removed__(MPI_Type_extent, MPI_Type_get_extent);
27182777
OMPI_DECLSPEC int PMPI_Type_extent(MPI_Datatype type, MPI_Aint *extent)
2719-
__mpi_interface_removed__("PMPI_Type_extent was removed in MPI-3.0; use PMPI_Type_get_extent instead.");
2778+
__mpi_interface_removed__(PMPI_Type_extent, PMPI_Type_get_extent);
27202779
OMPI_DECLSPEC int MPI_Type_hindexed(int count, int array_of_blocklengths[],
27212780
MPI_Aint array_of_displacements[],
27222781
MPI_Datatype oldtype, MPI_Datatype *newtype)
2723-
__mpi_interface_removed__("MPI_Type_hindexed was removed in MPI-3.0; use MPI_Type_create_hindexed instead.");
2782+
__mpi_interface_removed__(MPI_Type_hindexed, MPI_Type_create_hindexed);
27242783
OMPI_DECLSPEC int PMPI_Type_hindexed(int count, int array_of_blocklengths[],
27252784
MPI_Aint array_of_displacements[],
27262785
MPI_Datatype oldtype, MPI_Datatype *newtype)
2727-
__mpi_interface_removed__("PMPI_Type_hindexed was removed in MPI-3.0; use PMPI_Type_create_hindexed instead.");
2786+
__mpi_interface_removed__(PMPI_Type_hindexed, PMPI_Type_create_hindexed);
27282787
OMPI_DECLSPEC int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride,
27292788
MPI_Datatype oldtype, MPI_Datatype *newtype)
2730-
__mpi_interface_removed__("MPI_Type_hvector was removed in MPI-3.0; use MPI_Type_create_hvector instead.");
2789+
__mpi_interface_removed__(MPI_Type_hvector, MPI_Type_create_hvector);
27312790
OMPI_DECLSPEC int PMPI_Type_hvector(int count, int blocklength, MPI_Aint stride,
27322791
MPI_Datatype oldtype, MPI_Datatype *newtype)
2733-
__mpi_interface_removed__("PMPI_Type_hvector was removed in MPI-3.0; use PMPI_Type_create_hvector instead.");
2792+
__mpi_interface_removed__(PMPI_Type_hvector, PMPI_Type_create_hvector);
27342793
OMPI_DECLSPEC int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb)
2735-
__mpi_interface_removed__("MPI_Type_lb has been removed in MPI-3.0; use MPI_Type_get_extent instead.");
2794+
__mpi_interface_removed__(MPI_Type_lb, MPI_Type_get_extent);
27362795
OMPI_DECLSPEC int PMPI_Type_lb(MPI_Datatype type, MPI_Aint *lb)
2737-
__mpi_interface_removed__("PMPI_Type_lb has been removed in MPI-3.0; use PMPI_Type_get_extent instead.");
2796+
__mpi_interface_removed__(PMPI_Type_lb, PMPI_Type_get_extent);
27382797
OMPI_DECLSPEC int MPI_Type_struct(int count, int array_of_blocklengths[],
27392798
MPI_Aint array_of_displacements[],
27402799
MPI_Datatype array_of_types[],
27412800
MPI_Datatype *newtype)
2742-
__mpi_interface_removed__("MPI_Type_struct was removed in MPI-3.0; use MPI_Type_create_struct instead.");
2801+
__mpi_interface_removed__(MPI_Type_struct, MPI_Type_create_struct);
27432802
OMPI_DECLSPEC int PMPI_Type_struct(int count, int array_of_blocklengths[],
27442803
MPI_Aint array_of_displacements[],
27452804
MPI_Datatype array_of_types[],
27462805
MPI_Datatype *newtype)
2747-
__mpi_interface_removed__("PMPI_Type_struct was removed in MPI-3.0; use PMPI_Type_create_struct instead.");
2806+
__mpi_interface_removed__(PMPI_Type_struct, PMPI_Type_create_struct);
27482807
OMPI_DECLSPEC int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub)
2749-
__mpi_interface_removed__("MPI_Type_ub has been removed in MPI-3.0; use MPI_Type_get_extent instead.");
2808+
__mpi_interface_removed__(MPI_Type_ub, MPI_Type_get_extent);
27502809
OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub)
2751-
__mpi_interface_removed__("PMPI_Type_ub has been removed in MPI-3.0; use PMPI_Type_get_extent instead.");
2810+
__mpi_interface_removed__(PMPI_Type_ub, PMPI_Type_get_extent);
27522811
#endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */
27532812

2813+
#if OMPI_REMOVED_USE_STATIC_ASSERT
2814+
#define MPI_Address(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Address, MPI_Get_address)
2815+
#define MPI_Errhandler_create(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Errhandler_create, MPI_Comm_create_errhandler)
2816+
#define MPI_Errhandler_get(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Errhandler_get, MPI_Comm_get_errhandler)
2817+
#define MPI_Errhandler_set(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Errhandler_set, MPI_Comm_set_errhandler)
2818+
#define MPI_Type_extent(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_extent, MPI_Type_get_extent)
2819+
#define MPI_Type_hindexed(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_hindexed, MPI_Type_create_hindexed)
2820+
#define MPI_Type_hvector(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_hvector, MPI_Type_create_hvector)
2821+
#define MPI_Type_lb(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_lb, MPI_Type_get_extent)
2822+
#define MPI_Type_struct(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_struct, MPI_Type_create_struct)
2823+
#define MPI_Type_ub(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_ub, MPI_Type_get_extent)
2824+
#endif
2825+
27542826
#if defined(c_plusplus) || defined(__cplusplus)
27552827
}
27562828
#endif

ompi/mpi/c/address.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2019 IBM Corporation. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -21,6 +22,12 @@
2122
#include "ompi_config.h"
2223
#include <stdio.h>
2324

25+
/* This implementation has been removed from the MPI 3.0 standard.
26+
* Open MPI v4.0.x is keeping the implementation in the library, but
27+
* removing the prototypes from the headers, unless the user configures
28+
* with --enable-mpi1-compatibility.
29+
*/
30+
2431
#include "ompi/mpi/c/bindings.h"
2532
#include "ompi/runtime/params.h"
2633
#include "ompi/communicator/communicator.h"
@@ -30,6 +37,10 @@
3037
#if OPAL_HAVE_WEAK_SYMBOLS
3138
#pragma weak MPI_Address = PMPI_Address
3239
#endif
40+
/* undef before defining, to prevent possible redefinition when
41+
* using _Static_assert to error on usage of removed functions.
42+
*/
43+
#undef MPI_Address
3344
#define MPI_Address PMPI_Address
3445
#endif
3546

ompi/mpi/c/errhandler_create.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2019 IBM Corporation. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -20,6 +21,12 @@
2021

2122
#include "ompi_config.h"
2223

24+
/* This implementation has been removed from the MPI 3.0 standard.
25+
* Open MPI v4.0.x is keeping the implementation in the library, but
26+
* removing the prototypes from the headers, unless the user configures
27+
* with --enable-mpi1-compatibility.
28+
*/
29+
2330
#include "ompi/mpi/c/bindings.h"
2431
#include "ompi/communicator/communicator.h"
2532
#include "ompi/errhandler/errhandler.h"
@@ -28,6 +35,10 @@
2835
#if OPAL_HAVE_WEAK_SYMBOLS
2936
#pragma weak MPI_Errhandler_create = PMPI_Errhandler_create
3037
#endif
38+
/* undef before defining, to prevent possible redefinition when
39+
* using _Static_assert to error on usage of removed functions.
40+
*/
41+
#undef MPI_Errhandler_create
3142
#define MPI_Errhandler_create PMPI_Errhandler_create
3243
#endif
3344

ompi/mpi/c/errhandler_get.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2019 IBM Corporation. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -20,6 +21,12 @@
2021

2122
#include "ompi_config.h"
2223

24+
/* This implementation has been removed from the MPI 3.0 standard.
25+
* Open MPI v4.0.x is keeping the implementation in the library, but
26+
* removing the prototypes from the headers, unless the user configures
27+
* with --enable-mpi1-compatibility.
28+
*/
29+
2330
#include "ompi/mpi/c/bindings.h"
2431
#include "ompi/runtime/params.h"
2532
#include "ompi/communicator/communicator.h"
@@ -30,6 +37,10 @@
3037
#if OPAL_HAVE_WEAK_SYMBOLS
3138
#pragma weak MPI_Errhandler_get = PMPI_Errhandler_get
3239
#endif
40+
/* undef before defining, to prevent possible redefinition when
41+
* using _Static_assert to error on usage of removed functions.
42+
*/
43+
#undef MPI_Errhandler_get
3344
#define MPI_Errhandler_get PMPI_Errhandler_get
3445
#endif
3546

ompi/mpi/c/errhandler_set.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2019 IBM Corporation. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -20,6 +21,12 @@
2021

2122
#include "ompi_config.h"
2223

24+
/* This implementation has been removed from the MPI 3.0 standard.
25+
* Open MPI v4.0.x is keeping the implementation in the library, but
26+
* removing the prototypes from the headers, unless the user configures
27+
* with --enable-mpi1-compatibility.
28+
*/
29+
2330
#include "ompi/mpi/c/bindings.h"
2431
#include "ompi/runtime/params.h"
2532
#include "ompi/communicator/communicator.h"
@@ -30,6 +37,10 @@
3037
#if OPAL_HAVE_WEAK_SYMBOLS
3138
#pragma weak MPI_Errhandler_set = PMPI_Errhandler_set
3239
#endif
40+
/* undef before defining, to prevent possible redefinition when
41+
* using _Static_assert to error on usage of removed functions.
42+
*/
43+
#undef MPI_Errhandler_set
3344
#define MPI_Errhandler_set PMPI_Errhandler_set
3445
#endif
3546

ompi/mpi/c/type_extent.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2019 IBM Corporation. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -20,6 +21,12 @@
2021

2122
#include "ompi_config.h"
2223

24+
/* This implementation has been removed from the MPI 3.0 standard.
25+
* Open MPI v4.0.x is keeping the implementation in the library, but
26+
* removing the prototypes from the headers, unless the user configures
27+
* with --enable-mpi1-compatibility.
28+
*/
29+
2330
#include "ompi/mpi/c/bindings.h"
2431
#include "ompi/runtime/params.h"
2532
#include "ompi/communicator/communicator.h"
@@ -31,6 +38,10 @@
3138
#if OPAL_HAVE_WEAK_SYMBOLS
3239
#pragma weak MPI_Type_extent = PMPI_Type_extent
3340
#endif
41+
/* undef before defining, to prevent possible redefinition when
42+
* using _Static_assert to error on usage of removed functions.
43+
*/
44+
#undef MPI_Type_extent
3445
#define MPI_Type_extent PMPI_Type_extent
3546
#endif
3647

0 commit comments

Comments
 (0)