Skip to content

Commit 5320468

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]> (cherry-picked from 3d76b23)
1 parent 0af10b7 commit 5320468

11 files changed

+201
-65
lines changed

ompi/include/mpi.h.in

Lines changed: 105 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
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.
23+
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
2324
* $COPYRIGHT$
2425
*
2526
* Additional copyrights may follow
@@ -279,9 +280,50 @@
279280
# define __mpi_interface_deprecated__(msg) __attribute__((__deprecated__))
280281
# endif
281282
# endif
282-
# if (OMPI_ENABLE_MPI1_COMPAT && !OMPI_BUILDING)
283-
# 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
284320
# 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
285327
# endif
286328
# endif
287329
# endif
@@ -297,7 +339,15 @@
297339
#endif
298340

299341
#if !defined(__mpi_interface_removed__)
300-
# 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
301351
#endif
302352

303353
#if !defined(OMPI_OMIT_MPI1_COMPAT_DECLS)
@@ -1010,22 +1060,32 @@ OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_env;
10101060
OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUS_IGNORE;
10111061
OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE;
10121062

1013-
#if (!OMPI_OMIT_MPI1_COMPAT_DECLS || OMPI_BUILDING)
10141063
/*
10151064
* Removed datatypes. These datatypes are only available if Open MPI
10161065
* was configured with --enable-mpi1-compatibility.
10171066
*
10181067
* These datatypes were formally removed from the MPI specification
10191068
* and should no longer be used in MPI applications.
10201069
*/
1021-
#define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub)
1022-
#define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb)
1070+
#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING)
1071+
# define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub)
1072+
# define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb)
1073+
1074+
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb;
1075+
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub;
1076+
1077+
#else
1078+
/* If not building or configured --enable-mpi1-compatibility, then
1079+
* we don't want these datatypes, instead we define MPI_UB and
1080+
* MPI_LB to our Static Assert message if the compiler supports
1081+
* that staticly assert with a nice message.
1082+
*/
1083+
# if (OMPI_REMOVED_USE_STATIC_ASSERT)
1084+
# define MPI_UB OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_UB, MPI_Type_create_resized);
1085+
# define MPI_LB OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_LB, MPI_Type_create_resized);
1086+
# endif /* OMPI_REMOVED_USE_STATIC_ASSERT */
1087+
#endif /* Removed datatypes */
10231088

1024-
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb
1025-
__mpi_interface_removed__("MPI_LB was removed in MPI-3.0; use MPI_Type_create_resized instead.");
1026-
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub
1027-
__mpi_interface_removed__("MPI_UB was removed in MPI-3.0; use MPI_Type_create_resized instead.");
1028-
#endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */
10291089

10301090
/*
10311091
* MPI predefined handles
@@ -2695,61 +2755,74 @@ typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...);
26952755
* and should no longer be used in MPI applications.
26962756
*/
26972757
OMPI_DECLSPEC int MPI_Address(void *location, MPI_Aint *address)
2698-
__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);
26992759
OMPI_DECLSPEC int PMPI_Address(void *location, MPI_Aint *address)
2700-
__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);
27012761
OMPI_DECLSPEC int MPI_Errhandler_create(MPI_Handler_function *function,
27022762
MPI_Errhandler *errhandler)
2703-
__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);
27042764
OMPI_DECLSPEC int PMPI_Errhandler_create(MPI_Handler_function *function,
27052765
MPI_Errhandler *errhandler)
2706-
__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);
27072767
OMPI_DECLSPEC int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)
2708-
__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);
27092769
OMPI_DECLSPEC int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)
2710-
__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);
27112771
OMPI_DECLSPEC int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
2712-
__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);
27132773
OMPI_DECLSPEC int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
2714-
__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);
27152775
OMPI_DECLSPEC int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent)
2716-
__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);
27172777
OMPI_DECLSPEC int PMPI_Type_extent(MPI_Datatype type, MPI_Aint *extent)
2718-
__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);
27192779
OMPI_DECLSPEC int MPI_Type_hindexed(int count, int array_of_blocklengths[],
27202780
MPI_Aint array_of_displacements[],
27212781
MPI_Datatype oldtype, MPI_Datatype *newtype)
2722-
__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);
27232783
OMPI_DECLSPEC int PMPI_Type_hindexed(int count, int array_of_blocklengths[],
27242784
MPI_Aint array_of_displacements[],
27252785
MPI_Datatype oldtype, MPI_Datatype *newtype)
2726-
__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);
27272787
OMPI_DECLSPEC int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride,
27282788
MPI_Datatype oldtype, MPI_Datatype *newtype)
2729-
__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);
27302790
OMPI_DECLSPEC int PMPI_Type_hvector(int count, int blocklength, MPI_Aint stride,
27312791
MPI_Datatype oldtype, MPI_Datatype *newtype)
2732-
__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);
27332793
OMPI_DECLSPEC int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb)
2734-
__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);
27352795
OMPI_DECLSPEC int PMPI_Type_lb(MPI_Datatype type, MPI_Aint *lb)
2736-
__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);
27372797
OMPI_DECLSPEC int MPI_Type_struct(int count, int array_of_blocklengths[],
27382798
MPI_Aint array_of_displacements[],
27392799
MPI_Datatype array_of_types[],
27402800
MPI_Datatype *newtype)
2741-
__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);
27422802
OMPI_DECLSPEC int PMPI_Type_struct(int count, int array_of_blocklengths[],
27432803
MPI_Aint array_of_displacements[],
27442804
MPI_Datatype array_of_types[],
27452805
MPI_Datatype *newtype)
2746-
__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);
27472807
OMPI_DECLSPEC int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub)
2748-
__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);
27492809
OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub)
2750-
__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);
27512811
#endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */
27522812

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+
27532826
#if defined(c_plusplus) || defined(__cplusplus)
27542827
}
27552828
#endif

ompi/mpi/c/address.c

Lines changed: 6 additions & 6 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,16 +22,11 @@
2122
#include "ompi_config.h"
2223
#include <stdio.h>
2324

24-
/* This implementation has been removed from the MPI 3.1 standard.
25+
/* This implementation has been removed from the MPI 3.0 standard.
2526
* Open MPI v4.0.x is keeping the implementation in the library, but
2627
* removing the prototypes from the headers, unless the user configures
2728
* with --enable-mpi1-compatibility.
28-
*
29-
* To prevent having to port these implementations of removed functions
30-
* to the newer MPI calls, we are defining ENABLE_MPI1_COMPAT to 1
31-
* before including the c bindings.
3229
*/
33-
#define ENABLE_MPI1_COMPAT 1
3430

3531
#include "ompi/mpi/c/bindings.h"
3632
#include "ompi/runtime/params.h"
@@ -41,6 +37,10 @@
4137
#if OPAL_HAVE_WEAK_SYMBOLS
4238
#pragma weak MPI_Address = PMPI_Address
4339
#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
4444
#define MPI_Address PMPI_Address
4545
#endif
4646

ompi/mpi/c/errhandler_create.c

Lines changed: 10 additions & 3 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,9 +21,11 @@
2021

2122
#include "ompi_config.h"
2223

23-
/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here.
24-
* see comments in address.c for more information. */
25-
#define ENABLE_MPI1_COMPAT 1
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+
*/
2629

2730
#include "ompi/mpi/c/bindings.h"
2831
#include "ompi/communicator/communicator.h"
@@ -32,6 +35,10 @@
3235
#if OPAL_HAVE_WEAK_SYMBOLS
3336
#pragma weak MPI_Errhandler_create = PMPI_Errhandler_create
3437
#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
3542
#define MPI_Errhandler_create PMPI_Errhandler_create
3643
#endif
3744

ompi/mpi/c/errhandler_get.c

Lines changed: 10 additions & 3 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,9 +21,11 @@
2021

2122
#include "ompi_config.h"
2223

23-
/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here.
24-
* see comments in address.c for more information. */
25-
#define ENABLE_MPI1_COMPAT 1
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+
*/
2629

2730
#include "ompi/mpi/c/bindings.h"
2831
#include "ompi/runtime/params.h"
@@ -34,6 +37,10 @@
3437
#if OPAL_HAVE_WEAK_SYMBOLS
3538
#pragma weak MPI_Errhandler_get = PMPI_Errhandler_get
3639
#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
3744
#define MPI_Errhandler_get PMPI_Errhandler_get
3845
#endif
3946

ompi/mpi/c/errhandler_set.c

Lines changed: 10 additions & 3 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,9 +21,11 @@
2021

2122
#include "ompi_config.h"
2223

23-
/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here.
24-
* see comments in address.c for more information. */
25-
#define ENABLE_MPI1_COMPAT 1
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+
*/
2629

2730
#include "ompi/mpi/c/bindings.h"
2831
#include "ompi/runtime/params.h"
@@ -34,6 +37,10 @@
3437
#if OPAL_HAVE_WEAK_SYMBOLS
3538
#pragma weak MPI_Errhandler_set = PMPI_Errhandler_set
3639
#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
3744
#define MPI_Errhandler_set PMPI_Errhandler_set
3845
#endif
3946

ompi/mpi/c/type_extent.c

Lines changed: 10 additions & 3 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,9 +21,11 @@
2021

2122
#include "ompi_config.h"
2223

23-
/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here.
24-
* see comments in address.c for more information. */
25-
#define ENABLE_MPI1_COMPAT 1
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+
*/
2629

2730
#include "ompi/mpi/c/bindings.h"
2831
#include "ompi/runtime/params.h"
@@ -35,6 +38,10 @@
3538
#if OPAL_HAVE_WEAK_SYMBOLS
3639
#pragma weak MPI_Type_extent = PMPI_Type_extent
3740
#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
3845
#define MPI_Type_extent PMPI_Type_extent
3946
#endif
4047

0 commit comments

Comments
 (0)