Ignore:
Timestamp:
Jun 23, 2017, 9:59:08 AM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
1c273d0
Parents:
7d9c987
Message:

added support for inline decls of buffer for debug prints
added support for multiple statements/declarations inside lib_debug_do

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/libhdr/libdebug.h

    r7d9c987 raa3d77b  
    1818
    1919#ifdef __CFA_DEBUG__
    20         #define LIB_DEBUG_DO(x) x
    21         #define LIB_NO_DEBUG_DO(x)
     20        #define LIB_DEBUG_DO(...) __VA_ARGS__
     21        #define LIB_NO_DEBUG_DO(...)
    2222#else
    23         #define LIB_DEBUG_DO(x)
    24         #define LIB_NO_DEBUG_DO(x) x
     23        #define LIB_DEBUG_DO(...)
     24        #define LIB_NO_DEBUG_DO(...) __VA_ARGS__
    2525#endif
    2626
     
    5151
    5252#ifdef __CFA_DEBUG_PRINT__
    53       #define LIB_DEBUG_WRITE( fd, buffer, len )  __lib_debug_write( fd, buffer, len )
    54       #define LIB_DEBUG_ACQUIRE()                 __lib_debug_acquire()
    55       #define LIB_DEBUG_RELEASE()                 __lib_debug_release()
    56       #define LIB_DEBUG_PRINT_SAFE(...)           __lib_debug_print_safe   (__VA_ARGS__)
    57       #define LIB_DEBUG_PRINT_NOLOCK(...)         __lib_debug_print_nolock (__VA_ARGS__)
    58       #define LIB_DEBUG_PRINT_BUFFER(...)         __lib_debug_print_buffer (__VA_ARGS__)
     53        #define LIB_DEBUG_WRITE( fd, buffer, len )     __lib_debug_write( fd, buffer, len )
     54        #define LIB_DEBUG_ACQUIRE()                    __lib_debug_acquire()
     55        #define LIB_DEBUG_RELEASE()                    __lib_debug_release()
     56        #define LIB_DEBUG_PRINT_SAFE(...)              __lib_debug_print_safe   (__VA_ARGS__)
     57        #define LIB_DEBUG_PRINT_NOLOCK(...)            __lib_debug_print_nolock (__VA_ARGS__)
     58        #define LIB_DEBUG_PRINT_BUFFER(...)            __lib_debug_print_buffer (__VA_ARGS__)
     59        #define LIB_DEBUG_PRINT_BUFFER_DECL(fd, ...)   char text[256]; int len = snprintf( text, 256, __VA_ARGS__ ); __lib_debug_write( fd, text, len );
     60        #define LIB_DEBUG_PRINT_BUFFER_LOCAL(fd, ...)  len = snprintf( text, 256, __VA_ARGS__ ); __lib_debug_write( fd, text, len );
    5961#else
    60       #define LIB_DEBUG_WRITE(...)          ((void)0)
    61       #define LIB_DEBUG_ACQUIRE()           ((void)0)
    62       #define LIB_DEBUG_RELEASE()           ((void)0)
    63       #define LIB_DEBUG_PRINT_SAFE(...)     ((void)0)
    64       #define LIB_DEBUG_PRINT_NOLOCK(...)   ((void)0)
    65       #define LIB_DEBUG_PRINT_BUFFER(...)   ((void)0)
     62        #define LIB_DEBUG_WRITE(...)               ((void)0)
     63        #define LIB_DEBUG_ACQUIRE()                ((void)0)
     64        #define LIB_DEBUG_RELEASE()                ((void)0)
     65        #define LIB_DEBUG_PRINT_SAFE(...)          ((void)0)
     66        #define LIB_DEBUG_PRINT_NOLOCK(...)        ((void)0)
     67        #define LIB_DEBUG_PRINT_BUFFER(...)        ((void)0)
     68        #define LIB_DEBUG_PRINT_BUFFER_DECL(...)   ((void)0)
     69        #define LIB_DEBUG_PRINT_BUFFER_LOCAL(...)  ((void)0)
    6670#endif
    6771
Note: See TracChangeset for help on using the changeset viewer.