Annotation of parser3/src/include/pa_config_includes.h, revision 1.32
1.5 paf 1: /** @file
2: Parser: includes all Configure-d headers
3:
1.31 paf 4: Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com)
1.17 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://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.10 parser 14: #if _MSC_VER
15: # pragma warning(disable:4291) // disable warning
16: // "no matching operator delete found; memory will not be freed if initialization throws an exception
17: #endif
1.5 paf 18:
1.1 paf 19: #if HAVE_CONFIG_H
20: # include "pa_config_auto.h"
21: #else
22: # include "pa_config_fixed.h"
1.6 paf 23: #endif
24:
1.7 paf 25: #ifdef __cplusplus
26: # undef inline
1.1 paf 27: #endif
28:
1.25 paf 29: #ifdef HAVE_ASSERT_H
30: # include <assert.h>
31: #endif
32:
1.3 paf 33: #ifdef HAVE_CTYPE_H
34: # include <ctype.h>
35: #endif
36:
37: #ifdef HAVE_ERRNO_H
38: # include <errno.h>
39: #endif
40:
41: #ifdef HAVE_FCNTL_H
42: # include <fcntl.h>
43: #endif
44:
45: #ifdef HAVE_IO_H
46: # include <io.h>
47: #endif
48:
49: #ifdef HAVE_PROCESS_H
50: # include <process.h>
51: #endif
52:
1.1 paf 53: #ifdef HAVE_STDARG_H
54: # include <stdarg.h>
55: #endif
56:
1.8 parser 57: #ifdef HAVE_STDDEF_H
58: # include <stddef.h>
59: #endif
60:
1.3 paf 61: #ifdef HAVE_STDIO_H
62: # include <stdio.h>
63: #endif
64:
65: #ifdef HAVE_SYS_STAT_H
66: # include <sys/stat.h>
67: #endif
68:
69: #if defined(HAVE_UNISTD_H) && !defined(NO_UNISTD_H)
1.1 paf 70: # include <unistd.h>
71: #endif
1.3 paf 72:
73: #ifdef HAVE_MATH_H
74: # include <math.h>
75: #endif
76:
1.25 paf 77: #include <stdlib.h>
1.3 paf 78:
79: #ifdef HAVE_STRING_H
80: # include <string.h>
81: #endif
82:
1.4 paf 83: #ifdef HAVE_DIRECT_H
84: # include <direct.h>
1.8 parser 85: #endif
86:
87: #ifdef HAVE_SETJMP_H
88: # include <setjmp.h>
1.9 parser 89: #endif
90:
91: #ifdef HAVE_MEMORY_H
92: # include <memory.h>
1.13 paf 93: #endif
94:
95: #ifdef HAVE_NEW
96: #include <new>
1.14 paf 97: #endif
98:
99: #ifdef HAVE_SYS_FILE_H
100: #include <sys/file.h>
101: #endif
102:
103: #ifdef HAVE_SYS_LOCKING_H
104: #include <sys/locking.h>
105: #endif
106:
107: #ifdef HAVE_SYS_TYPES_H
108: #include <sys/types.h>
1.15 paf 109: #endif
110:
111: #ifdef HAVE_SYS_SELECT_H
112: #include <sys/select.h>
1.4 paf 113: #endif
1.21 paf 114:
115: #ifdef HAVE_SIGNAL_H
116: #include <signal.h>
117: #endif
118:
1.22 paf 119: #ifdef HAVE_SYS_SOCKET_H
1.25 paf 120: # include <sys/socket.h>
121: #else
122: # if defined(HAVE_WINSOCK_H) && !defined(_MSC_VER) && !defined(CYGWIN)
123: # include <winsock.h>
124: # endif
1.22 paf 125: #endif
126:
1.25 paf 127: // must go anywhere after winsock [cygwin time.h checks for already inclusion of winsock.h]
128: #if TIME_WITH_SYS_TIME
129: # include <sys/time.h>
130: # include <time.h>
131: #else
132: # ifdef HAVE_SYS_TIME_H
133: # include <sys/time.h>
134: # else
135: # include <time.h>
136: # endif
137: #endif
138:
139:
1.22 paf 140: #ifdef HAVE_NETINET_IN_H
141: #include <netinet/in.h>
142: #endif
143:
144: #ifdef HAVE_ARPA_INET_H
145: #include <arpa/inet.h>
146: #endif
147:
148: #ifdef HAVE_NETDB_H
149: #include <netdb.h>
150: #endif
1.24 paf 151:
1.25 paf 152:
153: // math function replacements
154:
1.26 paf 155: #ifdef __cplusplus
156:
1.25 paf 157: #ifndef HAVE_TRUNC
158: inline double trunc(double param) { return param > 0? floor(param) : ceil(param); }
159: #endif
160:
161: #ifndef HAVE_ROUND
162: inline double round(double param) { return floor(param+0.5); }
163: #endif
164:
165: #ifndef HAVE_SIGN
166: inline double sign(double param) { return param > 0 ? 1 : ( param < 0 ? -1 : 0 ); }
167: #endif
168:
169: #if !defined(max)
1.24 paf 170: inline int max(int a, int b) { return a>b?a:b; }
171: inline int min(int a, int b){ return a<b?a:b; }
172: inline size_t max(size_t a, size_t b) { return a>b?a:b; }
173: inline size_t min(size_t a, size_t b){ return a<b?a:b; }
1.26 paf 174: #endif
175:
1.25 paf 176: #endif
177:
1.27 paf 178:
179: #if _MSC_VER
180: // using this in calls to parent constructors
181: #pragma warning(disable:4355)
182:
183: //# pragma warning(disable:4065) // switch statement contains 'default'
184: // but no 'case' labels
185: //# pragma warning(disable:4800) // (bool)(1&2)
186:
187: // assignment operator could not be generated
188: //#pragma warning(disable:4512)
189:
190: // identifier was truncated to '255' characters in the debug information
191: #pragma warning(disable:4786)
192:
193: // copy constructor could not be generated
194: #pragma warning(disable:4511)
195:
196: // assignment operator could not be generated
197: #pragma warning(disable:4512)
198:
199: // unreferenced local function has been removed
200: #pragma warning(disable:4505)
201:
202: // conditional expression is constant; while(true) OK
203: #pragma warning(disable:4127)
204:
205: // assignment within conditional expression if(type var=somethig) OK
206: #pragma warning(disable:4706)
207:
1.29 paf 208: // memcpy deprecation
209: #pragma warning(disable:4996)
210:
1.27 paf 211:
212: #if 0
213: #ifdef _DEBUG
214: # define _CRTDBG_MAP_ALLOC
215: // When the _CRTDBG_MAP_ALLOC flag is defined in the debug version of an application,
216: // the base version of the heap functions are directly mapped to their debug versions
217: #endif
218: #endif
219:
220: #endif
221:
1.30 paf 222: #ifdef PA_RELEASE_ASSERTS
223: // this helps to remove warnings on helper-to-assert variables
224: #undef NDEBUG
225: // pa_globals.C
226: void pa_release_assert(const char* str, const char* file, int line);
227: #undef assert
228: #define assert(exp) (void)( (exp) || (pa_release_assert(#exp, __FILE__, __LINE__), 0) )
229: #endif
230:
1.32 ! paf 231: /// to debug backtrace pointers switch this on:
! 232: #if defined(_DEBUG) || defined(PA_RELEASE_ASSERTS)
! 233: //// this switches on straightforward realloc implementation, bad for profiling
! 234: //// note: this is incompatible with -DGC_ASSERTIONS, which can be switched ON in win32/gc/NT_THREADS_MAKEFILE
! 235: #define GC_DEBUG
! 236: #endif
! 237:
1.24 paf 238: #endif
E-mail: