blob: dd5454831da2b4e8f3a8406a2a7c72cc79c6539e [file] [log] [blame]
Martin v. Löwisfc03a942003-01-25 22:41:29 +00001/* 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
Gregory P. Smith7c6309c2012-07-14 14:12:35 -070023#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__)
Fred Drake08317ae2003-10-21 15:38:55 +000024/* We'll use this version by default only where we know it helps.
25
26 regparm() generates warnings on Solaris boxes. See SF bug #692878.
27
28 Instability reported with egcs on a RedHat Linux 7.3.
29 Let's comment out:
Martin v. Löwisfc03a942003-01-25 22:41:29 +000030 #define FASTCALL __attribute__((stdcall, regparm(3)))
31 and let's try this:
32*/
33#define FASTCALL __attribute__((regparm(3)))
Martin v. Löwisfc03a942003-01-25 22:41:29 +000034#define PTRFASTCALL __attribute__((regparm(3)))
Fred Drake08317ae2003-10-21 15:38:55 +000035#endif
Martin v. Löwisfc03a942003-01-25 22:41:29 +000036
Martin v. Löwisfc03a942003-01-25 22:41:29 +000037/* Using __fastcall seems to have an unexpected negative effect under
38 MS VC++, especially for function pointers, so we won't use it for
39 now on that platform. It may be reconsidered for a future release
40 if it can be made more effective.
41 Likely reason: __fastcall on Windows is like stdcall, therefore
42 the compiler cannot perform stack optimizations for call clusters.
43*/
Martin v. Löwisfc03a942003-01-25 22:41:29 +000044
Fred Drake08317ae2003-10-21 15:38:55 +000045/* Make sure all of these are defined if they aren't already. */
Martin v. Löwisfc03a942003-01-25 22:41:29 +000046
47#ifndef FASTCALL
48#define FASTCALL
49#endif
50
51#ifndef PTRCALL
52#define PTRCALL
53#endif
54
55#ifndef PTRFASTCALL
56#define PTRFASTCALL
57#endif
58
59#ifndef XML_MIN_SIZE
60#if !defined(__cplusplus) && !defined(inline)
61#ifdef __GNUC__
62#define inline __inline
63#endif /* __GNUC__ */
64#endif
65#endif /* XML_MIN_SIZE */
66
67#ifdef __cplusplus
68#define inline inline
69#else
70#ifndef inline
71#define inline
72#endif
73#endif