Skip to content

Commit

Permalink
Fixes Issue 6278 (removed prototypes only warning)
Browse files Browse the repository at this point in the history
1) Changes the prototypes for MPI removed functions in the
   following ways:

   There are 3 cases:

     - User wants MPI-1 compatibility (--enable-mpi1-compatibility)

          MPI_Address (and friends) are declared in mpi.h with the
          deprecation notice

     - User does not want MPI-1 compatibility, and has a C11-capable
       compiler

          Declare an MPI_Address (etc.) macro in mpi.h like this
          (which will cause a compile-time error):

      - User does not want MPI-1 compatibility, and does not have a
        C11-capable compiler

          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).
  • Loading branch information
gpaulsen committed Feb 8, 2019
1 parent fcbc7ea commit b6f207d
Showing 1 changed file with 65 additions and 50 deletions.
115 changes: 65 additions & 50 deletions ompi/include/mpi.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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$
*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 *,
Expand All @@ -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");

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit b6f207d

Please sign in to comment.