Annotation of parser3/src/include/pa_config_includes.h, revision 1.79
1.5 paf 1: /** @file
2: Parser: includes all Configure-d headers
3:
1.79 ! moko 4: Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com)
1.68 moko 5: Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
1.5 paf 6:
7: when used Configure [HAVE_CONFIG_H] it uses defines from Configure,
8: fixed otherwise.
9: */
1.10 parser 10:
1.25 paf 11: #ifndef PA_CONFIG_INCLUDES_H
12: #define PA_CONFIG_INCLUDES_H
13:
1.1 paf 14: #if HAVE_CONFIG_H
1.37 moko 15: # include "pa_config_auto.h"
1.1 paf 16: #else
1.37 moko 17: # include "pa_config_fixed.h"
1.6 paf 18: #endif
19:
1.37 moko 20: // AC_INCLUDES_DEFAULT
21:
22: #ifdef HAVE_STDIO_H
23: # include <stdio.h>
1.1 paf 24: #endif
25:
1.37 moko 26: #ifdef HAVE_SYS_TYPES_H
27: # include <sys/types.h>
1.25 paf 28: #endif
29:
1.37 moko 30: #ifdef HAVE_SYS_STAT_H
31: # include <sys/stat.h>
1.3 paf 32: #endif
33:
1.43 moko 34: #ifdef HAVE_STDLIB_H
1.37 moko 35: # include <stdlib.h>
1.43 moko 36: #endif
37:
38: #ifdef HAVE_STDDEF_H
1.37 moko 39: # include <stddef.h>
1.3 paf 40: #endif
41:
1.37 moko 42: #ifdef HAVE_STRING_H
43: # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
44: # include <memory.h>
45: # endif
46: # include <string.h>
1.3 paf 47: #endif
48:
1.37 moko 49: #ifdef HAVE_STRINGS_H
50: # include <strings.h>
1.3 paf 51: #endif
52:
1.37 moko 53: #ifdef HAVE_INTTYPES_H
54: # include <inttypes.h>
1.3 paf 55: #endif
56:
1.37 moko 57: #ifdef HAVE_STDINT_H
58: # include <stdint.h>
1.1 paf 59: #endif
60:
1.37 moko 61: #ifdef HAVE_UNISTD_H
62: # include <unistd.h>
1.8 parser 63: #endif
64:
1.37 moko 65: // other includes
66:
67: #ifdef HAVE_ASSERT_H
68: # include <assert.h>
1.3 paf 69: #endif
70:
1.37 moko 71: #ifdef HAVE_LIMITS_H
72: # include <limits.h>
1.3 paf 73: #endif
74:
1.37 moko 75: #ifdef HAVE_CTYPE_H
76: # include <ctype.h>
1.1 paf 77: #endif
1.3 paf 78:
79: #ifdef HAVE_MATH_H
1.37 moko 80: # include <math.h>
1.3 paf 81: #endif
82:
1.37 moko 83: #ifdef HAVE_PROCESS_H
84: # include <process.h>
85: #endif
1.3 paf 86:
1.37 moko 87: #ifdef HAVE_STDARG_H
88: # include <stdarg.h>
1.3 paf 89: #endif
90:
1.37 moko 91: #ifdef HAVE_SETJMP_H
92: # include <setjmp.h>
1.35 moko 93: #endif
94:
1.37 moko 95: #ifdef HAVE_SIGNAL_H
96: # include <signal.h>
1.8 parser 97: #endif
98:
1.65 moko 99: #ifdef HAVE_PTHREAD_H
100: # include <pthread.h>
101: #endif
102:
1.37 moko 103: #ifdef HAVE_ERRNO_H
104: # include <errno.h>
1.9 parser 105: #endif
106:
1.39 moko 107: #ifdef HAVE_DIRENT_H
108: # include <dirent.h>
109: #endif
110:
1.37 moko 111: #ifdef HAVE_FCNTL_H
112: # include <fcntl.h>
1.13 paf 113: #endif
114:
1.37 moko 115: #ifdef HAVE_IO_H
116: # include <io.h>
1.14 paf 117: #endif
118:
119: #ifdef HAVE_SYS_FILE_H
1.37 moko 120: # include <sys/file.h>
1.14 paf 121: #endif
122:
123: #ifdef HAVE_SYS_LOCKING_H
1.37 moko 124: # include <sys/locking.h>
1.14 paf 125: #endif
126:
1.37 moko 127: #ifdef HAVE_SYS_SELECT_H
128: # include <sys/select.h>
1.15 paf 129: #endif
130:
1.37 moko 131: #ifdef HAVE_SYS_RESOURCE_H
132: # include <sys/resource.h>
1.4 paf 133: #endif
1.21 paf 134:
1.42 moko 135: #ifdef HAVE_SYS_WAIT_H
136: # include <sys/wait.h>
137: #endif
138:
1.21 paf 139:
1.22 paf 140: #ifdef HAVE_SYS_SOCKET_H
1.37 moko 141: # include <sys/socket.h>
1.41 moko 142: #endif
143:
1.22 paf 144: #ifdef HAVE_NETINET_IN_H
1.37 moko 145: # include <netinet/in.h>
1.22 paf 146: #endif
147:
148: #ifdef HAVE_ARPA_INET_H
1.37 moko 149: # include <arpa/inet.h>
1.22 paf 150: #endif
151:
152: #ifdef HAVE_NETDB_H
1.37 moko 153: # include <netdb.h>
1.22 paf 154: #endif
1.24 paf 155:
1.77 moko 156: #ifdef HAVE_SYS_TIME_H
157: # include <sys/time.h>
158: #endif
1.37 moko 159:
1.77 moko 160: #ifdef HAVE_TIME_H
1.37 moko 161: # include <time.h>
162: #endif
1.25 paf 163:
1.71 moko 164: #ifdef HAVE_PCRE2
165: #define PCRE2_CODE_UNIT_WIDTH 8
166: #endif
167:
1.25 paf 168: // math function replacements
169:
1.26 paf 170: #ifdef __cplusplus
171:
1.25 paf 172: #ifndef HAVE_TRUNC
173: inline double trunc(double param) { return param > 0? floor(param) : ceil(param); }
174: #endif
175:
176: #ifndef HAVE_ROUND
177: inline double round(double param) { return floor(param+0.5); }
178: #endif
179:
180: #ifndef HAVE_SIGN
181: inline double sign(double param) { return param > 0 ? 1 : ( param < 0 ? -1 : 0 ); }
182: #endif
183:
184: #if !defined(max)
1.75 moko 185: inline int max(int a, int b) { return a>b ? a : b; }
186: inline int min(int a, int b){ return a<b ? a : b; }
187: inline size_t max(size_t a, size_t b) { return a>b ? a : b; }
188: inline size_t min(size_t a, size_t b){ return a<b ? a : b; }
1.26 paf 189: #endif
190:
1.55 moko 191: #endif // __cplusplus
192:
193: // libgc usage configuration
194: //#define PA_DEBUG_DISABLE_GC
195:
196: #ifdef PA_DEBUG_DISABLE_GC
197:
198: #define GC_MALLOC(size) memset(malloc(size), 0 , size)
199: #define GC_MALLOC_ATOMIC(size) memset(malloc(size), 0 , size)
1.78 moko 200: #define GC_REALLOC(ptr, size) realloc(ptr, size) // warning: non-gc realloc doesn't zero expanded region
1.55 moko 201: #define GC_FREE(ptr) free(ptr)
202:
203: #define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
204: #define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
205:
206: #else
207:
1.56 moko 208: // allows to backtrace pointers
209: //#define GC_DEBUG
210:
1.57 moko 211: #include "../lib/gc/include/gc.h"
1.55 moko 212:
213: #endif // PA_DEBUG_DISABLE_GC
214:
1.25 paf 215:
1.53 moko 216: #ifdef __GNUC__
1.76 moko 217: # define PA_UNUSED __attribute__((unused))
1.50 moko 218: #else
1.76 moko 219: # define PA_UNUSED
1.50 moko 220: #endif
221:
1.74 moko 222: #ifdef _MSC_VER
1.33 moko 223: #define THREAD_LOCAL __declspec(thread)
224: #else
1.67 moko 225: #ifdef HAVE_TLS
1.64 moko 226: #define THREAD_LOCAL __thread
1.67 moko 227: #else
228: #define THREAD_LOCAL
229: #endif
1.33 moko 230: #endif
1.27 paf 231:
1.75 moko 232: #if defined(XML) && defined(__CYGWIN__)
233: // otherwise functions in libxml2 will be declared as __declspec(dllimport)
1.74 moko 234: #define LIBXML_STATIC
1.75 moko 235: // to compile static libxslt.a and and libexslt.a, define LIBXSLT_STATIC in xsltexports.h and LIBEXSLT_STATIC in exsltexports.h
1.74 moko 236: #endif
237:
1.53 moko 238: #ifdef __clang__
1.58 moko 239: #pragma clang diagnostic ignored "-Wparentheses" // if(a=b)
240: #pragma clang diagnostic ignored "-Wpointer-sign" // CORD (unsigned char *) to char * in libcord
241: #pragma clang diagnostic ignored "-Winline-new-delete" // test for regular new/delete usage in memory.h
1.61 moko 242:
1.74 moko 243: #elif defined(__GNUC__) && (__GNUC__ >= 7)
1.61 moko 244: #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" // case without break
245:
1.47 moko 246: #endif
1.45 moko 247:
1.52 moko 248: #ifdef _MSC_VER
1.59 moko 249: // VS 2003
1.37 moko 250: #pragma warning(disable:4355) // using this in calls to parent constructors
251: #pragma warning(disable:4291) // no matching operator delete found; memory will not be freed if initialization throws an exception
252: #pragma warning(disable:4512) // assignment operator could not be generated
253: #pragma warning(disable:4127) // conditional expression is constant; while(true) OK
254: #pragma warning(disable:4706) // assignment within conditional expression if(type var=somethig) OK
255: #pragma warning(disable:4996) // memcpy deprecation
1.44 moko 256: #pragma warning(disable:4702) // unreachable code
1.48 moko 257: #pragma warning(disable:4511) // copy constructor could not be generated (vs2003 specific)
1.59 moko 258: // VS 2015
259: #pragma warning(disable:4267) // conversion from 'size_t' to 'int', possible loss of data
1.27 paf 260: #endif
261:
1.24 paf 262: #endif
E-mail: