Skip to content

Commit

Permalink
Move FFI_TYPE definitions above <ffitarget.h> include
Browse files Browse the repository at this point in the history
For powerpc at least, these definitions are referenced in the
target-specific ffitarget.h.  Discovered in the jffi project.  Should
close libffi#637.  Downstream jffi bug
jnr/jffi#107.  Downstream distro bug
https://bugs.gentoo.org/827215.

Testing - both libffi and jffi test suites pass with this patch applied,
at least on ppc64le linux.  I did not see any warnings about
redefinitions.

Tested versions - libffi 3.4.2, jffi 1.3.6 and 1.3.9.
  • Loading branch information
matoro committed Jun 27, 2022
1 parent ddc6764 commit f4d4137
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions include/ffi.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,31 @@ extern "C" {

/* ---- System configuration information --------------------------------- */

/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#if @HAVE_LONG_DOUBLE@
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
#define FFI_TYPE_UINT64 11
#define FFI_TYPE_SINT64 12
#define FFI_TYPE_STRUCT 13
#define FFI_TYPE_POINTER 14
#define FFI_TYPE_COMPLEX 15

/* This should always refer to the last type code (for sanity checks). */
#define FFI_TYPE_LAST FFI_TYPE_COMPLEX

#include <ffitarget.h>

#ifndef LIBFFI_ASM
Expand Down Expand Up @@ -496,31 +521,6 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,

#endif

/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#if @HAVE_LONG_DOUBLE@
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
#define FFI_TYPE_UINT64 11
#define FFI_TYPE_SINT64 12
#define FFI_TYPE_STRUCT 13
#define FFI_TYPE_POINTER 14
#define FFI_TYPE_COMPLEX 15

/* This should always refer to the last type code (for sanity checks). */
#define FFI_TYPE_LAST FFI_TYPE_COMPLEX

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit f4d4137

Please sign in to comment.