This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/2] Complex type cleanup


I have two more small patches for complex type support to make it a
bit easier to use.

The first patch makes sure that FFI_TYPE_COMPLEX is only defined
on a system that has complex support in libffi, so the user can
say something like

  #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
    /* (code with complex support) */
  #else
    /* (code without complex support) */
  #endif

The macro FFI_TARGET_HAS_COMPLEX_TYPE is for internal use only.
Once all targets implement complex type support it could be
removed.
  
Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany
>From 7371ddead2647c7098bc4ff6e2a08c8d03138d76 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Mon, 29 Sep 2014 11:38:56 +0100
Subject: [PATCH 1/2] Define FFI_TYPE_COMPLEX only on supported platforms.

---
 include/ffi.h.in |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/ffi.h.in b/include/ffi.h.in
index f403ae0..870cfaf 100644
--- a/include/ffi.h.in
+++ b/include/ffi.h.in
@@ -475,10 +475,12 @@ void ffi_call(ffi_cif *cif,
 #define FFI_TYPE_SINT64     12
 #define FFI_TYPE_STRUCT     13
 #define FFI_TYPE_POINTER    14
+#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
 #define FFI_TYPE_COMPLEX    15
+#endif
 
 /* This should always refer to the last type code (for sanity checks) */
-#define FFI_TYPE_LAST       FFI_TYPE_COMPLEX
+#define FFI_TYPE_LAST       (FFI_TYPE_POINTER + 1)
 
 #ifdef __cplusplus
 }
-- 
1.7.9.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]