ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
|
Last change
on this file since 11dbfe1 was d1969a6, checked in by Rob Schluntz <rschlunt@…>, 9 years ago |
|
check that assignment routines have a reasonable signature, add noreturn attribute to assert_fail_f to silence warnings
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 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.
|
|---|
| 6 | //
|
|---|
| 7 | // assert.h --
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Peter A. Buhr
|
|---|
| 10 | // Created On : Thu Aug 18 13:19:26 2016
|
|---|
| 11 | // Last Modified By : Peter A. Buhr
|
|---|
| 12 | // Last Modified On : Thu Aug 18 13:25:55 2016
|
|---|
| 13 | // Update Count : 4
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #pragma once
|
|---|
| 17 |
|
|---|
| 18 | #include_next <assert.h>
|
|---|
| 19 |
|
|---|
| 20 | #define __STRINGIFY__(str) #str
|
|---|
| 21 | #define __VSTRINGIFY__(str) __STRINGIFY__(str)
|
|---|
| 22 | #define assertf(expr, fmt, ...) ((expr) ? static_cast<void>(0) : __assert_fail_f(__VSTRINGIFY__(expr), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ## __VA_ARGS__ ))
|
|---|
| 23 |
|
|---|
| 24 | void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) __attribute__((noreturn));
|
|---|
| 25 |
|
|---|
| 26 | template<typename T, typename U>
|
|---|
| 27 | static inline T safe_dynamic_cast(const U& src) {
|
|---|
| 28 | T ret = dynamic_cast<T>(src);
|
|---|
| 29 | assert(ret);
|
|---|
| 30 | return ret;
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | // Local Variables: //
|
|---|
| 34 | // tab-width: 4 //
|
|---|
| 35 | // mode: c++ //
|
|---|
| 36 | // compile-command: "make install" //
|
|---|
| 37 | // End: //
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.