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 034165a 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
           | 
        
      
      
| Line |   | 
|---|
| 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
 | 
|---|
| 11 | // Last Modified By : Peter A. Buhr
 | 
|---|
| 12 | // Last Modified On : Thu Jul 20 15:10:26 2017
 | 
|---|
| 13 | // Update Count     : 2
 | 
|---|
| 14 | //
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <assert.h>
 | 
|---|
| 17 | #include <stdarg.h>                                                             // varargs
 | 
|---|
| 18 | #include <stdio.h>                                                              // fprintf
 | 
|---|
| 19 | #include "libhdr/libdebug.h"
 | 
|---|
| 20 | 
 | 
|---|
| 21 | extern "C" {
 | 
|---|
| 22 |         extern const char * __progname;                                         // global name of running executable (argv[0])
 | 
|---|
| 23 | 
 | 
|---|
| 24 |         #define CFA_ASSERT_FMT "Cforall Assertion error from program \"%s\" in \"%s\" at line %d in file \"%s\""
 | 
|---|
| 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 ) {
 | 
|---|
| 28 |                 __lib_debug_print_safe( CFA_ASSERT_FMT ".\n", __progname, function, line, file );
 | 
|---|
| 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, ... ) {
 | 
|---|
| 34 |                 __lib_debug_acquire();
 | 
|---|
| 35 |                 __lib_debug_print_nolock( CFA_ASSERT_FMT ": ", __progname, function, line, file );
 | 
|---|
| 36 | 
 | 
|---|
| 37 |                 va_list args;
 | 
|---|
| 38 |                 va_start( args, fmt );
 | 
|---|
| 39 |                 __lib_debug_print_vararg( fmt, args );
 | 
|---|
| 40 |                 va_end( args );
 | 
|---|
| 41 | 
 | 
|---|
| 42 |                 __lib_debug_print_nolock( "\n" );
 | 
|---|
| 43 |                 __lib_debug_release();
 | 
|---|
| 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.