internal.h 2.3 KB

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