Blame src/include/mpir_err.h

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *  (C) 2001 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
#ifndef MPIR_ERR_H_INCLUDED
Packit Service c5cf8c
#define MPIR_ERR_H_INCLUDED
Packit Service c5cf8c
Packit Service c5cf8c
/* Error severity */
Packit Service c5cf8c
#define MPIR_ERR_FATAL 1
Packit Service c5cf8c
#define MPIR_ERR_RECOVERABLE 0
Packit Service c5cf8c
Packit Service c5cf8c
struct MPIR_Comm;
Packit Service c5cf8c
struct MPIR_Win;
Packit Service c5cf8c
Packit Service c5cf8c
/* Bindings for internal routines */
Packit Service c5cf8c
MPICH_API_PUBLIC int MPIR_Err_return_comm(struct MPIR_Comm *, const char[], int);
Packit Service c5cf8c
MPICH_API_PUBLIC int MPIR_Err_return_win(struct MPIR_Win *, const char[], int);
Packit Service c5cf8c
#ifdef MPI__FILE_DEFINED
Packit Service c5cf8c
/* Only define if we have MPI_File */
Packit Service c5cf8c
MPICH_API_PUBLIC int MPIR_Err_return_file(MPI_File, const char[], int); /* Romio version */
Packit Service c5cf8c
#endif
Packit Service c5cf8c
/* FIXME:
Packit Service c5cf8c
 * Update this description to match the current version of the routine,
Packit Service c5cf8c
 * in particular, the pseudo-format types (even better, fix it so that
Packit Service c5cf8c
 * the pseudo format types can work with the format attribute check).
Packit Service c5cf8c
 */
Packit Service c5cf8c
/*@
Packit Service c5cf8c
  MPIR_Err_create_code - Create an error code and associated message
Packit Service c5cf8c
  to report an error
Packit Service c5cf8c
Packit Service c5cf8c
  Input Parameters:
Packit Service c5cf8c
+ lastcode - Previous error code (see notes)
Packit Service c5cf8c
. severity  - Indicates severity of error
Packit Service c5cf8c
. fcname - Name of the function in which the error has occurred.
Packit Service c5cf8c
. line  - Line number (usually '__LINE__')
Packit Service c5cf8c
. class - Error class
Packit Service c5cf8c
. generic_msg - A generic message to be used if not instance-specific
Packit Service c5cf8c
 message is available
Packit Service c5cf8c
. instance_msg - A message containing printf-style formatting commands
Packit Service c5cf8c
  that, when combined with the instance_parameters, specify an error
Packit Service c5cf8c
  message containing instance-specific data.
Packit Service c5cf8c
- instance_parameters - The remaining parameters.  These must match
Packit Service c5cf8c
 the formatting commands in 'instance_msg'.
Packit Service c5cf8c
Packit Service c5cf8c
 Notes:
Packit Service c5cf8c
 A typical use is\:
Packit Service c5cf8c
.vb
Packit Service c5cf8c
   mpi_errno = MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE,
Packit Service c5cf8c
               FCNAME, __LINE__, MPI_ERR_RANK,
Packit Service c5cf8c
               "Invalid Rank", "Invalid rank %d", rank);
Packit Service c5cf8c
.ve
Packit Service c5cf8c
Packit Service c5cf8c
  Predefined message may also be used.  Any message that uses the
Packit Service c5cf8c
  prefix '"**"' will be looked up in a table.  This allows standardized
Packit Service c5cf8c
  messages to be used for a message that is used in several different locations
Packit Service c5cf8c
  in the code.  For example, the name '"**rank"' might be used instead of
Packit Service c5cf8c
  '"Invalid Rank"'; this would also allow the message to be made more
Packit Service c5cf8c
  specific and useful, such as
Packit Service c5cf8c
.vb
Packit Service c5cf8c
   Invalid rank provided.  The rank must be between 0 and the 1 less than
Packit Service c5cf8c
   the size of the communicator in this call.
Packit Service c5cf8c
.ve
Packit Service c5cf8c
  This interface is compatible with the 'gettext' interface for
Packit Service c5cf8c
  internationalization, in the sense that the 'generic_msg' and 'instance_msg'
Packit Service c5cf8c
  may be used as arguments to 'gettext' to return a string in the appropriate
Packit Service c5cf8c
  language; the implementation of 'MPID_Err_create_code' can then convert
Packit Service c5cf8c
  this text into the appropriate code value.
Packit Service c5cf8c
Packit Service c5cf8c
  The current set of formatting commands is undocumented and will change.
Packit Service c5cf8c
  You may safely use '%d' and '%s' (though only use '%s' for names of
Packit Service c5cf8c
  objects, not text messages, as using '%s' for a message breaks support for
Packit Service c5cf8c
  internationalization.
Packit Service c5cf8c
Packit Service c5cf8c
  This interface allows error messages to be chained together.  The first
Packit Service c5cf8c
  argument is the last error code; if there is no previous error code,
Packit Service c5cf8c
  use 'MPI_SUCCESS'.
Packit Service c5cf8c
Packit Service c5cf8c
  Extended Format Specifiers:
Packit Service c5cf8c
  In addition to the standard format specifies (e.g., %d for an int value),
Packit Service c5cf8c
  MPIR_Err_create_code accepts some additional values that correspond to
Packit Service c5cf8c
  various MPI types:
Packit Service c5cf8c
+ i - an MPI rank; recognizes 'MPI_ANY_SOURCE', 'MPI_PROC_NULL', and
Packit Service c5cf8c
      'MPI_ROOT'
Packit Service c5cf8c
. t - an MPI tag; recognizes 'MPI_ANY_TAG'.
Packit Service c5cf8c
. A - an MPI assert value.
Packit Service c5cf8c
. C - an MPI communicator.
Packit Service c5cf8c
. D - an MPI datatype.
Packit Service c5cf8c
. E - an MPI Errhandler.
Packit Service c5cf8c
. F - an MPI File object.
Packit Service c5cf8c
. G - an MPI Group.
Packit Service c5cf8c
. I - an MPI info object.
Packit Service c5cf8c
. O - an MPI Op.
Packit Service c5cf8c
. R - an MPI Request.
Packit Service c5cf8c
- W - an MPI Window object.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
  Module:
Packit Service c5cf8c
  Error
Packit Service c5cf8c
Packit Service c5cf8c
  @*/
Packit Service c5cf8c
MPICH_API_PUBLIC int MPIR_Err_create_code(int, int, const char[], int, int, const char[],
Packit Service c5cf8c
                                          const char[], ...);
Packit Service c5cf8c
Packit Service c5cf8c
#ifdef USE_ERR_CODE_VALIST
Packit Service c5cf8c
int MPIR_Err_create_code_valist(int, int, const char[], int, int, const char[], const char[],
Packit Service c5cf8c
                                va_list);
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
/*@
Packit Service c5cf8c
  MPIR_Err_combine_codes - Combine two error codes, or more importantly
Packit Service c5cf8c
  two lists of error messages.  The list associated with the second error
Packit Service c5cf8c
  code is appended to the list associated with the first error code.  If
Packit Service c5cf8c
  the list associated with the first error code has a dangling tail, which
Packit Service c5cf8c
  is possible if the ring has wrapped and overwritten entries that were
Packit Service c5cf8c
  once part of the list, then the append operation is not performed and
Packit Service c5cf8c
  the error code for the first list is returned.
Packit Service c5cf8c
Packit Service c5cf8c
  Input Parameter:
Packit Service c5cf8c
+ errorcode1 - the error code associated with the first list
Packit Service c5cf8c
- errorcode2 - the error code associated with the second list
Packit Service c5cf8c
Packit Service c5cf8c
  Return value:
Packit Service c5cf8c
  An error code which resolves to the combined list of error messages
Packit Service c5cf8c
Packit Service c5cf8c
  Notes:
Packit Service c5cf8c
  If errorcode1 is equal to MPI_SUCCESS, then errorcode2 is returned.
Packit Service c5cf8c
  Likewise, if errorcode2 is equal to MPI_SUCCESS, then errorcode1 is
Packit Service c5cf8c
  returned.
Packit Service c5cf8c
Packit Service c5cf8c
  Module:
Packit Service c5cf8c
  Error
Packit Service c5cf8c
  @*/
Packit Service c5cf8c
int MPIR_Err_combine_codes(int, int);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Err_is_fatal(int);
Packit Service c5cf8c
void MPIR_Err_init(void);
Packit Service c5cf8c
void MPIR_Err_preOrPostInit(void);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Err_set_msg(int code, const char *msg_string);
Packit Service c5cf8c
Packit Service c5cf8c
/* This routine is called when there is a fatal error. Now public because file
Packit Service c5cf8c
 * error handling is defined in a separate file from comm and win, but all
Packit Service c5cf8c
 * three need to call it */
Packit Service c5cf8c
void MPIR_Handle_fatal_error(struct MPIR_Comm *comm_ptr, const char fcname[], int errcode);
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERR_CLASS_MASK 0x0000007f
Packit Service c5cf8c
#define MPIR_ERR_CLASS_SIZE 128
Packit Service c5cf8c
#define MPIR_ERR_GET_CLASS(mpi_errno_) (mpi_errno_ & MPIR_ERR_CLASS_MASK)
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
/* ------------------------------------------------------------------------- */
Packit Service c5cf8c
/* mpir_err.h */
Packit Service c5cf8c
/* ------------------------------------------------------------------------- */
Packit Service c5cf8c
Packit Service c5cf8c
/*
Packit Service c5cf8c
=== BEGIN_MPI_T_CVAR_INFO_BLOCK ===
Packit Service c5cf8c
Packit Service c5cf8c
cvars:
Packit Service c5cf8c
    - name        : MPIR_CVAR_COLL_ALIAS_CHECK
Packit Service c5cf8c
      category    : COLLECTIVE
Packit Service c5cf8c
      type        : int
Packit Service c5cf8c
      default     : 1
Packit Service c5cf8c
      class       : device
Packit Service c5cf8c
      verbosity   : MPI_T_VERBOSITY_USER_BASIC
Packit Service c5cf8c
      scope       : MPI_T_SCOPE_ALL_EQ
Packit Service c5cf8c
      description : >-
Packit Service c5cf8c
        Enable checking of aliasing in collective operations
Packit Service c5cf8c
Packit Service c5cf8c
=== END_MPI_T_CVAR_INFO_BLOCK ===
Packit Service c5cf8c
*/
Packit Service c5cf8c
Packit Service c5cf8c
/* Error checking (see --enable-error-checking for control of this) */
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
Packit Service c5cf8c
#define MPID_ERROR_LEVEL_ALL 1
Packit Service c5cf8c
#define MPID_ERROR_LEVEL_RUNTIME 2
Packit Service c5cf8c
/* Use MPID_ERROR_DECL to wrap declarations that are needed only when
Packit Service c5cf8c
   error checking is turned on */
Packit Service c5cf8c
#define MPID_ERROR_DECL(a) a
Packit Service c5cf8c
Packit Service c5cf8c
#if HAVE_ERROR_CHECKING == MPID_ERROR_LEVEL_ALL
Packit Service c5cf8c
#define MPID_BEGIN_ERROR_CHECKS
Packit Service c5cf8c
#define MPID_END_ERROR_CHECKS
Packit Service c5cf8c
#define MPID_ELSE_ERROR_CHECKS
Packit Service c5cf8c
#elif HAVE_ERROR_CHECKING == MPID_ERROR_LEVEL_RUNTIME
Packit Service c5cf8c
#define MPID_BEGIN_ERROR_CHECKS if (MPIR_Process.do_error_checks) {
Packit Service c5cf8c
#define MPID_ELSE_ERROR_CHECKS }else{
Packit Service c5cf8c
#define MPID_END_ERROR_CHECKS }
Packit Service c5cf8c
#else
Packit Service c5cf8c
#error "Unknown value for error checking"
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
#else
Packit Service c5cf8c
#define MPID_BEGIN_ERROR_CHECKS
Packit Service c5cf8c
#define MPID_END_ERROR_CHECKS
Packit Service c5cf8c
#define MPID_ERROR_DECL(a)
Packit Service c5cf8c
#endif /* HAVE_ERROR_CHECKING */
Packit Service c5cf8c
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *  Standardized error checking macros.  These provide the correct tests for
Packit Service c5cf8c
 *  common tests.  These set err with the encoded error value.
Packit Service c5cf8c
 */
Packit Service c5cf8c
#define MPIR_ERRTEST_SEND_TAG(tag,err)                                  \
Packit Service c5cf8c
    if ((tag) < 0 || (tag) > MPIR_Process.attrs.tag_ub) {               \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_TAG, "**tag", "**tag %d", tag); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_RECV_TAG(tag,err)                                  \
Packit Service c5cf8c
    if ((tag) < MPI_ANY_TAG || (tag) > MPIR_Process.attrs.tag_ub) {     \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_TAG, "**tag", "**tag %d", tag); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_RANK(comm_ptr,rank,err)                            \
Packit Service c5cf8c
    if ((rank) < 0 || (rank) >= (comm_ptr)->remote_size) {              \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_RANK, "**rank", "**rank %d %d", rank, \
Packit Service c5cf8c
                                   (comm_ptr)->remote_size);            \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_SEND_RANK(comm_ptr,rank,err)                       \
Packit Service c5cf8c
    if ((rank) < MPI_PROC_NULL || (rank) >= (comm_ptr)->remote_size) {  \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_RANK, "**rank", "**rank %d %d", rank, \
Packit Service c5cf8c
                                   (comm_ptr)->remote_size);            \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_RECV_RANK(comm_ptr,rank,err)                       \
Packit Service c5cf8c
    if ((rank) < MPI_ANY_SOURCE || (rank) >= (comm_ptr)->remote_size) { \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_RANK, "**rank", "**rank %d %d", rank, \
Packit Service c5cf8c
                                   (comm_ptr)->remote_size);            \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_COUNT(count,err)                           \
Packit Service c5cf8c
    if ((count) < 0) {                                          \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS,                 \
Packit Service c5cf8c
                                   MPIR_ERR_RECOVERABLE,        \
Packit Service c5cf8c
                                   FCNAME, __LINE__,            \
Packit Service c5cf8c
                                   MPI_ERR_COUNT,               \
Packit Service c5cf8c
                                   "**countneg",                \
Packit Service c5cf8c
                                   "**countneg %d",             \
Packit Service c5cf8c
                                   count);                      \
Packit Service c5cf8c
        goto fn_fail;                                           \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_DISP(disp,err)                             \
Packit Service c5cf8c
    if ((disp) < 0) {                                           \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS,                 \
Packit Service c5cf8c
                                   MPIR_ERR_RECOVERABLE,        \
Packit Service c5cf8c
                                   FCNAME, __LINE__,            \
Packit Service c5cf8c
                                   MPI_ERR_DISP,                \
Packit Service c5cf8c
                                   "**rmadisp", 0);             \
Packit Service c5cf8c
        goto fn_fail;                                           \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_ALIAS(ptr1,ptr2,err)                       \
Packit Service c5cf8c
    if ((ptr1)==(ptr2) && (ptr1) != MPI_BOTTOM) {               \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS,                 \
Packit Service c5cf8c
                                   MPIR_ERR_RECOVERABLE,        \
Packit Service c5cf8c
                                   FCNAME, __LINE__,            \
Packit Service c5cf8c
                                   MPI_ERR_BUFFER,              \
Packit Service c5cf8c
                                   "**bufalias", 0);            \
Packit Service c5cf8c
        goto fn_fail;                                           \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
/* FIXME this test is probably too broad.  Comparing the (buffer,type,count)
Packit Service c5cf8c
 * tuples is really what is needed to check for aliasing. */
Packit Service c5cf8c
#define MPIR_ERRTEST_ALIAS_COLL(ptr1,ptr2,err)                  \
Packit Service c5cf8c
    if (MPIR_CVAR_COLL_ALIAS_CHECK && (ptr1)==(ptr2)) {         \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS,                 \
Packit Service c5cf8c
                                   MPIR_ERR_RECOVERABLE,        \
Packit Service c5cf8c
                                   FCNAME, __LINE__,            \
Packit Service c5cf8c
                                   MPI_ERR_BUFFER,              \
Packit Service c5cf8c
                                   "**bufalias", 0);            \
Packit Service c5cf8c
        goto fn_fail;                                           \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_ARGNULL(arg,arg_name,err)                  \
Packit Service c5cf8c
    if (!(arg)) {                                               \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS,                 \
Packit Service c5cf8c
                                   MPIR_ERR_RECOVERABLE,        \
Packit Service c5cf8c
                                   FCNAME, __LINE__,            \
Packit Service c5cf8c
                                   MPI_ERR_ARG,                 \
Packit Service c5cf8c
                                   "**nullptr",                 \
Packit Service c5cf8c
                                   "**nullptr %s",              \
Packit Service c5cf8c
                                   arg_name);                   \
Packit Service c5cf8c
        goto fn_fail;                                           \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_ARGNEG(arg,arg_name,err)                           \
Packit Service c5cf8c
    if ((arg) < 0) {                                                    \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,   \
Packit Service c5cf8c
                                   FCNAME, __LINE__, MPI_ERR_ARG,       \
Packit Service c5cf8c
                                   "**argneg",                          \
Packit Service c5cf8c
                                   "**argneg %s %d", arg_name, arg);    \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_ARGNONPOS(arg,arg_name,err,errclass)       \
Packit Service c5cf8c
    if ((arg) <= 0) {                                           \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS,                 \
Packit Service c5cf8c
                                   MPIR_ERR_RECOVERABLE,        \
Packit Service c5cf8c
                                   FCNAME, __LINE__,            \
Packit Service c5cf8c
                                   errclass,                    \
Packit Service c5cf8c
                                   "**argnonpos",               \
Packit Service c5cf8c
                                   "**argnonpos %s %d",         \
Packit Service c5cf8c
                                   arg_name, arg);              \
Packit Service c5cf8c
        goto fn_fail;                                           \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
/* An intracommunicator must have a root between 0 and local_size-1. */
Packit Service c5cf8c
/* intercomm can be between MPI_PROC_NULL (or MPI_ROOT) and remote_size-1 */
Packit Service c5cf8c
#define MPIR_ERRTEST_INTRA_ROOT(comm_ptr,root,err)                      \
Packit Service c5cf8c
    if ((root) < 0 || (root) >= (comm_ptr)->local_size) {               \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_ROOT, "**root", "**root %d", root); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
/* We use -2 (MPI_PROC_NULL and MPI_ROOT are negative) for the
Packit Service c5cf8c
   intercomm test */
Packit Service c5cf8c
#define MPIR_ERRTEST_INTER_ROOT(comm_ptr,root,err)                      \
Packit Service c5cf8c
    if ((root) < -3 || (root) >= (comm_ptr)->remote_size) {             \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_ROOT, "**root", "**root %d", root); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_PERSISTENT(reqp,err)                               \
Packit Service c5cf8c
    if ((reqp)->kind != MPIR_REQUEST_KIND__PREQUEST_SEND && (reqp)->kind != MPIR_REQUEST_KIND__PREQUEST_RECV) { \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_REQUEST, "**requestnotpersist", 0); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_PERSISTENT_ACTIVE(reqp,err)                        \
Packit Service c5cf8c
    if (((reqp)->kind == MPIR_REQUEST_KIND__PREQUEST_SEND ||            \
Packit Service c5cf8c
         (reqp)->kind == MPIR_REQUEST_KIND__PREQUEST_RECV) && (reqp)->u.persist.real_request != NULL) { \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_REQUEST, "**requestpersistactive", 0); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_COMM_INTRA(comm_ptr, err)                          \
Packit Service c5cf8c
    if ((comm_ptr)->comm_kind != MPIR_COMM_KIND__INTRACOMM) {           \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_COMM,"**commnotintra",0);    \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_COMM_TAG(tag,err)                                  \
Packit Service c5cf8c
    if ((tag) < 0 || (tag) > MPIR_Process.attrs.tag_ub) {               \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_TAG, "**tag", "**tag %d", tag); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
/* Tests for totally meaningless datatypes first, then for
Packit Service c5cf8c
 * MPI_DATATYPE_NULL as a separate case.
Packit Service c5cf8c
 */
Packit Service c5cf8c
#define MPIR_ERRTEST_DATATYPE(datatype, name_, err_)                    \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if (HANDLE_GET_MPI_KIND(datatype) != MPIR_DATATYPE ||           \
Packit Service c5cf8c
            (HANDLE_GET_KIND(datatype) == HANDLE_KIND_INVALID &&        \
Packit Service c5cf8c
             datatype != MPI_DATATYPE_NULL))                            \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            err_ = MPIR_Err_create_code(MPI_SUCCESS,                    \
Packit Service c5cf8c
                                        MPIR_ERR_RECOVERABLE,           \
Packit Service c5cf8c
                                        FCNAME, __LINE__,               \
Packit Service c5cf8c
                                        MPI_ERR_TYPE,                   \
Packit Service c5cf8c
                                        "**dtype", 0);                  \
Packit Service c5cf8c
            goto fn_fail;                                               \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        if (datatype == MPI_DATATYPE_NULL)                              \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            err_ = MPIR_Err_create_code(MPI_SUCCESS,                    \
Packit Service c5cf8c
                                        MPIR_ERR_RECOVERABLE,           \
Packit Service c5cf8c
                                        FCNAME, __LINE__,               \
Packit Service c5cf8c
                                        MPI_ERR_TYPE,                   \
Packit Service c5cf8c
                                        "**dtypenull",                  \
Packit Service c5cf8c
                                        "**dtypenull %s",               \
Packit Service c5cf8c
                                        name_);                         \
Packit Service c5cf8c
            goto fn_fail;                                               \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_TYPE_RMA_ATOMIC(datatype_, err_)                   \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (!MPIR_Type_is_rma_atomic(datatype_)) {                      \
Packit Service c5cf8c
            err_ = MPIR_Err_create_code(MPI_SUCCESS,                    \
Packit Service c5cf8c
                                        MPIR_ERR_RECOVERABLE,           \
Packit Service c5cf8c
                                        FCNAME, __LINE__,               \
Packit Service c5cf8c
                                        MPI_ERR_TYPE,                   \
Packit Service c5cf8c
                                        "**rmatypenotatomic",           \
Packit Service c5cf8c
                                        "**rmatypenotatomic %D",        \
Packit Service c5cf8c
                                        datatype);                      \
Packit Service c5cf8c
            goto fn_fail;                                               \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_WIN_FLAVOR(win_, flavor_, err_)            \
Packit Service c5cf8c
    do {                                                        \
Packit Service c5cf8c
        if ((win_)->create_flavor != (flavor_)) {               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT1((err_), MPI_ERR_RMA_FLAVOR,    \
Packit Service c5cf8c
                                 goto fn_fail, "**winflavor",   \
Packit Service c5cf8c
                                 "**winflavor %s", #flavor_);   \
Packit Service c5cf8c
        }                                                       \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_SENDBUF_INPLACE(sendbuf,count,err)                 \
Packit Service c5cf8c
    if (count > 0 && sendbuf == MPI_IN_PLACE) {                         \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_BUFFER, "**sendbuf_inplace", 0); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_RECVBUF_INPLACE(recvbuf,count,err)                 \
Packit Service c5cf8c
    if (count > 0 && recvbuf == MPI_IN_PLACE) {                         \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_BUFFER, "**recvbuf_inplace", 0); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_BUF_INPLACE(buf,count,err)                         \
Packit Service c5cf8c
    if (count > 0 && buf == MPI_IN_PLACE) {                             \
Packit Service c5cf8c
        err = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, \
Packit Service c5cf8c
                                   MPI_ERR_BUFFER, "**buf_inplace", 0); \
Packit Service c5cf8c
        goto fn_fail;                                                   \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_NAMED_BUF_INPLACE(buf, bufname, count, err)        \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (count > 0 && buf == MPI_IN_PLACE) {                         \
Packit Service c5cf8c
            MPIR_ERR_SETANDJUMP1(err, MPI_ERR_BUFFER, "**buf_inplace",  \
Packit Service c5cf8c
                                 "**buf_inplace %s", bufname);          \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
/*
Packit Service c5cf8c
 * Check that the triple (buf,count,datatype) does not specify a null
Packit Service c5cf8c
 * buffer.  This does not guarantee that the buffer is valid but does
Packit Service c5cf8c
 * catch the most common problems.
Packit Service c5cf8c
 * Question:
Packit Service c5cf8c
 * Should this be an (inlineable) routine?
Packit Service c5cf8c
 * Since it involves extracting the datatype pointer for non-builtin
Packit Service c5cf8c
 * datatypes, should it take a dtypeptr argument (valid only if not
Packit Service c5cf8c
 * builtin)?
Packit Service c5cf8c
 */
Packit Service c5cf8c
#define MPIR_ERRTEST_USERBUFFER(buf,count,dtype,err)                    \
Packit Service c5cf8c
    if (count > 0 && buf == 0) {                                        \
Packit Service c5cf8c
        int ferr = 0;                                                   \
Packit Service c5cf8c
        if (HANDLE_GET_KIND(dtype) == HANDLE_KIND_BUILTIN) { ferr=1; }  \
Packit Service c5cf8c
        else {                                                          \
Packit Service c5cf8c
            MPI_Aint errsize;                                           \
Packit Service c5cf8c
            MPIR_Datatype *errdtypeptr;                                 \
Packit Service c5cf8c
            MPIR_Datatype_get_ptr(dtype,errdtypeptr);                   \
Packit Service c5cf8c
            MPIR_Datatype_get_size_macro(dtype,errsize);                \
Packit Service c5cf8c
            if (errdtypeptr && errdtypeptr->true_lb == 0 &&             \
Packit Service c5cf8c
                errsize > 0) { ferr=1; }                                \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        if (ferr) {                                                     \
Packit Service c5cf8c
            err = MPIR_Err_create_code(MPI_SUCCESS,                     \
Packit Service c5cf8c
                                       MPIR_ERR_RECOVERABLE,            \
Packit Service c5cf8c
                                       FCNAME, __LINE__,                \
Packit Service c5cf8c
                                       MPI_ERR_BUFFER,                  \
Packit Service c5cf8c
                                       "**bufnull", 0);                 \
Packit Service c5cf8c
            goto fn_fail;                                               \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
/* The following are placeholders.  We haven't decided yet whether these
Packit Service c5cf8c
   should take a handle or pointer, or if they should take a handle and return
Packit Service c5cf8c
   a pointer if the handle is valid.  These need to be rationalized with the
Packit Service c5cf8c
   MPID_xxx_valid_ptr and MPID_xxx_get_ptr.
Packit Service c5cf8c
Packit Service c5cf8c
   [BRT] They should not take a handle and return a pointer if they will be
Packit Service c5cf8c
   placed inside of a #ifdef HAVE_ERROR_CHECKING block.  Personally, I think
Packit Service c5cf8c
   the macros should take handles.  We already have macros for validating
Packit Service c5cf8c
   pointers to various objects.
Packit Service c5cf8c
*/
Packit Service c5cf8c
/* --BEGIN ERROR MACROS-- */
Packit Service c5cf8c
#define MPIR_ERRTEST_VALID_HANDLE(handle_,kind_,err_,errclass_,gmsg_) { \
Packit Service c5cf8c
        if (HANDLE_GET_MPI_KIND(handle_) != kind_ ||                    \
Packit Service c5cf8c
            HANDLE_GET_KIND(handle_) == HANDLE_KIND_INVALID) {          \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_,errclass_,goto fn_fail,gmsg_);     \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
/* --END ERROR MACROS-- */
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_OP(op,err)                                         \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (op == MPI_OP_NULL) {                                        \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else if (op == MPI_NO_OP || op == MPI_REPLACE) {                \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotallowed"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else {                                                          \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE(op,MPIR_OP,err,MPI_ERR_OP,"**op"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_OP_ACC(op,err)                                     \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (op == MPI_OP_NULL) {                                        \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else if (op == MPI_NO_OP) {                                     \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotallowed"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else {                                                          \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE(op,MPIR_OP,err,MPI_ERR_OP,"**op"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        if (HANDLE_GET_KIND(op) != HANDLE_KIND_BUILTIN) {               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotpredefined"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_OP_GACC(op,err)                                    \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (op == MPI_OP_NULL) {                                        \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else {                                                          \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE(op,MPIR_OP,err,MPI_ERR_OP,"**op"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        if (HANDLE_GET_KIND(op) != HANDLE_KIND_BUILTIN) {               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotpredefined"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_GROUP(group,err)                                   \
Packit Service c5cf8c
    if (group == MPI_GROUP_NULL) {                                      \
Packit Service c5cf8c
        MPIR_ERR_SETANDSTMT(err,MPI_ERR_GROUP,goto fn_fail,"**groupnull"); \
Packit Service c5cf8c
    }                                                                   \
Packit Service c5cf8c
    else {                                                              \
Packit Service c5cf8c
        MPIR_ERRTEST_VALID_HANDLE(group,MPIR_GROUP,err,MPI_ERR_GROUP,"**group"); \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_COMM(comm_, err_)                                  \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if ((comm_) == MPI_COMM_NULL)                                   \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT((err_), MPI_ERR_COMM,goto fn_fail,"**commnull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else                                                            \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE((comm_), MPIR_COMM, (err_), MPI_ERR_COMM, "**comm"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_WIN(win_, err_)                                    \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if ((win_) == MPI_WIN_NULL)                                     \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT((err_), MPI_ERR_WIN,goto fn_fail, "**winnull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else                                                            \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE((win_), MPIR_WIN, (err_), MPI_ERR_WIN, "**win"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_REQUEST(request_, err_)                            \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if ((request_) == MPI_REQUEST_NULL)                             \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT((err_), MPI_ERR_REQUEST,goto fn_fail, "**requestnull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else                                                            \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE((request_), MPIR_REQUEST, (err_), MPI_ERR_REQUEST, "**request"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_REQUEST_OR_NULL(request_, err_)                    \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if ((request_) != MPI_REQUEST_NULL)                             \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE((request_), MPIR_REQUEST, (err_), MPI_ERR_REQUEST, "**request"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
/* This macro does *NOT* jump to fn_fail - all uses check mpi_errno */
Packit Service c5cf8c
#define MPIR_ERRTEST_ARRAYREQUEST_OR_NULL(request_, i_, err_)           \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if ((request_) != MPI_REQUEST_NULL)                             \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            if (HANDLE_GET_MPI_KIND(request_) != MPIR_REQUEST) {        \
Packit Service c5cf8c
                MPIR_ERR_SETANDSTMT2(err_,MPI_ERR_REQUEST,goto fn_fail, \
Packit Service c5cf8c
                                     "**request_invalid_kind","**request_invalid_kind %d %d", \
Packit Service c5cf8c
                                     i_, HANDLE_GET_MPI_KIND(request_)); \
Packit Service c5cf8c
            }                                                           \
Packit Service c5cf8c
            else if (HANDLE_GET_KIND(request_) == HANDLE_KIND_INVALID) { \
Packit Service c5cf8c
                MPIR_ERR_SETANDSTMT1(err_,MPI_ERR_REQUEST,goto fn_fail, \
Packit Service c5cf8c
                                     "**request","**request %d", i_);   \
Packit Service c5cf8c
            }                                                           \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_ERRHANDLER(errhandler_,err_)                       \
Packit Service c5cf8c
    if (errhandler_ == MPI_ERRHANDLER_NULL) {                           \
Packit Service c5cf8c
        MPIR_ERR_SETANDSTMT(err_,MPI_ERR_ARG,goto fn_fail,"**errhandlernull"); \
Packit Service c5cf8c
    }                                                                   \
Packit Service c5cf8c
    else {                                                              \
Packit Service c5cf8c
        MPIR_ERRTEST_VALID_HANDLE(errhandler_,MPIR_ERRHANDLER,          \
Packit Service c5cf8c
                                  err_,MPI_ERR_ARG,"**errhandler");     \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_INFO(info_, err_)                                  \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if ((info_) == MPI_INFO_NULL)                                   \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_ERR_ARG,goto fn_fail, "**infonull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else                                                            \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE((info_), MPIR_INFO, (err_), MPI_ERR_ARG, "**info"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_INFO_OR_NULL(info_, err_)                          \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if ((info_) != MPI_INFO_NULL)                                   \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERRTEST_VALID_HANDLE((info_), MPIR_INFO, (err_), MPI_ERR_ARG, "**info"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_KEYVAL(keyval_, object_, objectdesc_, err_)        \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if ((keyval_) == MPI_KEYVAL_INVALID)                            \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyvalinvalid"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else if (HANDLE_GET_MPI_KIND(keyval_) != MPIR_KEYVAL)           \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyval"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else if ((((keyval_) & 0x03c00000) >> 22) != (object_))         \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT1(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyvalobj", \
Packit Service c5cf8c
                                 "**keyvalobj %s", (objectdesc_));      \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_KEYVAL_PERM(keyval_, err_)                         \
Packit Service c5cf8c
    {                                                                   \
Packit Service c5cf8c
        if (HANDLE_GET_MPI_KIND(keyval_) == MPIR_KEYVAL &&              \
Packit Service c5cf8c
            HANDLE_GET_KIND(keyval_) == HANDLE_KIND_BUILTIN)            \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**permattr"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
#define MPIR_ERRTEST_MPIT_INITIALIZED(err_)                             \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (!MPIR_T_is_initialized()) {                                 \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_NOT_INITIALIZED, goto fn_fail, "**mpitinit"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#else
Packit Service c5cf8c
#define MPIR_ERRTEST_MPIT_INITIALIZED(err_)
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_CAT_INDEX(index_,err_)                             \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if ((index_) < 0 || ((unsigned) index_) >= utarray_len(cat_table)) \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**catindex"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_ENUM_HANDLE(handle_, err_)                         \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if ((handle_) == MPI_T_ENUM_NULL)                               \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**enumhandlenull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else if ((handle_)->kind != MPIR_T_ENUM_HANDLE)                 \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**enumhandle"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_ENUM_ITEM(enum_, index_, err_)                     \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if ((index_) < 0 || ((unsigned) index_) >= utarray_len((enum_)->items)) \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_ITEM, goto fn_fail, "**itemindex"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_CVAR_INDEX(index_,err_)                            \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if ((index_) < 0 || ((unsigned) index_) >= utarray_len(cvar_table)) \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**cvarindex"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_CVAR_HANDLE(handle_, err_)                         \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if ((handle_) == MPI_T_CVAR_HANDLE_NULL)                        \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**cvarhandlenull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else if ((handle_)->kind != MPIR_T_CVAR_HANDLE)                 \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**cvarhandle"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_PVAR_INDEX(index_,err_)                            \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if ((index_) < 0 || ((unsigned) index_) >= utarray_len(pvar_table)) \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**pvarindex"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_PVAR_HANDLE(handle_, err_)                         \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (handle_ == MPI_T_PVAR_HANDLE_NULL)                          \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_,MPI_T_ERR_INVALID_HANDLE, goto fn_fail,"**pvarhandlenull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else if ((handle_)->kind != MPIR_T_PVAR_HANDLE)                 \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**pvarhandle"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERRTEST_PVAR_SESSION(session_,err_)                        \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if ((session_) == MPI_T_PVAR_SESSION_NULL)                      \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_,MPI_T_ERR_INVALID_SESSION, goto fn_fail,"**pvarsessionnull"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
        else if ((session_)->kind != MPIR_T_PVAR_SESSION)               \
Packit Service c5cf8c
        {                                                               \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_SESSION, goto fn_fail, "**pvarsession"); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
/* some simple memcpy aliasing checks */
Packit Service c5cf8c
#define MPIR_ERR_CHKMEMCPYANDSTMT(err_,stmt_,src_,dst_,len_)            \
Packit Service c5cf8c
    MPIR_ERR_CHKANDSTMT3(MPIR_MEM_RANGES_OVERLAP((dst_),(len_),(src_),(len_)),err_,MPI_ERR_INTERN,stmt_,"**memcpyalias","**memcpyalias %p %p %L",(src_),(dst_),(long long)(len_))
Packit Service c5cf8c
#define MPIR_ERR_CHKMEMCPYANDJUMP(err_,src_,dst_,len_)                  \
Packit Service c5cf8c
    MPIR_ERR_CHKMEMCPYANDSTMT((err_),goto fn_fail,(src_),(dst_),(len_))
Packit Service c5cf8c
Packit Service c5cf8c
/* Special MPI error "class/code" for out of memory */
Packit Service c5cf8c
/* FIXME: not yet done */
Packit Service c5cf8c
#define MPIR_ERR_MEMALLOCFAILED MPI_ERR_INTERN
Packit Service c5cf8c
Packit Service c5cf8c
/*
Packit Service c5cf8c
 * Standardized error setting and checking macros
Packit Service c5cf8c
 * These are intended to simplify the insertion of standardized error
Packit Service c5cf8c
 * checks
Packit Service c5cf8c
 *
Packit Service c5cf8c
 */
Packit Service c5cf8c
/* --BEGIN ERROR MACROS-- */
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
#define MPIR_ERR_POP(err_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,MPI_ERR_OTHER,goto fn_fail,"**fail")
Packit Service c5cf8c
#define MPIR_ERR_POP_LABEL(err_, label_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,MPI_ERR_OTHER,goto label_,"**fail")
Packit Service c5cf8c
#define MPIR_ERR_POPFATAL(err_) \
Packit Service c5cf8c
    MPIR_ERR_SETFATALANDSTMT(err_,MPI_ERR_OTHER,goto fn_fail,"**fail")
Packit Service c5cf8c
#define MPIR_ERR_POPFATAL_LABEL(err_, label_)                           \
Packit Service c5cf8c
    MPIR_ERR_SETFATALANDSTMT(err_,MPI_ERR_OTHER,goto label_,"**fail")
Packit Service c5cf8c
#else
Packit Service c5cf8c
#define MPIR_ERR_POP(err_) goto fn_fail
Packit Service c5cf8c
#define MPIR_ERR_POP_LABEL(err_, label_) goto label_
Packit Service c5cf8c
#define MPIR_ERR_POPFATAL(err_) goto fn_fail
Packit Service c5cf8c
#define MPIR_ERR_POPFATAL_LABEL(err_, label_) goto label_
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
/* If you add any macros to this list, make sure that you update
Packit Service c5cf8c
 maint/extracterrmsgs to handle the additional macros (see the hash
Packit Service c5cf8c
 KnownErrRoutines in that script)
Packit Service c5cf8c
 ERR_SETSIMPLE is like ERR_SET except that it just sets the error, it
Packit Service c5cf8c
 doesn't add it to an existing error.  This is appropriate in cases
Packit Service c5cf8c
 where there can be no pre-existing error, and MPI_SUCCESS is needed for the
Packit Service c5cf8c
 first argument to MPIR_Err_create_code .
Packit Service c5cf8c
*/
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
#define MPIR_ERR_SETSIMPLE(err_,class_,msg_)                            \
Packit Service c5cf8c
    err_ = MPIR_Err_create_code(MPI_SUCCESS,MPIR_ERR_RECOVERABLE,FCNAME, \
Packit Service c5cf8c
                                __LINE__, class_, msg_, 0)
Packit Service c5cf8c
#define MPIR_ERR_SET(err_,class_,msg_)                                  \
Packit Service c5cf8c
    err_ = MPIR_Err_create_code(err_,MPIR_ERR_RECOVERABLE,FCNAME,       \
Packit Service c5cf8c
                                __LINE__, class_, msg_, 0)
Packit Service c5cf8c
#define MPIR_ERR_SET1(err_,class_,gmsg_,smsg_,arg1_)                    \
Packit Service c5cf8c
    err_ = MPIR_Err_create_code(err_,MPIR_ERR_RECOVERABLE,FCNAME,       \
Packit Service c5cf8c
                                __LINE__, class_, gmsg_, smsg_, arg1_)
Packit Service c5cf8c
#define MPIR_ERR_SET2(err_,class_,gmsg_,smsg_,arg1_,arg2_)              \
Packit Service c5cf8c
    err_ = MPIR_Err_create_code(err_,MPIR_ERR_RECOVERABLE,FCNAME,       \
Packit Service c5cf8c
                                __LINE__, class_, gmsg_, smsg_, arg1_, arg2_)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT(err_,class_,stmt_,msg_)                     \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_RECOVERABLE,FCNAME,   \
Packit Service c5cf8c
                                    __LINE__, class_, msg_, 0); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_)       \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_RECOVERABLE,FCNAME,   \
Packit Service c5cf8c
                                    __LINE__, class_, gmsg_, smsg_, arg1_); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_RECOVERABLE,FCNAME,   \
Packit Service c5cf8c
                                    __LINE__, class_, gmsg_, smsg_, arg1_, arg2_); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_RECOVERABLE,FCNAME,   \
Packit Service c5cf8c
                                    __LINE__, class_, gmsg_, smsg_, arg1_, arg2_, arg3_); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_, arg4_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_RECOVERABLE,FCNAME,   \
Packit Service c5cf8c
                                    __LINE__, class_, gmsg_, smsg_, arg1_, \
Packit Service c5cf8c
                                    arg2_, arg3_, arg4_); stmt_ ;       \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERR_SETFATALSIMPLE(err_,class_,msg_)                       \
Packit Service c5cf8c
    err_ = MPIR_Err_create_code(MPI_SUCCESS,MPIR_ERR_FATAL,FCNAME,      \
Packit Service c5cf8c
                                __LINE__, class_, msg_, 0)
Packit Service c5cf8c
#define MPIR_ERR_SETFATAL(err_,class_,msg_)                     \
Packit Service c5cf8c
    err_ = MPIR_Err_create_code(err_,MPIR_ERR_FATAL,FCNAME,     \
Packit Service c5cf8c
                                __LINE__, class_, msg_, 0)
Packit Service c5cf8c
#define MPIR_ERR_SETFATAL1(err_,class_,gmsg_,smsg_,arg1_)               \
Packit Service c5cf8c
    err_ = MPIR_Err_create_code(err_,MPIR_ERR_FATAL,FCNAME,             \
Packit Service c5cf8c
                                __LINE__, class_, gmsg_, smsg_, arg1_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATAL2(err_,class_,gmsg_,smsg_,arg1_,arg2_)         \
Packit Service c5cf8c
    err_ = MPIR_Err_create_code(err_,MPIR_ERR_FATAL,FCNAME,             \
Packit Service c5cf8c
                                __LINE__, class_, gmsg_, smsg_, arg1_, arg2_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_)                \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_FATAL,FCNAME,         \
Packit Service c5cf8c
                                    __LINE__, class_, msg_, 0); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_)  \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_FATAL,FCNAME,         \
Packit Service c5cf8c
                                    __LINE__, class_, gmsg_, smsg_, arg1_); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_FATAL,FCNAME,         \
Packit Service c5cf8c
                                    __LINE__, class_, gmsg_, smsg_, arg1_, arg2_); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_FATAL,FCNAME,         \
Packit Service c5cf8c
                                    __LINE__, class_, gmsg_, smsg_, arg1_, arg2_, arg3_); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_, arg4_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        err_ = MPIR_Err_create_code(err_,MPIR_ERR_FATAL,FCNAME,         \
Packit Service c5cf8c
                                    __LINE__, class_, gmsg_, smsg_, arg1_, arg2_, arg3_, arg4_); stmt_ ; \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_ADD(err_, newerr_)                             \
Packit Service c5cf8c
    do {                                                        \
Packit Service c5cf8c
        (err_) = MPIR_Err_combine_codes((err_), (newerr_));     \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#else
Packit Service c5cf8c
/* Simply set the class, being careful not to override a previously
Packit Service c5cf8c
   set class. */
Packit Service c5cf8c
#define MPIR_ERR_SETSIMPLE(err_,class_,msg_)    \
Packit Service c5cf8c
    do {                                        \
Packit Service c5cf8c
        err_ = class_;                          \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SET(err_,class_,msg_)          \
Packit Service c5cf8c
    do {                                        \
Packit Service c5cf8c
        if (!err_) {                            \
Packit Service c5cf8c
            err_=class_;                        \
Packit Service c5cf8c
        }                                       \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SET1(err_,class_,gmsg_,smsg_,arg1_)    \
Packit Service c5cf8c
    MPIR_ERR_SET(err_,class_,msg_)
Packit Service c5cf8c
#define MPIR_ERR_SET2(err_,class_,gmsg_,smsg_,arg1_,arg2_)      \
Packit Service c5cf8c
    MPIR_ERR_SET(err_,class_,msg_)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT(err_,class_,stmt_,msg_)     \
Packit Service c5cf8c
    do {                                                \
Packit Service c5cf8c
        if (!err_) {                                    \
Packit Service c5cf8c
            err_ = class_;                              \
Packit Service c5cf8c
        }                                               \
Packit Service c5cf8c
        stmt_;                                          \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_)       \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
Packit Service c5cf8c
#define MPIR_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERR_SETFATALSIMPLE(err_,class_,msg_)       \
Packit Service c5cf8c
    do {                                                \
Packit Service c5cf8c
        err_ = class_;                                  \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETFATAL(err_,class_,msg_)     \
Packit Service c5cf8c
    do {                                        \
Packit Service c5cf8c
        if (!err_) {                            \
Packit Service c5cf8c
            err_=class_;                        \
Packit Service c5cf8c
        }                                       \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_SETFATAL1(err_,class_,gmsg_,smsg_,arg1_)       \
Packit Service c5cf8c
    MPIR_ERR_SET(err_,class_,msg_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATAL2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    MPIR_ERR_SET(err_,class_,msg_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_)        \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,msg_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_)  \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
Packit Service c5cf8c
    /* No-op - use original error class; discard newerr_ unless err is
Packit Service c5cf8c
     * MPI_SUCCESS */
Packit Service c5cf8c
#define MPIR_ERR_ADD(err_, newerr_)             \
Packit Service c5cf8c
    do {                                        \
Packit Service c5cf8c
        if (!err_)                              \
Packit Service c5cf8c
            err_ = newerr_;                     \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
/* The following definitions are the same independent of the choice of
Packit Service c5cf8c
   HAVE_ERROR_CHECKING */
Packit Service c5cf8c
#define MPIR_ERR_SETANDJUMP(err_,class_,msg_)           \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT(err_,class_,goto fn_fail,msg_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDJUMP(err_,class_,msg_)              \
Packit Service c5cf8c
    MPIR_ERR_SETFATALANDSTMT(err_,class_,goto fn_fail,msg_)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDSTMT(cond_,err_,class_,stmt_,msg_)       \
Packit Service c5cf8c
    do {                                                        \
Packit Service c5cf8c
        if (cond_) {                                            \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT(err_,class_,stmt_,msg_);        \
Packit Service c5cf8c
        }                                                       \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDSTMT(cond_,err_,class_,stmt_,msg_)  \
Packit Service c5cf8c
    do {                                                        \
Packit Service c5cf8c
        if (cond_) {                                            \
Packit Service c5cf8c
            MPIR_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_);   \
Packit Service c5cf8c
        }                                                       \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDJUMP(cond_,err_,class_,msg_)             \
Packit Service c5cf8c
    MPIR_ERR_CHKANDSTMT(cond_,err_,class_,goto fn_fail,msg_)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDJUMP(cond_,err_,class_,msg_)                \
Packit Service c5cf8c
    MPIR_ERR_CHKFATALANDSTMT(cond_,err_,class_,goto fn_fail,msg_)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERR_SETANDJUMP1(err_,class_,gmsg_,smsg_,arg1_)             \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT1(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDJUMP1(err_,class_,gmsg_,smsg_,arg1_)        \
Packit Service c5cf8c
    MPIR_ERR_SETFATALANDSTMT1(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDSTMT1(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (cond_) {                                                    \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_);  \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDSTMT1(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (cond_) {                                                    \
Packit Service c5cf8c
            MPIR_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDJUMP1(cond_,err_,class_,gmsg_,smsg_,arg1_)       \
Packit Service c5cf8c
    MPIR_ERR_CHKANDSTMT1(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDJUMP1(cond_,err_,class_,gmsg_,smsg_,arg1_)  \
Packit Service c5cf8c
    MPIR_ERR_CHKFATALANDSTMT1(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERR_SETANDJUMP2(err_,class_,gmsg_,smsg_,arg1_,arg2_)       \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT2(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDJUMP2(err_,class_,gmsg_,smsg_,arg1_,arg2_)  \
Packit Service c5cf8c
    MPIR_ERR_SETFATALANDSTMT2(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDSTMT2(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (cond_) {                                                    \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDSTMT2(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (cond_) {                                                    \
Packit Service c5cf8c
            MPIR_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDJUMP2(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    MPIR_ERR_CHKANDSTMT2(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDJUMP2(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_) \
Packit Service c5cf8c
    MPIR_ERR_CHKFATALANDSTMT2(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERR_SETANDJUMP3(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT3(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDJUMP3(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
Packit Service c5cf8c
    MPIR_ERR_SETFATALANDSTMT3(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDSTMT3(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (cond_) {                                                    \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDSTMT3(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (cond_) {                                                    \
Packit Service c5cf8c
            MPIR_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDJUMP3(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
Packit Service c5cf8c
    MPIR_ERR_CHKANDSTMT3(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDJUMP3(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
Packit Service c5cf8c
    MPIR_ERR_CHKFATALANDSTMT3(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERR_SETANDJUMP4(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT4(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
Packit Service c5cf8c
#define MPIR_ERR_SETFATALANDJUMP4(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
Packit Service c5cf8c
    MPIR_ERR_SETFATALANDSTMT4(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDSTMT4(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_, arg4_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (cond_) {                                                    \
Packit Service c5cf8c
            MPIR_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDSTMT4(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_, arg4_) \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (cond_) {                                                    \
Packit Service c5cf8c
            MPIR_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_); \
Packit Service c5cf8c
        }                                                               \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#define MPIR_ERR_CHKANDJUMP4(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
Packit Service c5cf8c
    MPIR_ERR_CHKANDSTMT4(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
Packit Service c5cf8c
#define MPIR_ERR_CHKFATALANDJUMP4(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
Packit Service c5cf8c
    MPIR_ERR_CHKFATALANDSTMT4(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_ERR_INTERNAL(err_, msg_)                                   \
Packit Service c5cf8c
    MPIR_ERR_SETFATAL1(err_, MPI_ERR_INTERN, "**intern", "**intern %s", msg_)
Packit Service c5cf8c
#define MPIR_ERR_INTERNALANDSTMT(err_, msg_, stmt_)                     \
Packit Service c5cf8c
    MPIR_ERR_SETANDSTMT1(err_, MPI_ERR_INTERN, stmt_, "**intern", "**intern %s", msg_)
Packit Service c5cf8c
#define MPIR_ERR_INTERNALANDJUMP(err_, msg_)            \
Packit Service c5cf8c
    MPIR_ERR_INTERNALANDSTMT(err_, msg_, goto fn_fail)
Packit Service c5cf8c
#define MPIR_ERR_CHKINTERNAL(cond_, err_, msg_)         \
Packit Service c5cf8c
    do {                                                \
Packit Service c5cf8c
        if (cond_)                                      \
Packit Service c5cf8c
            MPIR_ERR_INTERNALANDJUMP(err_, msg_);       \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
/* --END ERROR MACROS-- */
Packit Service c5cf8c
Packit Service c5cf8c
/*
Packit Service c5cf8c
 * Special case for "is initialized".
Packit Service c5cf8c
 * This should be used in cases where there is no
Packit Service c5cf8c
 * additional error checking
Packit Service c5cf8c
 */
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
#define MPIR_ERRTEST_INITIALIZED_ORDIE()                                \
Packit Service c5cf8c
    do {                                                                \
Packit Service c5cf8c
        if (OPA_load_int(&MPIR_Process.mpich_state) == MPICH_MPI_STATE__PRE_INIT || \
Packit Service c5cf8c
            OPA_load_int(&MPIR_Process.mpich_state) == MPICH_MPI_STATE__POST_FINALIZED) \
Packit Service c5cf8c
            {                                                           \
Packit Service c5cf8c
                MPIR_Err_preOrPostInit();                               \
Packit Service c5cf8c
            }                                                           \
Packit Service c5cf8c
    } while (0)
Packit Service c5cf8c
#else
Packit Service c5cf8c
#define MPIR_ERRTEST_INITIALIZED_ORDIE() do {} while (0)
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
/* ------------------------------------------------------------------------- */
Packit Service c5cf8c
/* end of mpir_err.h */
Packit Service c5cf8c
/* ------------------------------------------------------------------------- */
Packit Service c5cf8c
Packit Service c5cf8c
#endif /* MPIR_ERR_H_INCLUDED */