* [PATCH 1/2] Complex type cleanup
@ 2014-09-29 11:14 Dominik Vogt
2014-09-29 11:16 ` [PATCH 2/2] " Dominik Vogt
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Vogt @ 2014-09-29 11:14 UTC (permalink / raw)
To: libffi-discuss
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
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
[-- Attachment #2: 0001-Define-FFI_TYPE_COMPLEX-only-on-supported-platforms.patch --]
[-- Type: text/x-diff, Size: 871 bytes --]
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] Complex type cleanup
2014-09-29 11:14 [PATCH 1/2] Complex type cleanup Dominik Vogt
@ 2014-09-29 11:16 ` Dominik Vogt
0 siblings, 0 replies; 2+ messages in thread
From: Dominik Vogt @ 2014-09-29 11:16 UTC (permalink / raw)
To: libffi-discuss
[-- Attachment #1: Type: text/plain, Size: 423 bytes --]
> I have two more small patches for complex type support to make it a
> bit easier to use.
> The macro FFI_TARGET_HAS_COMPLEX_TYPE is for internal use only.
> Once all targets implement complex type support it could be
> removed.
The second patch renames FFI_TARGET_HAS_COMPLEX_TYPE to
_FFI_TARGET_HAS_COMPLEX_TYPE to make the temporary nature of the
macro clearer.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0002-Rename-FFI_TARGET_HAS_COMPLEX_TYPE-to-_FFI_TARGET_HA.patch --]
[-- Type: text/x-diff, Size: 3332 bytes --]
From d5d2dc79b6b7282865936425c0755c867dd02e87 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Mon, 29 Sep 2014 11:39:32 +0100
Subject: [PATCH 2/2] Rename FFI_TARGET_HAS_COMPLEX_TYPE to
_FFI_TARGET_HAS_COMPLEX_TYPE
... to discourage using it as part of the interface as it is meant
as a temporary vehicle until all platforms have complex type
support.
---
include/ffi.h.in | 4 ++--
src/prep_cif.c | 4 ++--
src/s390/ffitarget.h | 2 +-
src/types.c | 2 +-
src/x86/ffitarget.h | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/ffi.h.in b/include/ffi.h.in
index 870cfaf..4af6ce0 100644
--- a/include/ffi.h.in
+++ b/include/ffi.h.in
@@ -200,7 +200,7 @@ FFI_EXTERN ffi_type ffi_type_longdouble;
#define ffi_type_longdouble ffi_type_double
#endif
-#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
+#ifdef _FFI_TARGET_HAS_COMPLEX_TYPE
FFI_EXTERN ffi_type ffi_type_complex_float;
FFI_EXTERN ffi_type ffi_type_complex_double;
#if @HAVE_LONG_DOUBLE@
@@ -475,7 +475,7 @@ 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
+#ifdef _FFI_TARGET_HAS_COMPLEX_TYPE
#define FFI_TYPE_COMPLEX 15
#endif
diff --git a/src/prep_cif.c b/src/prep_cif.c
index be5eae3..8af5013 100644
--- a/src/prep_cif.c
+++ b/src/prep_cif.c
@@ -136,7 +136,7 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK))
return FFI_BAD_TYPEDEF;
-#ifndef FFI_TARGET_HAS_COMPLEX_TYPE
+#ifndef _FFI_TARGET_HAS_COMPLEX_TYPE
if (rtype->type == FFI_TYPE_COMPLEX)
abort();
#endif
@@ -170,7 +170,7 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK))
return FFI_BAD_TYPEDEF;
-#ifndef FFI_TARGET_HAS_COMPLEX_TYPE
+#ifndef _FFI_TARGET_HAS_COMPLEX_TYPE
if ((*ptr)->type == FFI_TYPE_COMPLEX)
abort();
#endif
diff --git a/src/s390/ffitarget.h b/src/s390/ffitarget.h
index 0e4868a..d42cb21 100644
--- a/src/s390/ffitarget.h
+++ b/src/s390/ffitarget.h
@@ -53,7 +53,7 @@ typedef enum ffi_abi {
#endif
#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
-#define FFI_TARGET_HAS_COMPLEX_TYPE
+#define _FFI_TARGET_HAS_COMPLEX_TYPE
/* ---- Definitions for closures ----------------------------------------- */
diff --git a/src/types.c b/src/types.c
index 7e80aec..ef4f151 100644
--- a/src/types.c
+++ b/src/types.c
@@ -97,7 +97,7 @@ const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL };
FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE, FFI_LDBL_CONST);
#endif
-#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
+#ifdef _FFI_TARGET_HAS_COMPLEX_TYPE
FFI_COMPLEX_TYPEDEF(float, float, const);
FFI_COMPLEX_TYPEDEF(double, double, const);
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
diff --git a/src/x86/ffitarget.h b/src/x86/ffitarget.h
index a236677..d43930e 100644
--- a/src/x86/ffitarget.h
+++ b/src/x86/ffitarget.h
@@ -50,7 +50,7 @@
#endif
#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
-#define FFI_TARGET_HAS_COMPLEX_TYPE
+#define _FFI_TARGET_HAS_COMPLEX_TYPE
/* ---- Generic type definitions ----------------------------------------- */
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-29 11:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29 11:14 [PATCH 1/2] Complex type cleanup Dominik Vogt
2014-09-29 11:16 ` [PATCH 2/2] " Dominik Vogt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).