Commit be1d6024 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Add prototypes for cfortran interfaces.

parent 6a0dcdda
......@@ -61,7 +61,6 @@
# if defined __clang__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wreserved-id-macro"
# pragma GCC diagnostic ignored "-Wstrict-prototypes"
# endif
# include <cfortran.h>
# if defined __clang__
......
......@@ -45,7 +45,15 @@
#define FCALLSC_QUALIFIER PPM_DSO_INTERNAL
#include "cfortran.h"
#if defined __clang__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wreserved-id-macro"
#endif
#include <cfortran.h>
#if defined __clang__
# pragma GCC diagnostic pop
#endif
#include "core/ppm_visibility.h"
#include "core.h"
......@@ -67,9 +75,16 @@ SymPrefix(set_default_comm_f)(MPI_Fint *comm_f)
SymPrefix(default_comm) = comm_c;
}
PROTOCCALLSFSUB1(SYMPREFIX(SET_DEFAULT_COMM),
symprefix(set_default_comm), PVOID)
FCALLSCSUB1(SymPrefix(set_default_comm_f), SYMPREFIX(SET_DEFAULT_COMM),
symprefix(set_default_comm), PVOID)
static void
abort_f(MPI_Fint *comm_f, const char *msg,
const char *source, int line)
__attribute__((noreturn));
static void
abort_f(MPI_Fint *comm_f, const char *msg,
const char *source, int line)
......@@ -88,8 +103,30 @@ abort_f(MPI_Fint *comm_f, const char *msg,
SymPrefix(abort)(comm_c, msg, source, line);
}
#ifndef __CF__KnR
# undef PROTOCCALLSFSUB14
# define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \
_(VOID,_cfPU)(CFC_(UN,LN))( CFARGT14(NCF,KCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) ) \
__attribute__((noreturn));
# if defined __clang__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wkeyword-macro"
# endif
# define return
# if defined __clang__
# pragma GCC diagnostic pop
# endif
#endif
PROTOCCALLSFSUB4(SYMPREFIX(ABORT), symprefix(abort),
PVOID, STRING, STRING, INT)
FCALLSCSUB4(abort_f, SYMPREFIX(ABORT), symprefix(abort),
PVOID, STRING, STRING, INT)
#ifndef __CF__KnR
# undef return
# undef PROTOCCALLSFSUB14
# define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \
_(VOID,_cfPU)(CFC_(UN,LN))( CFARGT14(NCF,KCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) );
#endif
static void
SymPrefix(abort_handler_wrapper)(MPI_Comm comm, const char msg[],
......@@ -97,13 +134,20 @@ SymPrefix(abort_handler_wrapper)(MPI_Comm comm, const char msg[],
__attribute__((noreturn));
static void
SymPrefix(set_abort_handler_f)(void (*abort_handler)());
SymPrefix(set_abort_handler_f)(void (*abort_handler)(void));
#undef ROUTINE_1
#define ROUTINE_1 (void (*)())
#define ROUTINE_1 (void (*)(void))
PROTOCCALLSFSUB1(SYMPREFIX(SET_ABORT_HANDLER), symprefix(set_abort_handler),
ROUTINE)
FCALLSCSUB1(SymPrefix(set_abort_handler_f), SYMPREFIX(SET_ABORT_HANDLER),
symprefix(set_abort_handler), ROUTINE)
static void
abort_default_f(MPI_Fint *comm_f, const char *msg, const char *source,
int line)
__attribute__((noreturn));
static void
abort_default_f(MPI_Fint *comm_f, const char *msg, const char *source,
int line)
......@@ -121,22 +165,40 @@ abort_default_f(MPI_Fint *comm_f, const char *msg, const char *source,
#undef FCALLSC_QUALIFIER
#define FCALLSC_QUALIFIER
#if (defined __GNUC__ && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))\
|| (defined __clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
/* since we rely on C99, explicitly set empty parameter list */
#undef PROTOCCALLSFSUB0
#define PROTOCCALLSFSUB0(UN,LN) _(VOID,_cfPU)(CFC_(UN,LN))(void);
PROTOCCALLSFSUB0(SYMPREFIX(RESTORE_DEFAULT_ABORT_HNDL),
symprefix(restore_default_abort_hndl))
FCALLSCSUB0(SymPrefix(restore_default_abort_handler),
SYMPREFIX(RESTORE_DEFAULT_ABORT_HNDL),
symprefix(restore_default_abort_hndl))
#if (defined __GNUC__ && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))\
|| (defined __clang__)
#pragma GCC diagnostic pop
#endif
#ifndef __CF__KnR
# undef PROTOCCALLSFSUB14
# define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \
_(VOID,_cfPU)(CFC_(UN,LN))( CFARGT14(NCF,KCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) ) \
__attribute__((noreturn));
# if defined __clang__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wkeyword-macro"
# endif
# define return
# if defined __clang__
# pragma GCC diagnostic pop
# endif
#endif
PROTOCCALLSFSUB4(SYMPREFIX(ABORT_DEFAULT), symprefix(abort_default),
PVOID,STRING,STRING,INT)
FCALLSCSUB4(abort_default_f,SYMPREFIX(ABORT_DEFAULT),
symprefix(abort_default),
PVOID,STRING,STRING,INT)
#ifndef __CF__KnR
# undef return
# undef PROTOCCALLSFSUB14
# define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \
_(VOID,_cfPU)(CFC_(UN,LN))( CFARGT14(NCF,KCF,_Z,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) );
#endif
/* this must be the last piece of code in the file because we
* redefine a cfortran.h internal here, to allow calls to Fortran
......@@ -148,12 +210,11 @@ FCALLSCSUB4(abort_default_f,SYMPREFIX(ABORT_DEFAULT),
__attribute__((noreturn))
PROTOCCALLSFSUB4(*SymPrefix(fortran_abort_func),,PVOID,STRING,STRING,INT)
#undef CFextern
#define CFextern static
static SymPrefix(fortran_abort_func) SymPrefix(fortran_abort_fp);
static void
SymPrefix(set_abort_handler_f)(void (*abort_handler)())
SymPrefix(set_abort_handler_f)(void (*abort_handler)(void))
{
SymPrefix(fortran_abort_fp)
= (SymPrefix(fortran_abort_func))abort_handler;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment