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 f7cb0bc was b3c36f4, checked in by Thierry Delisle <tdelisle@…>, 8 years ago |
Added some attribute((unused)) where appropriate
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[57f408e] | 1 | //
|
---|
[1cb2282] | 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
[57f408e] | 6 | //
|
---|
| 7 | // Assert.cc --
|
---|
| 8 | //
|
---|
[1cb2282] | 9 | // Author : Peter A. Buhr
|
---|
| 10 | // Created On : Thu Aug 18 13:26:59 2016
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
[e6955b1] | 12 | // Last Modified On : Fri Aug 19 17:07:08 2016
|
---|
| 13 | // Update Count : 10
|
---|
[57f408e] | 14 | //
|
---|
[1cb2282] | 15 |
|
---|
| 16 | #include <assert.h>
|
---|
[e6955b1] | 17 | #include <cstdarg> // varargs
|
---|
| 18 | #include <cstdio> // fprintf
|
---|
| 19 | #include <cstdlib> // abort
|
---|
[1cb2282] | 20 |
|
---|
| 21 | extern const char * __progname; // global name of running executable (argv[0])
|
---|
| 22 |
|
---|
[b3c36f4] | 23 | #define CFA_ASSERT_FMT "*CFA assertion error* \"%s\" from program \"%s\" in \"%s\" at line %d in file \"%s\""
|
---|
[1cb2282] | 24 |
|
---|
| 25 | // called by macro assert in assert.h
|
---|
| 26 | void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) {
|
---|
[b3c36f4] | 27 | fprintf( stderr, CFA_ASSERT_FMT ".\n", assertion, __progname, function, line, file );
|
---|
[e6955b1] | 28 | abort();
|
---|
[1cb2282] | 29 | }
|
---|
| 30 |
|
---|
| 31 | // called by macro assertf
|
---|
| 32 | void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) {
|
---|
[b3c36f4] | 33 | fprintf( stderr, CFA_ASSERT_FMT ": ", assertion, __progname, function, line, file );
|
---|
[1cb2282] | 34 | va_list args;
|
---|
| 35 | va_start( args, fmt );
|
---|
| 36 | vfprintf( stderr, fmt, args );
|
---|
[57f408e] | 37 | va_end( args );
|
---|
| 38 | fprintf( stderr, "\n" );
|
---|
[e6955b1] | 39 | abort();
|
---|
[1cb2282] | 40 | }
|
---|
| 41 |
|
---|
| 42 | // Local Variables: //
|
---|
| 43 | // tab-width: 4 //
|
---|
| 44 | // mode: c++ //
|
---|
| 45 | // compile-command: "make install" //
|
---|
| 46 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.