Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
26 | pmbaty | 1 | /* ACC -- Automatic Compiler Configuration |
2 | |||
3 | Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer |
||
4 | All Rights Reserved. |
||
5 | |||
6 | This software is a copyrighted work licensed under the terms of |
||
7 | the GNU General Public License. Please consult the file "ACC_LICENSE" |
||
8 | for details. |
||
9 | |||
10 | Markus F.X.J. Oberhumer |
||
11 | <markus@oberhumer.com> |
||
12 | http://www.oberhumer.com/ |
||
13 | */ |
||
14 | |||
15 | |||
16 | #ifndef __ACC_CXX_H_INCLUDED |
||
17 | #define __ACC_CXX_H_INCLUDED 1 |
||
18 | #if defined(__cplusplus) |
||
19 | |||
20 | |||
21 | /************************************************************************* |
||
22 | // exception specification |
||
23 | // ACC_CXX_NOTHROW |
||
24 | **************************************************************************/ |
||
25 | |||
26 | #if defined(ACC_CXX_NOTHROW) |
||
27 | #elif (ACC_CC_GNUC && (ACC_CC_GNUC < 0x020800ul)) |
||
28 | #elif (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0450)) |
||
29 | #elif (ACC_CC_HIGHC) |
||
30 | #elif (ACC_CC_MSC && (_MSC_VER < 1100)) |
||
31 | #elif (ACC_CC_NDPC) |
||
32 | #elif (ACC_CC_TURBOC) |
||
33 | #elif (ACC_CC_WATCOMC && !defined(_CPPUNWIND)) |
||
34 | #elif (ACC_CC_ZORTECHC) |
||
35 | #else |
||
36 | # define ACC_CXX_NOTHROW throw() |
||
37 | #endif |
||
38 | |||
39 | #if !defined(ACC_CXX_NOTHROW) |
||
40 | # define ACC_CXX_NOTHROW |
||
41 | #endif |
||
42 | |||
43 | |||
44 | /************************************************************************* |
||
45 | // disable dynamic allocation of an object - private helpers |
||
46 | // __ACC_CXX_DO_NEW |
||
47 | // __ACC_CXX_DO_DELETE |
||
48 | **************************************************************************/ |
||
49 | |||
50 | #if defined(__ACC_CXX_DO_NEW) |
||
51 | #elif (ACC_CC_NDPC || ACC_CC_PGI) |
||
52 | # define __ACC_CXX_DO_NEW { return 0; } |
||
53 | #else |
||
54 | # define __ACC_CXX_DO_NEW ; |
||
55 | #endif |
||
56 | |||
57 | |||
58 | /* need an implementation in case a class has virtual members */ |
||
59 | #if defined(__ACC_CXX_DO_DELETE) |
||
60 | #elif (ACC_CC_BORLANDC || ACC_CC_TURBOC) |
||
61 | # define __ACC_CXX_DO_DELETE { } |
||
62 | #else |
||
63 | # define __ACC_CXX_DO_DELETE ACC_CXX_NOTHROW { } |
||
64 | #endif |
||
65 | |||
66 | |||
67 | /************************************************************************* |
||
68 | // disable dynamic allocation of an object |
||
69 | // ACC_CXX_DISABLE_NEW_DELETE |
||
70 | **************************************************************************/ |
||
71 | |||
72 | /* |
||
73 | #undef __ACC_CXX_HAVE_ARRAY_NEW |
||
74 | #undef __ACC_CXX_HAVE_PLACEMENT_NEW |
||
75 | #undef __ACC_CXX_HAVE_PLACEMENT_DELETE |
||
76 | */ |
||
77 | |||
78 | #if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0450)) |
||
79 | #elif (ACC_CC_MSC && ACC_MM_HUGE) |
||
80 | # define ACC_CXX_DISABLE_NEW_DELETE private: |
||
81 | #elif (ACC_CC_MSC && (_MSC_VER < 1100)) |
||
82 | #elif (ACC_CC_NDPC) |
||
83 | #elif (ACC_CC_SYMANTECC || ACC_CC_ZORTECHC) |
||
84 | #elif (ACC_CC_TURBOC) |
||
85 | #elif (ACC_CC_WATCOMC && (__WATCOMC__ < 1100)) |
||
86 | #else |
||
87 | # define __ACC_CXX_HAVE_ARRAY_NEW 1 |
||
88 | #endif |
||
89 | |||
90 | #if (__ACC_CXX_HAVE_ARRAY_NEW) |
||
91 | # define __ACC_CXX_HAVE_PLACEMENT_NEW 1 |
||
92 | #endif |
||
93 | |||
94 | #if (__ACC_CXX_HAVE_PLACEMENT_NEW) |
||
95 | # if (ACC_CC_GNUC >= 0x030000ul) |
||
96 | # define __ACC_CXX_HAVE_PLACEMENT_DELETE 1 |
||
97 | # elif (ACC_CC_INTELC) |
||
98 | # define __ACC_CXX_HAVE_PLACEMENT_DELETE 1 |
||
99 | # elif (ACC_CC_MSC && (_MSC_VER >= 1200)) |
||
100 | # define __ACC_CXX_HAVE_PLACEMENT_DELETE 1 |
||
101 | # elif (ACC_CC_PGI) |
||
102 | # define __ACC_CXX_HAVE_PLACEMENT_DELETE 1 |
||
103 | # endif |
||
104 | #endif |
||
105 | |||
106 | |||
107 | #if defined(ACC_CXX_DISABLE_NEW_DELETE) |
||
108 | #elif defined(new) || defined(delete) |
||
109 | # define ACC_CXX_DISABLE_NEW_DELETE private: |
||
110 | #elif (ACC_CC_GNUC && (ACC_CC_GNUC < 0x025b00ul)) |
||
111 | # define ACC_CXX_DISABLE_NEW_DELETE private: |
||
112 | #elif (ACC_CC_HIGHC) |
||
113 | # define ACC_CXX_DISABLE_NEW_DELETE private: |
||
114 | #elif !defined(__ACC_CXX_HAVE_ARRAY_NEW) |
||
115 | /* for old compilers use `protected' instead of `private' */ |
||
116 | # define ACC_CXX_DISABLE_NEW_DELETE \ |
||
117 | protected: static void operator delete(void*) __ACC_CXX_DO_DELETE \ |
||
118 | protected: static void* operator new(size_t) __ACC_CXX_DO_NEW \ |
||
119 | private: |
||
120 | #else |
||
121 | # define ACC_CXX_DISABLE_NEW_DELETE \ |
||
122 | protected: static void operator delete(void*) __ACC_CXX_DO_DELETE \ |
||
123 | static void operator delete[](void*) __ACC_CXX_DO_DELETE \ |
||
124 | private: static void* operator new(size_t) __ACC_CXX_DO_NEW \ |
||
125 | static void* operator new[](size_t) __ACC_CXX_DO_NEW |
||
126 | #endif |
||
127 | |||
128 | |||
129 | /************************************************************************* |
||
130 | // Assist the compiler by defining a unique location for vtables and RTTI. |
||
131 | // Every class which has virtual member functions or derives from a class |
||
132 | // with virtual members should put this macro at the very top of its |
||
133 | // class declaration. |
||
134 | // ACC_CXX_TRIGGER_FUNCTION |
||
135 | **************************************************************************/ |
||
136 | |||
137 | #if defined(ACC_CXX_TRIGGER_FUNCTION) |
||
138 | #else |
||
139 | # define ACC_CXX_TRIGGER_FUNCTION \ |
||
140 | protected: virtual const void* acc_cxx_trigger_function() const; \ |
||
141 | private: |
||
142 | #endif |
||
143 | |||
144 | #if defined(ACC_CXX_TRIGGER_FUNCTION_IMPL) |
||
145 | #else |
||
146 | # define ACC_CXX_TRIGGER_FUNCTION_IMPL(klass) \ |
||
147 | const void* klass::acc_cxx_trigger_function() const { return 0; } |
||
148 | #endif |
||
149 | |||
150 | |||
151 | #endif /* __cplusplus */ |
||
152 | #endif /* already included */ |
||
153 | |||
154 | |||
155 | /* |
||
156 | vi:ts=4:et |
||
157 | */ |