source: src/libcfa/bits/debug.h @ 06b176d

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 06b176d was 169d944, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

update abort, remove abortf, add printing exit

  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[78b3f52]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//
[c2b9f21]7// debug.h --
[78b3f52]8//
9// Author           : Thierry Delisle
10// Created On       : Mon Nov 28 12:27:26 2016
[6b0b624]11// Last Modified By : Peter A. Buhr
[169d944]12// Last Modified On : Thu Feb  8 12:35:19 2018
13// Update Count     : 2
[78b3f52]14//
15
[6b0b624]16#pragma once
[78b3f52]17
18#ifdef __CFA_DEBUG__
[36982fc]19        #define __cfaabi_dbg_debug_do(...) __VA_ARGS__
20        #define __cfaabi_dbg_no_debug_do(...)
21        #define __cfaabi_dbg_ctx __PRETTY_FUNCTION__
22        #define __cfaabi_dbg_ctx2 , __PRETTY_FUNCTION__
23        #define __cfaabi_dbg_ctx_param const char * caller
24        #define __cfaabi_dbg_ctx_param2 , const char * caller
[78b3f52]25#else
[36982fc]26        #define __cfaabi_dbg_debug_do(...)
27        #define __cfaabi_dbg_no_debug_do(...) __VA_ARGS__
28        #define __cfaabi_dbg_ctx
29        #define __cfaabi_dbg_ctx2
30        #define __cfaabi_dbg_ctx_param
31        #define __cfaabi_dbg_ctx_param2
[4aa2fb2]32#endif
33
[9d944b2]34#ifdef __cforall
35extern "C" {
36#endif
[6a5be52]37        #include <stdarg.h>
38        #include <stdio.h>
[9d944b2]39
[36982fc]40      extern void __cfaabi_dbg_bits_write( const char *buffer, int len );
41      extern void __cfaabi_dbg_bits_acquire();
42      extern void __cfaabi_dbg_bits_release();
[169d944]43      extern void __cfaabi_dbg_bits_print_safe  ( const char fmt[], ... ) __attribute__(( format(printf, 1, 2) ));
44      extern void __cfaabi_dbg_bits_print_nolock( const char fmt[], ... ) __attribute__(( format(printf, 1, 2) ));
[36982fc]45      extern void __cfaabi_dbg_bits_print_vararg( const char fmt[], va_list arg );
[169d944]46      extern void __cfaabi_dbg_bits_print_buffer( char buffer[], int buffer_size, const char fmt[], ... ) __attribute__(( format(printf, 3, 4) ));
[9d944b2]47#ifdef __cforall
48}
49#endif
50
[d9c44c3]51#ifdef __CFA_DEBUG_PRINT__
[36982fc]52        #define __cfaabi_dbg_write( buffer, len )         __cfaabi_dbg_bits_write( buffer, len )
53        #define __cfaabi_dbg_acquire()                    __cfaabi_dbg_bits_acquire()
54        #define __cfaabi_dbg_release()                    __cfaabi_dbg_bits_release()
55        #define __cfaabi_dbg_print_safe(...)              __cfaabi_dbg_bits_print_safe   (__VA_ARGS__)
56        #define __cfaabi_dbg_print_nolock(...)            __cfaabi_dbg_bits_print_nolock (__VA_ARGS__)
57        #define __cfaabi_dbg_print_buffer(...)            __cfaabi_dbg_bits_print_buffer (__VA_ARGS__)
58        #define __cfaabi_dbg_print_buffer_decl(...)       char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_bits_write( __dbg_text, __dbg_len );
59        #define __cfaabi_dbg_print_buffer_local(...)      __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_bits_write( __dbg_text, __dbg_len );
[d9c44c3]60#else
[36982fc]61        #define __cfaabi_dbg_write(...)               ((void)0)
62        #define __cfaabi_dbg_acquire()                ((void)0)
63        #define __cfaabi_dbg_release()                ((void)0)
64        #define __cfaabi_dbg_print_safe(...)          ((void)0)
65        #define __cfaabi_dbg_print_nolock(...)        ((void)0)
66        #define __cfaabi_dbg_print_buffer(...)        ((void)0)
67        #define __cfaabi_dbg_print_buffer_decl(...)   ((void)0)
68        #define __cfaabi_dbg_print_buffer_local(...)  ((void)0)
[d9c44c3]69#endif
70
[78b3f52]71// Local Variables: //
72// mode: c //
73// tab-width: 4 //
74// End: //
Note: See TracBrowser for help on using the repository browser.