Changeset 30253 in vbox for trunk/include
- Timestamp:
- Jun 16, 2010 2:18:53 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/assert.h
r30246 r30253 275 275 /** @def RTASSERT_HAVE_STATIC_ASSERT 276 276 * Indicates that the compiler implements static_assert(expr, msg). 277 * @todo Does any GCC version support static_assert?278 * @ Yes, as of gcc-4.3 with 'g++ -std=c++0x' but only in g++, not gcc!279 277 */ 280 278 #ifdef _MSC_VER … … 283 281 # endif 284 282 #endif 283 #if defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__) 284 # define RTASSERT_HAVE_STATIC_ASSERT 285 #endif 285 286 #ifdef DOXYGEN_RUNNING 286 287 # define RTASSERT_HAVE_STATIC_ASSERT 287 288 #endif 288 289 290 /** @def AssertCompileNS 291 * Asserts that a compile-time expression is true. If it's not break the build. 292 * 293 * This differs from AssertCompile in that it accepts some more expressions 294 * than what C++0x allows - NS = Non-standard. 295 * 296 * @param expr Expression which should be true. 297 */ 298 #ifdef __GNUC__ 299 # define AssertCompileNS(expr) extern int RTASSERTVAR[1] __attribute__((unused)), RTASSERTVAR[(expr) ? 1 : 0] __attribute__((unused)) 300 #else 301 # define AssertCompileNS(expr) typedef int RTASSERTTYPE[(expr) ? 1 : 0] 302 #endif 303 289 304 /** @def AssertCompile 290 * Asserts that a compile-time expression is true. If it's not break the build. 305 * Asserts that a C++0x compile-time expression is true. If it's not break the 306 * build. 291 307 * @param expr Expression which should be true. 292 308 */ 293 309 #ifdef RTASSERT_HAVE_STATIC_ASSERT 294 310 # define AssertCompile(expr) static_assert(!!(expr), #expr) 295 #elif defined(__GNUC__) 296 # define AssertCompile(expr) extern int RTASSERTVAR[1] __attribute__((unused)), RTASSERTVAR[(expr) ? 1 : 0] __attribute__((unused)) 297 #else 298 # define AssertCompile(expr) typedef int RTASSERTTYPE[(expr) ? 1 : 0] 311 #else 312 # define AssertCompile(expr) AssertCompileNS(expr) 299 313 #endif 300 314
Note:
See TracChangeset
for help on using the changeset viewer.