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