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 4/6] Use __fastcall for MSVC


---
 ChangeLog                               |   12 ++++++++++++
 testsuite/libffi.call/fastthis1_win32.c |    2 +-
 testsuite/libffi.call/fastthis2_win32.c |    2 +-
 testsuite/libffi.call/fastthis3_win32.c |    2 +-
 testsuite/libffi.call/ffitest.h         |    8 ++++++++
 testsuite/libffi.call/strlen2_win32.c   |    2 +-
 testsuite/libffi.call/struct1_win32.c   |    2 +-
 testsuite/libffi.call/struct2_win32.c   |    2 +-
 8 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0c0cc68..4951703 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-03-23  Peter Rosin  <peda@lysator.liu.se>
+
+	* testsuite/libffi.call/ffitest.h: Provide abstration of
+	__attribute__((fastcall)) in the form of a __FASTCALL__
+	define.  Define it to __fastcall for MSVC.
+	* testsuite/libffi.call/fastthis1_win32.c: Use the above.
+	* testsuite/libffi.call/fastthis2_win32.c: Likewise.
+	* testsuite/libffi.call/fastthis3_win32.c: Likewise.
+	* testsuite/libffi.call/strlen2_win32.c: Likewise.
+	* testsuite/libffi.call/struct1_win32.c: Likewise.
+	* testsuite/libffi.call/struct2_win32.c: Likewise.
+
 2012-03-22  Peter Rosin  <peda@lysator.liu.se>
 
 	* src/x86/win32.S [MSVC] (ffi_closure_THISCALL): Remove the manual
diff --git a/testsuite/libffi.call/fastthis1_win32.c b/testsuite/libffi.call/fastthis1_win32.c
index b3c4c73..cbc4724 100644
--- a/testsuite/libffi.call/fastthis1_win32.c
+++ b/testsuite/libffi.call/fastthis1_win32.c
@@ -8,7 +8,7 @@
 
 #include "ffitest.h"
 
-static size_t __attribute__((fastcall)) my_fastcall_f(char *s, float a)
+static size_t __FASTCALL__ my_fastcall_f(char *s, float a)
 {
   return (size_t) ((int) strlen(s) + (int) a);
 }
diff --git a/testsuite/libffi.call/fastthis2_win32.c b/testsuite/libffi.call/fastthis2_win32.c
index f148a12..7bdd0e1 100644
--- a/testsuite/libffi.call/fastthis2_win32.c
+++ b/testsuite/libffi.call/fastthis2_win32.c
@@ -8,7 +8,7 @@
 
 #include "ffitest.h"
 
-static size_t __attribute__((fastcall)) my_fastcall_f(float a, char *s)
+static size_t __FASTCALL__ my_fastcall_f(float a, char *s)
 {
   return (size_t) ((int) strlen(s) + (int) a);
 }
diff --git a/testsuite/libffi.call/fastthis3_win32.c b/testsuite/libffi.call/fastthis3_win32.c
index 5cf82bb..b5d606d 100644
--- a/testsuite/libffi.call/fastthis3_win32.c
+++ b/testsuite/libffi.call/fastthis3_win32.c
@@ -8,7 +8,7 @@
 
 #include "ffitest.h"
 
-static size_t __attribute__((fastcall)) my_fastcall_f(float a, char *s, int i)
+static size_t __FASTCALL__ my_fastcall_f(float a, char *s, int i)
 {
   return (size_t) ((int) strlen(s) + (int) a + i);
 }
diff --git a/testsuite/libffi.call/ffitest.h b/testsuite/libffi.call/ffitest.h
index ecda068..d81d4da 100644
--- a/testsuite/libffi.call/ffitest.h
+++ b/testsuite/libffi.call/ffitest.h
@@ -25,6 +25,14 @@
 #define __UNUSED__
 #endif
 
+/* Define __FASTCALL__ so that other compilers than gcc can run the tests.  */
+#undef __FASTCALL__
+#if defined _MSC_VER
+#define __FASTCALL__ __fastcall
+#else
+#define __FASTCALL__ __attribute__((fastcall))
+#endif
+
 /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a
    file open.  */
 #ifdef HAVE_MMAP_ANON
diff --git a/testsuite/libffi.call/strlen2_win32.c b/testsuite/libffi.call/strlen2_win32.c
index ce8520a..0d81061 100644
--- a/testsuite/libffi.call/strlen2_win32.c
+++ b/testsuite/libffi.call/strlen2_win32.c
@@ -8,7 +8,7 @@
 
 #include "ffitest.h"
 
-static size_t __attribute__((fastcall)) my_fastcall_strlen(char *s)
+static size_t __FASTCALL__ my_fastcall_strlen(char *s)
 {
   return (strlen(s));
 }
diff --git a/testsuite/libffi.call/struct1_win32.c b/testsuite/libffi.call/struct1_win32.c
index a97e981..b756f5a 100644
--- a/testsuite/libffi.call/struct1_win32.c
+++ b/testsuite/libffi.call/struct1_win32.c
@@ -14,7 +14,7 @@ typedef struct
   unsigned int ui;
 } test_structure_1;
 
-static __attribute__ ((fastcall)) test_structure_1 struct1(test_structure_1 ts)
+static test_structure_1 __FASTCALL__ struct1(test_structure_1 ts)
 {
   ts.uc++;
   ts.d--;
diff --git a/testsuite/libffi.call/struct2_win32.c b/testsuite/libffi.call/struct2_win32.c
index f4505be..5d02285 100644
--- a/testsuite/libffi.call/struct2_win32.c
+++ b/testsuite/libffi.call/struct2_win32.c
@@ -13,7 +13,7 @@ typedef struct
   double d2;
 } test_structure_2;
 
-static test_structure_2 __attribute__ ((fastcall)) struct2(test_structure_2 ts)
+static test_structure_2 __FASTCALL__ struct2(test_structure_2 ts)
 {
   ts.d1--;
   ts.d2--;
-- 
1.7.9


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