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 b05a4eb was 91c389a, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago |
change usages of assert to assert.h
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[f773f67] | 1 | //
|
---|
| 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.
|
---|
| 6 | //
|
---|
| 7 | // assert.c --
|
---|
| 8 | //
|
---|
| 9 | // Author : Thierry Delisle
|
---|
| 10 | // Created On : Mon Nov 28 12:27:26 2016
|
---|
[91c389a] | 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Thu Jul 20 15:10:26 2017
|
---|
| 13 | // Update Count : 2
|
---|
[f773f67] | 14 | //
|
---|
| 15 |
|
---|
[91c389a] | 16 | #include <assert.h>
|
---|
| 17 | #include <stdarg.h> // varargs
|
---|
| 18 | #include <stdio.h> // fprintf
|
---|
[9d944b2] | 19 | #include "libhdr/libdebug.h"
|
---|
| 20 |
|
---|
[f773f67] | 21 | extern "C" {
|
---|
| 22 | extern const char * __progname; // global name of running executable (argv[0])
|
---|
| 23 |
|
---|
[9d944b2] | 24 | #define CFA_ASSERT_FMT "Cforall Assertion error from program \"%s\" in \"%s\" at line %d in file \"%s\""
|
---|
[f773f67] | 25 |
|
---|
| 26 | // called by macro assert in assert.h
|
---|
| 27 | void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) {
|
---|
[9d944b2] | 28 | __lib_debug_print_safe( CFA_ASSERT_FMT ".\n", __progname, function, line, file );
|
---|
[f773f67] | 29 | abort();
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | // called by macro assertf
|
---|
| 33 | void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) {
|
---|
[9d944b2] | 34 | __lib_debug_acquire();
|
---|
| 35 | __lib_debug_print_nolock( CFA_ASSERT_FMT ": ", __progname, function, line, file );
|
---|
| 36 |
|
---|
[f773f67] | 37 | va_list args;
|
---|
| 38 | va_start( args, fmt );
|
---|
[9d944b2] | 39 | __lib_debug_print_vararg( fmt, args );
|
---|
[57f408e] | 40 | va_end( args );
|
---|
[9d944b2] | 41 |
|
---|
| 42 | __lib_debug_print_nolock( "\n" );
|
---|
| 43 | __lib_debug_release();
|
---|
[f773f67] | 44 | abort();
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | // Local Variables: //
|
---|
| 49 | // mode: c //
|
---|
| 50 | // tab-width: 4 //
|
---|
| 51 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.