| 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 | // debug.hfa --
|
|---|
| 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 : Tue Feb 4 12:29:21 2020
|
|---|
| 13 | // Update Count : 9
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #pragma once
|
|---|
| 17 |
|
|---|
| 18 | #ifdef __CFA_DEBUG__
|
|---|
| 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[]
|
|---|
| 25 | #define __cfaabi_dbg_ctx_fwd caller
|
|---|
| 26 | #define __cfaabi_dbg_ctx_fwd2 , caller
|
|---|
| 27 | #else
|
|---|
| 28 | #define __cfaabi_dbg_debug_do(...)
|
|---|
| 29 | #define __cfaabi_dbg_no_debug_do(...) __VA_ARGS__
|
|---|
| 30 | #define __cfaabi_dbg_ctx
|
|---|
| 31 | #define __cfaabi_dbg_ctx2
|
|---|
| 32 | #define __cfaabi_dbg_ctx_param
|
|---|
| 33 | #define __cfaabi_dbg_ctx_param2
|
|---|
| 34 | #define __cfaabi_dbg_ctx_fwd
|
|---|
| 35 | #define __cfaabi_dbg_ctx_fwd2
|
|---|
| 36 | #endif
|
|---|
| 37 |
|
|---|
| 38 | #ifdef __cforall
|
|---|
| 39 | extern "C" {
|
|---|
| 40 | #endif
|
|---|
| 41 | #include <stdarg.h>
|
|---|
| 42 | #include <stdio.h>
|
|---|
| 43 |
|
|---|
| 44 | extern void __cfaabi_bits_write( int fd, const char buffer[], int len );
|
|---|
| 45 | extern void __cfaabi_bits_acquire();
|
|---|
| 46 | extern void __cfaabi_bits_release();
|
|---|
| 47 | extern void __cfaabi_bits_print_safe ( int fd, const char fmt[], ... ) __attribute__(( format(printf, 2, 3) ));
|
|---|
| 48 | extern void __cfaabi_bits_print_nolock( int fd, const char fmt[], ... ) __attribute__(( format(printf, 2, 3) ));
|
|---|
| 49 | extern void __cfaabi_bits_print_vararg( int fd, const char fmt[], va_list arg );
|
|---|
| 50 | extern void __cfaabi_bits_print_buffer( int fd, char buffer[], int buffer_size, const char fmt[], ... ) __attribute__(( format(printf, 4, 5) ));
|
|---|
| 51 | #ifdef __cforall
|
|---|
| 52 | }
|
|---|
| 53 | #endif
|
|---|
| 54 |
|
|---|
| 55 | #ifdef __CFA_DEBUG_PRINT__
|
|---|
| 56 | #define __cfaabi_dbg_write( buffer, len ) __cfaabi_bits_write( STDERR_FILENO, buffer, len )
|
|---|
| 57 | #define __cfaabi_dbg_acquire() __cfaabi_bits_acquire()
|
|---|
| 58 | #define __cfaabi_dbg_release() __cfaabi_bits_release()
|
|---|
| 59 | #define __cfaabi_dbg_print_safe(...) __cfaabi_bits_print_safe (__VA_ARGS__)
|
|---|
| 60 | #define __cfaabi_dbg_print_nolock(...) __cfaabi_bits_print_nolock (__VA_ARGS__)
|
|---|
| 61 | #define __cfaabi_dbg_print_buffer(...) __cfaabi_bits_print_buffer (__VA_ARGS__)
|
|---|
| 62 | #define __cfaabi_dbg_print_buffer_decl(...) char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_bits_write( __dbg_text, __dbg_len );
|
|---|
| 63 | #define __cfaabi_dbg_print_buffer_local(...) __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_write( __dbg_text, __dbg_len );
|
|---|
| 64 | #else
|
|---|
| 65 | #define __cfaabi_dbg_write(...) ((void)0)
|
|---|
| 66 | #define __cfaabi_dbg_acquire() ((void)0)
|
|---|
| 67 | #define __cfaabi_dbg_release() ((void)0)
|
|---|
| 68 | #define __cfaabi_dbg_print_safe(...) ((void)0)
|
|---|
| 69 | #define __cfaabi_dbg_print_nolock(...) ((void)0)
|
|---|
| 70 | #define __cfaabi_dbg_print_buffer(...) ((void)0)
|
|---|
| 71 | #define __cfaabi_dbg_print_buffer_decl(...) ((void)0)
|
|---|
| 72 | #define __cfaabi_dbg_print_buffer_local(...) ((void)0)
|
|---|
| 73 | #endif
|
|---|
| 74 |
|
|---|
| 75 | // Local Variables: //
|
|---|
| 76 | // mode: c //
|
|---|
| 77 | // tab-width: 4 //
|
|---|
| 78 | // End: //
|
|---|