/*
 * Copyright (C) by Argonne National Laboratory
 *     See COPYRIGHT in top-level directory
 */

/* -- THIS FILE IS AUTO-GENERATED -- */

#include "mpiimpl.h"

/* -- Begin Profiling Symbol Block for routine MPI_Info_fromint */
#if defined(HAVE_PRAGMA_WEAK)
#pragma weak MPI_Info_fromint = PMPI_Info_fromint
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
#pragma _HP_SECONDARY_DEF PMPI_Info_fromint  MPI_Info_fromint
#elif defined(HAVE_PRAGMA_CRI_DUP)
#pragma _CRI duplicate MPI_Info_fromint as PMPI_Info_fromint
#elif defined(HAVE_WEAK_ATTRIBUTE)
MPI_Info MPI_Info_fromint(int info)  __attribute__ ((weak, alias("PMPI_Info_fromint")));
#endif
/* -- End Profiling Symbol Block */

/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
   the MPI routines */
#ifndef MPICH_MPI_FROM_PMPI
#undef MPI_Info_fromint
#define MPI_Info_fromint PMPI_Info_fromint
#endif /* MPICH_MPI_FROM_PMPI */

static MPI_Info internal_Info_fromint(int info)
{
    return (MPI_Info) info;
}

#ifdef ENABLE_QMPI
#ifndef MPICH_MPI_FROM_PMPI
MPI_Info QMPI_Info_fromint(QMPI_Context context, int tool_id, int info)
{
    return internal_Info_fromint(info);
}
#endif /* MPICH_MPI_FROM_PMPI */
MPI_Info MPI_Info_fromint(int info)
{
    QMPI_Context context;
    QMPI_Info_fromint_t *fn_ptr;

    context.storage_stack = NULL;

    if (MPIR_QMPI_num_tools == 0)
        return QMPI_Info_fromint(context, 0, info);

    fn_ptr = (QMPI_Info_fromint_t *) MPIR_QMPI_first_fn_ptrs[MPI_INFO_FROMINT_T];

    return (*fn_ptr) (context, MPIR_QMPI_first_tool_ids[MPI_INFO_FROMINT_T], info);
}
#else /* ENABLE_QMPI */
MPI_Info MPI_Info_fromint(int info)
{
    return internal_Info_fromint(info);
}

#endif /* ENABLE_QMPI */
