Rev 26 | Details | Compare with Previous | 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 | /*********************************************************************** |
||
| 17 | // acc_alignof() / acc_inline |
||
| 18 | ************************************************************************/ |
||
| 19 | |||
| 20 | #if (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI) |
||
| 21 | # define acc_alignof(e) __alignof__(e) |
||
| 22 | #elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 700)) |
||
| 23 | # define acc_alignof(e) __alignof__(e) |
||
| 24 | #elif (ACC_CC_MSC && (_MSC_VER >= 1300)) |
||
| 25 | # define acc_alignof(e) __alignof(e) |
||
| 26 | #endif |
||
| 27 | |||
| 28 | #if (ACC_CC_TURBOC && (__TURBOC__ <= 0x0295)) |
||
| 29 | #elif defined(__cplusplus) |
||
| 30 | # define acc_inline inline |
||
| 31 | #elif (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) |
||
| 32 | # define acc_inline __inline |
||
| 33 | #elif (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI) |
||
| 34 | # define acc_inline __inline__ |
||
| 35 | #elif (ACC_CC_DMC) |
||
| 36 | # define acc_inline __inline |
||
| 37 | #elif (ACC_CC_INTELC) |
||
| 38 | # define acc_inline __inline |
||
| 39 | #elif (ACC_CC_MSC && (_MSC_VER >= 900)) |
||
| 40 | # define acc_inline __inline |
||
| 41 | #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) |
||
| 42 | # define acc_inline inline |
||
| 43 | #endif |
||
| 44 | |||
| 45 | |||
| 46 | /*********************************************************************** |
||
| 47 | // ACC_UNUSED / ACC_UNUSED_FUNC |
||
| 48 | ************************************************************************/ |
||
| 49 | |||
| 50 | #if !defined(ACC_UNUSED) |
||
| 51 | # if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) |
||
| 52 | # define ACC_UNUSED(var) ((void) &var) |
||
| 53 | # elif (ACC_CC_BORLANDC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_TURBOC) |
||
| 54 | # define ACC_UNUSED(var) if (&var) ; else |
||
| 55 | # elif (ACC_CC_MSC && (_MSC_VER < 900)) |
||
| 56 | # define ACC_UNUSED(var) if (&var) ; else |
||
| 57 | # elif (ACC_CC_GNUC) |
||
| 58 | # define ACC_UNUSED(var) ((void) var) |
||
| 59 | # elif (ACC_CC_KEILC) |
||
| 60 | # define ACC_UNUSED(var) |
||
| 61 | # else |
||
| 62 | # define ACC_UNUSED(var) ((void) &var) |
||
| 63 | # endif |
||
| 64 | #endif |
||
| 65 | #if !defined(ACC_UNUSED_FUNC) |
||
| 66 | # if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) |
||
| 67 | # define ACC_UNUSED_FUNC(func) ((void) func) |
||
| 68 | # elif (ACC_CC_BORLANDC || ACC_CC_NDPC || ACC_CC_TURBOC) |
||
| 69 | # define ACC_UNUSED_FUNC(func) if (func) ; else |
||
| 70 | # elif (ACC_CC_GNUC == 0x030400ul) && defined(__llvm__) |
||
| 71 | # define ACC_UNUSED_FUNC(func) ((void) &func) |
||
| 72 | # elif (ACC_CC_MSC && (_MSC_VER < 900)) |
||
| 73 | # define ACC_UNUSED_FUNC(func) if (func) ; else |
||
| 74 | # elif (ACC_CC_MSC) |
||
| 75 | # define ACC_UNUSED_FUNC(func) ((void) &func) |
||
| 76 | # elif (ACC_CC_KEILC) |
||
| 77 | # define ACC_UNUSED_FUNC(func) |
||
| 78 | # else |
||
| 79 | # define ACC_UNUSED_FUNC(func) ((void) func) |
||
| 80 | # endif |
||
| 81 | #endif |
||
| 82 | |||
| 83 | |||
| 84 | /*********************************************************************** |
||
| 85 | // compile-time-assertions |
||
| 86 | ************************************************************************/ |
||
| 87 | |||
| 88 | /* This can be put into a header file but may get ignored by some compilers. */ |
||
| 89 | #if !defined(ACC_COMPILE_TIME_ASSERT_HEADER) |
||
| 28 | pmbaty | 90 | # if (__cplusplus >= 201103L) /* Pierre-Marie Baty -- (much cleaner) C11 addition */ |
| 91 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) static_assert(e, #e); |
||
| 92 | # elif (__STDC_VERSION__ >= 201112L) /* Pierre-Marie Baty -- (much cleaner) C11 addition */ |
||
| 93 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) _Static_assert(e, #e); |
||
| 94 | # elif (ACC_CC_AZTECC || ACC_CC_ZORTECHC) |
||
| 26 | pmbaty | 95 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-!(e)]; |
| 96 | # elif (ACC_CC_DMC || ACC_CC_SYMANTECC) |
||
| 97 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1u-2*!(e)]; |
||
| 98 | # elif (ACC_CC_TURBOC && (__TURBOC__ == 0x0295)) |
||
| 99 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-!(e)]; |
||
| 100 | # else |
||
| 101 | # define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-2*!(e)]; |
||
| 102 | # endif |
||
| 103 | #endif |
||
| 104 | |||
| 105 | /* This must appear within a function body. */ |
||
| 106 | #if !defined(ACC_COMPILE_TIME_ASSERT) |
||
| 107 | # if (ACC_CC_AZTECC) |
||
| 108 | # define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-!(e)];} |
||
| 109 | # elif (ACC_CC_DMC || ACC_CC_PACIFICC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC) |
||
| 110 | # define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; |
||
| 111 | # elif (ACC_CC_MSC && (_MSC_VER < 900)) |
||
| 112 | # define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; |
||
| 113 | # elif (ACC_CC_TURBOC && (__TURBOC__ == 0x0295)) |
||
| 114 | # define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; |
||
| 115 | # else |
||
| 116 | # define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-2*!(e)];} |
||
| 117 | # endif |
||
| 118 | #endif |
||
| 119 | |||
| 120 | |||
| 121 | /*********************************************************************** |
||
| 122 | // macros |
||
| 123 | ************************************************************************/ |
||
| 124 | |||
| 125 | #if !defined(__ACC_UINT_MAX) |
||
| 126 | # define __ACC_INT_MAX(b) ((((1l << ((b)-2)) - 1l) * 2l) + 1l) |
||
| 127 | # define __ACC_UINT_MAX(b) ((((1ul << ((b)-1)) - 1ul) * 2ul) + 1ul) |
||
| 128 | #endif |
||
| 129 | |||
| 130 | |||
| 131 | /*********************************************************************** |
||
| 132 | // get sizes of builtin integral types from <limits.h> |
||
| 133 | ************************************************************************/ |
||
| 134 | |||
| 135 | #if !defined(__ACC_SHORT_BIT) |
||
| 136 | # if (USHRT_MAX == ACC_0xffffL) |
||
| 137 | # define __ACC_SHORT_BIT 16 |
||
| 138 | # elif (USHRT_MAX == ACC_0xffffffffL) |
||
| 139 | # define __ACC_SHORT_BIT 32 |
||
| 140 | # elif (USHRT_MAX == __ACC_UINT_MAX(64)) |
||
| 141 | # define __ACC_SHORT_BIT 64 |
||
| 142 | # elif (USHRT_MAX == __ACC_UINT_MAX(128)) |
||
| 143 | # define __ACC_SHORT_BIT 128 |
||
| 144 | # else |
||
| 145 | # error "check your compiler installation: USHRT_MAX" |
||
| 146 | # endif |
||
| 147 | #endif |
||
| 148 | |||
| 149 | #if !defined(__ACC_INT_BIT) |
||
| 150 | # if (UINT_MAX == ACC_0xffffL) |
||
| 151 | # define __ACC_INT_BIT 16 |
||
| 152 | # elif (UINT_MAX == ACC_0xffffffffL) |
||
| 153 | # define __ACC_INT_BIT 32 |
||
| 154 | # elif (UINT_MAX == __ACC_UINT_MAX(64)) |
||
| 155 | # define __ACC_INT_BIT 64 |
||
| 156 | # elif (UINT_MAX == __ACC_UINT_MAX(128)) |
||
| 157 | # define __ACC_INT_BIT 128 |
||
| 158 | # else |
||
| 159 | # error "check your compiler installation: UINT_MAX" |
||
| 160 | # endif |
||
| 161 | #endif |
||
| 162 | |||
| 163 | #if !defined(__ACC_LONG_BIT) |
||
| 164 | # if (ULONG_MAX == ACC_0xffffffffL) |
||
| 165 | # define __ACC_LONG_BIT 32 |
||
| 166 | # elif (ULONG_MAX == __ACC_UINT_MAX(64)) |
||
| 167 | # define __ACC_LONG_BIT 64 |
||
| 168 | # elif (ULONG_MAX == __ACC_UINT_MAX(128)) |
||
| 169 | # define __ACC_LONG_BIT 128 |
||
| 170 | # else |
||
| 171 | # error "check your compiler installation: ULONG_MAX" |
||
| 172 | # endif |
||
| 173 | #endif |
||
| 174 | |||
| 175 | |||
| 176 | /*********************************************************************** |
||
| 177 | // acc_auto.h supplements |
||
| 178 | ************************************************************************/ |
||
| 179 | |||
| 180 | #if (ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)) || ACC_OS_WIN32 || ACC_OS_WIN64) |
||
| 181 | # if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000)) |
||
| 182 | # elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__) |
||
| 183 | /* ancient pw32 version */ |
||
| 184 | # elif ((ACC_OS_CYGWIN || defined(__MINGW32__)) && (ACC_CC_GNUC && (ACC_CC_GNUC < 0x025f00ul))) |
||
| 185 | /* ancient cygwin/mingw version */ |
||
| 186 | # else |
||
| 187 | # define ACC_HAVE_WINDOWS_H 1 |
||
| 188 | # endif |
||
| 189 | #endif |
||
| 190 | |||
| 191 | |||
| 192 | |||
| 193 | /* |
||
| 194 | vi:ts=4:et |
||
| 195 | */ |