Annotation of parser3/src/include/pa_config_includes.h, revision 1.72
1.5 paf 1: /** @file
2: Parser: includes all Configure-d headers
3:
1.68 moko 4: Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com)
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.37 moko 156:
157: #if TIME_WITH_SYS_TIME
158: # include <sys/time.h>
159: # include <time.h>
160: #else
161: # ifdef HAVE_SYS_TIME_H
162: # include <sys/time.h>
163: # else
164: # include <time.h>
165: # endif
166: #endif
1.25 paf 167:
1.71 moko 168: #ifdef HAVE_PCRE2
169: #define PCRE2_CODE_UNIT_WIDTH 8
170: #endif
171:
1.25 paf 172: // math function replacements
173:
1.26 paf 174: #ifdef __cplusplus
175:
1.25 paf 176: #ifndef HAVE_TRUNC
177: inline double trunc(double param) { return param > 0? floor(param) : ceil(param); }
178: #endif
179:
180: #ifndef HAVE_ROUND
181: inline double round(double param) { return floor(param+0.5); }
182: #endif
183:
184: #ifndef HAVE_SIGN
185: inline double sign(double param) { return param > 0 ? 1 : ( param < 0 ? -1 : 0 ); }
186: #endif
187:
188: #if !defined(max)
1.24 paf 189: inline int max(int a, int b) { return a>b?a:b; }
190: inline int min(int a, int b){ return a<b?a:b; }
191: inline size_t max(size_t a, size_t b) { return a>b?a:b; }
192: inline size_t min(size_t a, size_t b){ return a<b?a:b; }
1.26 paf 193: #endif
194:
1.55 moko 195: #endif // __cplusplus
196:
197: // libgc usage configuration
198: //#define PA_DEBUG_DISABLE_GC
199:
200: #ifdef PA_DEBUG_DISABLE_GC
201:
202: #define GC_MALLOC(size) memset(malloc(size), 0 , size)
203: #define GC_MALLOC_ATOMIC(size) memset(malloc(size), 0 , size)
204: #define GC_REALLOC(ptr, size) realloc(ptr, size)
205: #define GC_FREE(ptr) free(ptr)
206:
207: #define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
208: #define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
209:
210: #else
211:
1.56 moko 212: // allows to backtrace pointers
213: //#define GC_DEBUG
214:
1.57 moko 215: #include "../lib/gc/include/gc.h"
1.55 moko 216:
217: #endif // PA_DEBUG_DISABLE_GC
218:
1.25 paf 219:
1.53 moko 220: #ifdef __GNUC__
1.50 moko 221: # define PA_ATTR_UNUSED __attribute__((unused))
222: #else
223: # define PA_ATTR_UNUSED
224: #endif
225:
1.33 moko 226: #ifdef WIN32
227: #define THREAD_LOCAL __declspec(thread)
228: #else
1.67 moko 229: #ifdef HAVE_TLS
1.64 moko 230: #define THREAD_LOCAL __thread
1.67 moko 231: #else
232: #define THREAD_LOCAL
233: #endif
1.33 moko 234: #endif
1.27 paf 235:
1.53 moko 236: #ifdef __clang__
1.58 moko 237: #pragma clang diagnostic ignored "-Wparentheses" // if(a=b)
238: #pragma clang diagnostic ignored "-Wpointer-sign" // CORD (unsigned char *) to char * in libcord
239: #pragma clang diagnostic ignored "-Winline-new-delete" // test for regular new/delete usage in memory.h
1.61 moko 240:
241: #elif defined(__GNUC__)
242: #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" // case without break
243:
1.47 moko 244: #endif
1.45 moko 245:
1.52 moko 246: #ifdef _MSC_VER
1.59 moko 247: // VS 2003
1.37 moko 248: #pragma warning(disable:4355) // using this in calls to parent constructors
249: #pragma warning(disable:4291) // no matching operator delete found; memory will not be freed if initialization throws an exception
250: #pragma warning(disable:4512) // assignment operator could not be generated
251: #pragma warning(disable:4127) // conditional expression is constant; while(true) OK
252: #pragma warning(disable:4706) // assignment within conditional expression if(type var=somethig) OK
253: #pragma warning(disable:4996) // memcpy deprecation
1.44 moko 254: #pragma warning(disable:4702) // unreachable code
1.48 moko 255: #pragma warning(disable:4511) // copy constructor could not be generated (vs2003 specific)
1.59 moko 256: // VS 2015
257: #pragma warning(disable:4267) // conversion from 'size_t' to 'int', possible loss of data
1.27 paf 258: #endif
259:
1.24 paf 260: #endif
E-mail: