blob: e33fdcb0238d727c0c5097481a0548d906dca072 [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.
Victor Stinner759e30e2017-09-05 01:58:08 +020021 __ __ _
22 ___\ \/ /_ __ __ _| |_
23 / _ \\ /| '_ \ / _` | __|
24 | __// \| |_) | (_| | |_
25 \___/_/\_\ .__/ \__,_|\__|
26 |_| XML parser
27
28 Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
29 Copyright (c) 2000-2017 Expat development team
30 Licensed under the MIT license:
31
32 Permission is hereby granted, free of charge, to any person obtaining
33 a copy of this software and associated documentation files (the
34 "Software"), to deal in the Software without restriction, including
35 without limitation the rights to use, copy, modify, merge, publish,
36 distribute, sublicense, and/or sell copies of the Software, and to permit
37 persons to whom the Software is furnished to do so, subject to the
38 following conditions:
39
40 The above copyright notice and this permission notice shall be included
41 in all copies or substantial portions of the Software.
42
43 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
44 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
46 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
47 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
48 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
49 USE OR OTHER DEALINGS IN THE SOFTWARE.
Martin v. Löwisfc03a942003-01-25 22:41:29 +000050*/
51
Gregory P. Smith7c6309c2012-07-14 14:12:35 -070052#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__)
Fred Drake08317ae2003-10-21 15:38:55 +000053/* We'll use this version by default only where we know it helps.
54
55 regparm() generates warnings on Solaris boxes. See SF bug #692878.
56
57 Instability reported with egcs on a RedHat Linux 7.3.
58 Let's comment out:
Martin v. Löwisfc03a942003-01-25 22:41:29 +000059 #define FASTCALL __attribute__((stdcall, regparm(3)))
60 and let's try this:
61*/
62#define FASTCALL __attribute__((regparm(3)))
Martin v. Löwisfc03a942003-01-25 22:41:29 +000063#define PTRFASTCALL __attribute__((regparm(3)))
Fred Drake08317ae2003-10-21 15:38:55 +000064#endif
Martin v. Löwisfc03a942003-01-25 22:41:29 +000065
Martin v. Löwisfc03a942003-01-25 22:41:29 +000066/* Using __fastcall seems to have an unexpected negative effect under
67 MS VC++, especially for function pointers, so we won't use it for
68 now on that platform. It may be reconsidered for a future release
69 if it can be made more effective.
70 Likely reason: __fastcall on Windows is like stdcall, therefore
71 the compiler cannot perform stack optimizations for call clusters.
72*/
Martin v. Löwisfc03a942003-01-25 22:41:29 +000073
Fred Drake08317ae2003-10-21 15:38:55 +000074/* Make sure all of these are defined if they aren't already. */
Martin v. Löwisfc03a942003-01-25 22:41:29 +000075
76#ifndef FASTCALL
77#define FASTCALL
78#endif
79
80#ifndef PTRCALL
81#define PTRCALL
82#endif
83
84#ifndef PTRFASTCALL
85#define PTRFASTCALL
86#endif
87
88#ifndef XML_MIN_SIZE
89#if !defined(__cplusplus) && !defined(inline)
90#ifdef __GNUC__
91#define inline __inline
92#endif /* __GNUC__ */
93#endif
94#endif /* XML_MIN_SIZE */
95
96#ifdef __cplusplus
97#define inline inline
98#else
99#ifndef inline
100#define inline
101#endif
102#endif
Victor Stinner23ec4b52017-06-15 00:54:36 +0200103
104#ifndef UNUSED_P
105# ifdef __GNUC__
106# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__))
107# else
108# define UNUSED_P(p) UNUSED_ ## p
109# endif
110#endif
111
112
113#ifdef __cplusplus
114extern "C" {
115#endif
116
117
118void
Benjamin Peterson4e211002018-06-26 19:25:45 -0700119_INTERNAL_trim_to_complete_utf8_characters(const char * from, const char ** fromLimRef);
Victor Stinner23ec4b52017-06-15 00:54:36 +0200120
121
122#ifdef __cplusplus
123}
124#endif