~ubuntu-branches/ubuntu/trusty/python3.4/trusty-proposed

« back to all changes in this revision

Viewing changes to Modules/_ctypes/libffi/testsuite/libffi.call/ffitest.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-11-25 09:44:27 UTC
  • Revision ID: package-import@ubuntu.com-20131125094427-lzxj8ap5w01lmo7f
Tags: upstream-3.4~b1
ImportĀ upstreamĀ versionĀ 3.4~b1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdlib.h>
 
2
#include <stdio.h>
 
3
#include <string.h>
 
4
#include <fcntl.h>
 
5
#include <ffi.h>
 
6
#include "fficonfig.h"
 
7
 
 
8
#if defined HAVE_STDINT_H
 
9
#include <stdint.h>
 
10
#endif
 
11
 
 
12
#if defined HAVE_INTTYPES_H
 
13
#include <inttypes.h>
 
14
#endif
 
15
 
 
16
#define MAX_ARGS 256
 
17
 
 
18
#define CHECK(x) !(x) ? (abort(), 1) : 0
 
19
 
 
20
/* Define __UNUSED__ that also other compilers than gcc can run the tests.  */
 
21
#undef __UNUSED__
 
22
#if defined(__GNUC__)
 
23
#define __UNUSED__ __attribute__((__unused__))
 
24
#else
 
25
#define __UNUSED__
 
26
#endif
 
27
 
 
28
/* Define __FASTCALL__ so that other compilers than gcc can run the tests.  */
 
29
#undef __FASTCALL__
 
30
#if defined _MSC_VER
 
31
#define __FASTCALL__ __fastcall
 
32
#else
 
33
#define __FASTCALL__ __attribute__((fastcall))
 
34
#endif
 
35
 
 
36
/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a
 
37
   file open.  */
 
38
#ifdef HAVE_MMAP_ANON
 
39
# undef HAVE_MMAP_DEV_ZERO
 
40
 
 
41
# include <sys/mman.h>
 
42
# ifndef MAP_FAILED
 
43
#  define MAP_FAILED -1
 
44
# endif
 
45
# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
 
46
#  define MAP_ANONYMOUS MAP_ANON
 
47
# endif
 
48
# define USING_MMAP
 
49
 
 
50
#endif
 
51
 
 
52
#ifdef HAVE_MMAP_DEV_ZERO
 
53
 
 
54
# include <sys/mman.h>
 
55
# ifndef MAP_FAILED
 
56
#  define MAP_FAILED -1
 
57
# endif
 
58
# define USING_MMAP
 
59
 
 
60
#endif
 
61
 
 
62
/* MinGW kludge.  */
 
63
#ifdef _WIN64
 
64
#define PRIdLL "I64d"
 
65
#define PRIuLL "I64u"
 
66
#else
 
67
#define PRIdLL "lld"
 
68
#define PRIuLL "llu"
 
69
#endif
 
70
 
 
71
/* Tru64 UNIX kludge.  */
 
72
#if defined(__alpha__) && defined(__osf__)
 
73
/* Tru64 UNIX V4.0 doesn't support %lld/%lld, but long is 64-bit.  */
 
74
#undef PRIdLL
 
75
#define PRIdLL "ld"
 
76
#undef PRIuLL
 
77
#define PRIuLL "lu"
 
78
#define PRId8 "hd"
 
79
#define PRIu8 "hu"
 
80
#define PRId64 "ld"
 
81
#define PRIu64 "lu"
 
82
#define PRIuPTR "lu"
 
83
#endif
 
84
 
 
85
/* PA HP-UX kludge.  */
 
86
#if defined(__hppa__) && defined(__hpux__) && !defined(PRIuPTR)
 
87
#define PRIuPTR "lu"
 
88
#endif
 
89
 
 
90
/* IRIX kludge.  */
 
91
#if defined(__sgi)
 
92
/* IRIX 6.5 <inttypes.h> provides all definitions, but only for C99
 
93
   compilations.  */
 
94
#define PRId8 "hhd"
 
95
#define PRIu8 "hhu"
 
96
#if (_MIPS_SZLONG == 32)
 
97
#define PRId64 "lld"
 
98
#define PRIu64 "llu"
 
99
#endif
 
100
/* This doesn't match <inttypes.h>, which always has "lld" here, but the
 
101
   arguments are uint64_t, int64_t, which are unsigned long, long for
 
102
   64-bit in <sgidefs.h>.  */
 
103
#if (_MIPS_SZLONG == 64)
 
104
#define PRId64 "ld"
 
105
#define PRIu64 "lu"
 
106
#endif
 
107
/* This doesn't match <inttypes.h>, which has "u" here, but the arguments
 
108
   are uintptr_t, which is always unsigned long.  */
 
109
#define PRIuPTR "lu"
 
110
#endif
 
111
 
 
112
/* Solaris < 10 kludge.  */
 
113
#if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR)
 
114
#if defined(__arch64__) || defined (__x86_64__)
 
115
#define PRIuPTR "lu"
 
116
#else
 
117
#define PRIuPTR "u"
 
118
#endif
 
119
#endif
 
120
 
 
121
/* MSVC kludge.  */
 
122
#if defined _MSC_VER
 
123
#define PRIuPTR "lu"
 
124
#define PRIu8 "u"
 
125
#define PRId8 "d"
 
126
#define PRIu64 "I64u"
 
127
#define PRId64 "I64d"
 
128
#endif
 
129
 
 
130
#ifndef PRIuPTR
 
131
#define PRIuPTR "u"
 
132
#endif