diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 864b0e726b1..08beae1783b 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -19,7 +19,7 @@ * Copyright (c) 2015 University of Houston. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017-2018 IBM Corporation. All rights reserved. + * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * @@ -280,9 +280,23 @@ # define __mpi_interface_deprecated__(msg) __attribute__((__deprecated__)) # endif # endif -# if OMPI_ENABLE_MPI1_COMPAT -# define __mpi_interface_removed__(msg) __mpi_interface_deprecated__(msg) -# define OMPI_OMIT_MPI1_COMPAT_DECLS 0 + /* For removed API, there is no portable way to cause the + * C compiler to error with a nice message on the usage of + * one of these symbols, so instead we use a C11 static_assert + * If the user is not using a C11 compiler, they will get an + * undefined reference, but no line number or nice message. + */ +# if (OMPI_ENABLE_MPI1_COMPAT && !OMPI_BUILDING) +# define OMPI_OMIT_MPI1_COMPAT_DECLS 0 +# if (__STDC_VERSION__ >= 201112L) +# define MPI_INTERFACE_REMOVED(func, newfunc, ...) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") +# else +# if OPAL_HAVE_ATTRIBUTE_ERROR +# define MPI_INTERFACE_REMOVED(func, newfunc, ...) func(__VA_ARGS) __attribute__((__error__(#func " was removed in MPI-3.0. Use " #newfunc " instead."))) +# else +# define MPI_INTERFACE_REMOVED(func, newfunc, ...) func(__VA_ARGS) +# endif +# endif # endif # endif # endif @@ -389,10 +403,10 @@ typedef int (MPI_Datarep_conversion_function)(void *, MPI_Datatype, typedef void (MPI_Comm_errhandler_function)(MPI_Comm *, int *, ...); /* This is a little hackish, but errhandler.h needs space for a - MPI_File_errhandler_function. While it could just be removed, this + MPI_File_errhandler_fn. While it could just be removed, this allows us to maintain a stable ABI within OMPI, at least for apps that don't use MPI I/O. */ -typedef void (ompi_file_errhandler_function)(MPI_File *, int *, ...); +typedef void (ompi_file_errhandler_fn)(MPI_File *, int *, ...); typedef void (MPI_Win_errhandler_function)(MPI_Win *, int *, ...); typedef void (MPI_User_function)(void *, void *, int *, MPI_Datatype *); typedef int (MPI_Comm_copy_attr_function)(MPI_Comm, int, void *, @@ -415,9 +429,9 @@ typedef int (MPI_Grequest_cancel_function)(void *, int); */ typedef MPI_Comm_errhandler_function MPI_Comm_errhandler_fn __mpi_interface_deprecated__("MPI_Comm_errhandler_fn was deprecated in MPI-2.2; use MPI_Comm_errhandler_function instead"); -typedef ompi_file_errhandler_function MPI_File_errhandler_fn +typedef ompi_file_errhandler_fn MPI_File_errhandler_fn __mpi_interface_deprecated__("MPI_File_errhandler_fn was deprecated in MPI-2.2; use MPI_File_errhandler_function instead"); -typedef ompi_file_errhandler_function MPI_File_errhandler_function; +typedef ompi_file_errhandler_fn MPI_File_errhandler_function; typedef MPI_Win_errhandler_function MPI_Win_errhandler_fn __mpi_interface_deprecated__("MPI_Win_errhandler_fn was deprecated in MPI-2.2; use MPI_Win_errhandler_function instead"); @@ -1005,7 +1019,7 @@ OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_env; OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUS_IGNORE; OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE; -#if !OMPI_OMIT_MPI1_COMPAT_DECLS +#if (!OMPI_OMIT_MPI1_COMPAT_DECLS || OMPI_BUILDING) /* * Removed datatypes. These datatypes are only available if Open MPI * was configured with --enable-mpi1-compatibility. @@ -2672,7 +2686,7 @@ OMPI_DECLSPEC int OMPI_C_MPI_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, void* extra_state ) __mpi_interface_deprecated__("MPI_NULL_DELETE_FN was deprecated in MPI-2.0; use MPI_COMM_NULL_DELETE_FN instead."); -#if !OMPI_OMIT_MPI1_COMPAT_DECLS +#if (!OMPI_OMIT_MPI1_COMPAT_DECLS || OMPI_BUILDING) /* * Removed typedefs. These typedefs are only available if Open MPI * was configured with --enable-mpi1-compatibility. @@ -2695,62 +2709,63 @@ typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...); * These functions were formally removed from the MPI specification * and should no longer be used in MPI applications. */ -OMPI_DECLSPEC int MPI_Address(void *location, MPI_Aint *address) - __mpi_interface_removed__("MPI_Address was removed in MPI-3.0; use MPI_Get_address instead."); -OMPI_DECLSPEC int PMPI_Address(void *location, MPI_Aint *address) - __mpi_interface_removed__("PMPI_Address was removed in MPI-3.0; use MPI_Get_address instead."); +OMPI_DECLSPEC int MPI_Address(void *location, MPI_Aint *address); +#define MPI_Address(...) MPI_INTERFACE_REMOVED(MPI_Address, MPI_Get_address) +OMPI_DECLSPEC int PMPI_Address(void *location, MPI_Aint *address); +#define PMPI_Address(...) MPI_INTERFACE_REMOVED(PMPI_Address, PMPI_Get_address) OMPI_DECLSPEC int MPI_Errhandler_create(MPI_Handler_function *function, - MPI_Errhandler *errhandler) - __mpi_interface_removed__("MPI_Errhandler_create was removed in MPI-3.0; use MPI_Comm_create_errhandler instead."); + MPI_Errhandler *errhandler); +#define MPI_Errhandler_create MPI_INTERFACE_REMOVED(MPI_Errhandler_create, MPI_Comm_create_errhandler) OMPI_DECLSPEC int PMPI_Errhandler_create(MPI_Handler_function *function, - MPI_Errhandler *errhandler) - __mpi_interface_removed__("PMPI_Errhandler_create was removed in MPI-3.0; use PMPI_Comm_create_errhandler instead."); -OMPI_DECLSPEC int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler) - __mpi_interface_removed__("MPI_Errhandler_get was removed in MPI-3.0; use MPI_Comm_get_errhandler instead."); -OMPI_DECLSPEC int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler) - __mpi_interface_removed__("PMPI_Errhandler_get was removed in MPI-3.0; use PMPI_Comm_get_errhandler instead."); -OMPI_DECLSPEC int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) - __mpi_interface_removed__("MPI_Errhandler_set was removed in MPI-3.0; use MPI_Comm_set_errhandler instead."); -OMPI_DECLSPEC int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) - __mpi_interface_removed__("PMPI_Errhandler_set was removed in MPI-3.0; use PMPI_Comm_set_errhandler instead."); -OMPI_DECLSPEC int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent) - __mpi_interface_removed__("MPI_Type_extent was removed in MPI-3.0; use MPI_Type_get_extent instead."); -OMPI_DECLSPEC int PMPI_Type_extent(MPI_Datatype type, MPI_Aint *extent) - __mpi_interface_removed__("PMPI_Type_extent was removed in MPI-3.0; use PMPI_Type_get_extent instead."); + MPI_Errhandler *errhandler); +#define PMPI_Errhandler_create MPI_INTERFACE_REMOVED(PMPI_Errhandler_create, PMPI_Comm_create_errhandler) +OMPI_DECLSPEC int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler); +#define MPI_Errhandler_get(...) MPI_INTERFACE_REMOVED(MPI_Errhandler_get, MPI_Comm_get_errhandler) +OMPI_DECLSPEC int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler); +#define PMPI_Errhandler_get(...) MPI_INTERFACE_REMOVED(PMPI_Errhandler_get, PMPI_Comm_get_errhandler) +OMPI_DECLSPEC int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler); +#define MPI_Errhandler_set(...) MPI_INTERFACE_REMOVED(MPI_Errhandler_set, MPI_Comm_set_errhandler) +OMPI_DECLSPEC int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler); +#define PMPI_Errhandler_set(...) MPI_INTERFACE_REMOVED(PMPI_Errhandler_set, PMPI_Comm_set_errhandler) +OMPI_DECLSPEC int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent); +#define MPI_Type_extent(...) MPI_INTERFACE_REMOVED(MPI_Type_extent, MPI_Type_get_extent) +OMPI_DECLSPEC int PMPI_Type_extent(MPI_Datatype type, MPI_Aint *extent); +#define PMPI_Type_extent(...) MPI_INTERFACE_REMOVED(PMPI_Type_extent, PMPI_Type_get_extent) OMPI_DECLSPEC int MPI_Type_hindexed(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], - MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_hindexed was removed in MPI-3.0; use MPI_Type_create_hindexed instead."); + MPI_Datatype oldtype, MPI_Datatype *newtype); +#define MPI_Type_hindexed(...) MPI_INTERFACE_REMOVED(MPI_Type_hindexed, MPI_Type_create_hindexed) OMPI_DECLSPEC int PMPI_Type_hindexed(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], - MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("PMPI_Type_hindexed was removed in MPI-3.0; use PMPI_Type_create_hindexed instead."); + MPI_Datatype oldtype, MPI_Datatype *newtype); +#define PMPI_Type_hindexed(...) MPI_INTERFACE_REMOVED(PMPI_Type_hindexed, PMPI_Type_create_hindexed) OMPI_DECLSPEC int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride, - MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_hvector was removed in MPI-3.0; use MPI_Type_create_hvector instead."); + MPI_Datatype oldtype, MPI_Datatype *newtype); +#define MPI_Type_hvector(...) MPI_INTERFACE_REMOVED(MPI_Type_hvector, MPI_Type_create_hvector) OMPI_DECLSPEC int PMPI_Type_hvector(int count, int blocklength, MPI_Aint stride, - MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("PMPI_Type_hvector was removed in MPI-3.0; use PMPI_Type_create_hvector instead."); -OMPI_DECLSPEC int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb) - __mpi_interface_removed__("MPI_Type_lb has been removed in MPI-3.0; use MPI_Type_get_extent instead."); -OMPI_DECLSPEC int PMPI_Type_lb(MPI_Datatype type, MPI_Aint *lb) - __mpi_interface_removed__("PMPI_Type_lb has been removed in MPI-3.0; use PMPI_Type_get_extent instead."); + MPI_Datatype oldtype, MPI_Datatype *newtype); +#define PMPI_Type_hvector(...) MPI_INTERFACE_REMOVED(PMPI_Type_hvector, PMPI_Type_create_hvector) +OMPI_DECLSPEC int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb); +#define MPI_Type_lb(...) MPI_INTERFACE_REMOVED(MPI_Type_lb, MPI_Type_get_extent) +OMPI_DECLSPEC int PMPI_Type_lb(MPI_Datatype type, MPI_Aint *lb); +#define PMPI_Type_lb(...) MPI_INTERFACE_REMOVED(PMPI_Type_lb, PMPI_Type_get_extent) OMPI_DECLSPEC int MPI_Type_struct(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype array_of_types[], - MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_struct was removed in MPI-3.0; use MPI_Type_create_struct instead."); + MPI_Datatype *newtype); +#define MPI_Type_struct MPI_INTERFACE_REMOVED(MPI_Type_struct, MPI_Type_create_struct) OMPI_DECLSPEC int PMPI_Type_struct(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype array_of_types[], - MPI_Datatype *newtype) - __mpi_interface_removed__("PMPI_Type_struct was removed in MPI-3.0; use PMPI_Type_create_struct instead."); -OMPI_DECLSPEC int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) - __mpi_interface_removed__("MPI_Type_ub has been removed in MPI-3.0; use MPI_Type_get_extent instead."); -OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) - __mpi_interface_removed__("PMPI_Type_ub has been removed in MPI-3.0; use PMPI_Type_get_extent instead."); + MPI_Datatype *newtype); +#define PMPI_Type_struct MPI_INTERFACE_REMOVED(PMPI_Type_struct, PMPI_Type_create_struct) +OMPI_DECLSPEC int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub); +#define MPI_Type_ub(...) MPI_INTERFACE_REMOVED(MPI_Type_ub, MPI_Type_get_extent) +OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub); +#define PMPI_Type_ub(...) MPI_INTERFACE_REMOVED(PMPI_Type_ub, PMPI_Type_get_extent) #endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ + #if defined(c_plusplus) || defined(__cplusplus) } #endif