]>
Commit | Line | Data |
---|---|---|
5e9f2524 VS |
1 | /* internal.h |
2 | ||
3 | Internal definitions used by Expat. This is not needed to compile | |
4 | client code. | |
5 | ||
6 | The following calling convention macros are defined for frequently | |
7 | called functions: | |
8 | ||
9 | FASTCALL - Used for those internal functions that have a simple | |
10 | body and a low number of arguments and local variables. | |
11 | ||
12 | PTRCALL - Used for functions called though function pointers. | |
13 | ||
14 | PTRFASTCALL - Like PTRCALL, but for low number of arguments. | |
15 | ||
16 | inline - Used for selected internal functions for which inlining | |
17 | may improve performance on some platforms. | |
18 | ||
19 | Note: Use of these macros is based on judgement, not hard rules, | |
20 | and therefore subject to change. | |
21 | */ | |
22 | ||
9cec343c VS |
23 | #ifdef FASTCALL |
24 | #undef FASTCALL | |
25 | #endif | |
26 | ||
5e9f2524 VS |
27 | #if defined(__GNUC__) |
28 | /* Instability reported with egcs on a RedHat Linux 7.3. | |
29 | Let's comment it out: | |
30 | #define FASTCALL __attribute__((stdcall, regparm(3))) | |
31 | and let's try this: | |
32 | */ | |
33 | #define FASTCALL __attribute__((regparm(3))) | |
34 | #define PTRCALL | |
35 | #define PTRFASTCALL __attribute__((regparm(3))) | |
36 | ||
37 | #elif defined(WIN32) | |
38 | /* Using __fastcall seems to have an unexpected negative effect under | |
39 | MS VC++, especially for function pointers, so we won't use it for | |
40 | now on that platform. It may be reconsidered for a future release | |
41 | if it can be made more effective. | |
42 | Likely reason: __fastcall on Windows is like stdcall, therefore | |
43 | the compiler cannot perform stack optimizations for call clusters. | |
44 | */ | |
45 | #define FASTCALL | |
46 | #define PTRCALL | |
47 | #define PTRFASTCALL | |
48 | ||
49 | #endif | |
50 | ||
51 | #ifndef FASTCALL | |
52 | #define FASTCALL | |
53 | #endif | |
54 | ||
55 | #ifndef PTRCALL | |
56 | #define PTRCALL | |
57 | #endif | |
58 | ||
59 | #ifndef PTRFASTCALL | |
60 | #define PTRFASTCALL | |
61 | #endif | |
62 | ||
63 | #ifndef XML_MIN_SIZE | |
64 | #if !defined(__cplusplus) && !defined(inline) | |
65 | #ifdef __GNUC__ | |
66 | #define inline __inline | |
67 | #endif /* __GNUC__ */ | |
68 | #endif | |
69 | #endif /* XML_MIN_SIZE */ | |
70 | ||
71 | #ifdef __cplusplus | |
72 | #define inline inline | |
73 | #else | |
74 | #ifndef inline | |
75 | #define inline | |
76 | #endif | |
77 | #endif |