1
/* ACC -- Automatic Compiler Configuration
3
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
6
This software is a copyrighted work licensed under the terms of
7
the GNU General Public License. Please consult the file "ACC_LICENSE"
10
Markus F.X.J. Oberhumer
11
<markus@oberhumer.com>
12
http://www.oberhumer.com/
16
#ifndef __ACC_CXX_H_INCLUDED
17
#define __ACC_CXX_H_INCLUDED 1
18
#if defined(__cplusplus)
21
/*************************************************************************
22
// exception specification
24
**************************************************************************/
26
#if defined(ACC_CXX_NOTHROW)
27
#elif (ACC_CC_GNUC && (ACC_CC_GNUC < 0x020800ul))
28
#elif (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0450))
30
#elif (ACC_CC_MSC && (_MSC_VER < 1100))
33
#elif (ACC_CC_WATCOMC && !defined(_CPPUNWIND))
34
#elif (ACC_CC_ZORTECHC)
36
# define ACC_CXX_NOTHROW throw()
39
#if !defined(ACC_CXX_NOTHROW)
40
# define ACC_CXX_NOTHROW
44
/*************************************************************************
45
// disable dynamic allocation of an object - private helpers
47
// __ACC_CXX_DO_DELETE
48
**************************************************************************/
50
#if defined(__ACC_CXX_DO_NEW)
51
#elif (ACC_CC_NDPC || ACC_CC_PGI)
52
# define __ACC_CXX_DO_NEW { return 0; }
54
# define __ACC_CXX_DO_NEW ;
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 { }
63
# define __ACC_CXX_DO_DELETE ACC_CXX_NOTHROW { }
67
/*************************************************************************
68
// disable dynamic allocation of an object
69
// ACC_CXX_DISABLE_NEW_DELETE
70
**************************************************************************/
73
#undef __ACC_CXX_HAVE_ARRAY_NEW
74
#undef __ACC_CXX_HAVE_PLACEMENT_NEW
75
#undef __ACC_CXX_HAVE_PLACEMENT_DELETE
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))
83
#elif (ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
85
#elif (ACC_CC_WATCOMC && (__WATCOMC__ < 1100))
87
# define __ACC_CXX_HAVE_ARRAY_NEW 1
90
#if (__ACC_CXX_HAVE_ARRAY_NEW)
91
# define __ACC_CXX_HAVE_PLACEMENT_NEW 1
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
102
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
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:
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 \
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
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
**************************************************************************/
137
#if defined(ACC_CXX_TRIGGER_FUNCTION)
139
# define ACC_CXX_TRIGGER_FUNCTION \
140
protected: virtual const void* acc_cxx_trigger_function() const; \
144
#if defined(ACC_CXX_TRIGGER_FUNCTION_IMPL)
146
# define ACC_CXX_TRIGGER_FUNCTION_IMPL(klass) \
147
const void* klass::acc_cxx_trigger_function() const { return 0; }
151
#endif /* __cplusplus */
152
#endif /* already included */