ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since ada0eb06 was
f1a4ccb,
checked in by Thierry Delisle <tdelisle@…>, 7 years ago
|
Cleaned-up cassert to match more closely to the c++ one
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[12756de] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
[4f147cc] | 6 | // |
---|
| 7 | // assert.h -- |
---|
| 8 | // |
---|
[12756de] | 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Thu Aug 18 13:19:26 2016 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[d6c1dd0] | 12 | // Last Modified On : Tue Aug 1 11:56:01 2017 |
---|
| 13 | // Update Count : 16 |
---|
[4f147cc] | 14 | // |
---|
| 15 | |
---|
| 16 | #pragma once |
---|
[bf2438c] | 17 | // Pragmas for header cleanup tool |
---|
| 18 | // IWYU pragma: private, include <cassert> |
---|
[12756de] | 19 | |
---|
[e59c088] | 20 | #include_next <cassert> |
---|
[12756de] | 21 | |
---|
[e59c088] | 22 | #ifdef NDEBUG |
---|
[12756de] | 23 | |
---|
[e59c088] | 24 | #define assertf(expr, fmt, ...) (__ASSERT_VOID_ASSERT (0)) |
---|
| 25 | |
---|
| 26 | #else |
---|
| 27 | |
---|
| 28 | #define assertf(expr, fmt, ...) ((expr) \ |
---|
| 29 | ? (__ASSERT_VOID_CAST (0)) \ |
---|
| 30 | : __assert_fail_f( #expr, __FILE__, __LINE__, \ |
---|
| 31 | __ASSERT_FUNCTION, fmt, ## __VA_ARGS__ )) |
---|
| 32 | |
---|
| 33 | void __assert_fail_f( const char *assertion, const char *file, |
---|
| 34 | unsigned int line, const char *function, |
---|
| 35 | const char *fmt, ... |
---|
| 36 | ) __attribute__((noreturn, format(printf, 5, 6))); |
---|
| 37 | |
---|
| 38 | #endif |
---|
[12756de] | 39 | |
---|
[4f147cc] | 40 | template<typename T, typename U> |
---|
[d6c1dd0] | 41 | static inline T safe_dynamic_cast( const U & src ) { |
---|
[4f147cc] | 42 | T ret = dynamic_cast<T>(src); |
---|
| 43 | assert(ret); |
---|
| 44 | return ret; |
---|
| 45 | } |
---|
| 46 | |
---|
[12756de] | 47 | // Local Variables: // |
---|
| 48 | // tab-width: 4 // |
---|
| 49 | // mode: c++ // |
---|
| 50 | // compile-command: "make install" // |
---|
| 51 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.