source: trunk/util/xc_trace.h @ 1174

Last change on this file since 1174 was 1174, checked in by moo, 17 months ago

show basename for easier trace log reader

  • Property svn:eol-style set to native
File size: 1.2 KB
RevLine 
[984]1#ifndef XC_TRACE_H_709AE2523EDACB72B54D9CB42DDB0FEE
2#define XC_TRACE_H_709AE2523EDACB72B54D9CB42DDB0FEE
3
4#if _MSC_VER > 1000
5#pragma once
[1044]6#endif /* _MSC_VER > 1000 */
[984]7
[1006]8#ifdef ZEND_WIN32
9#   ifndef inline
10#       ifdef ZEND_WIN32_FORCE_INLINE
11#           define inline __forceinline
12#       else
13#           define inline
14#       endif
15#   endif
16#endif
17
[984]18#ifdef XCACHE_DEBUG
19#   define IFDEBUG(x) (x)
20int xc_vtrace(const char *fmt, va_list args);
21int xc_trace(const char *fmt, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
22
23#   ifdef ZEND_WIN32
24static inline int TRACE(const char *fmt, ...) 
25{
26    va_list args;
27    int ret;
28
29    va_start(args, fmt);
30    ret = xc_vtrace(fmt, args);
31    va_end(args);
32    return ret;
33}
34#   else
[1174]35const char *xc_trace_get_basename(const char *path);
[984]36#       define TRACE(fmt, ...) \
[1174]37        xc_trace("%s:%d: " fmt "\r\n", xc_trace_get_basename(__FILE__), __LINE__, __VA_ARGS__)
[984]38#   endif /* ZEND_WIN32 */
39#   undef NDEBUG
40#   undef inline
41#   define inline
42#else /* XCACHE_DEBUG */
43
44#   ifdef ZEND_WIN32
45static inline int TRACE_DUMMY(const char *fmt, ...)
46{
47    return 0;
48}
49#       define TRACE 1 ? 0 : TRACE_DUMMY
50#   else
51#       define TRACE(fmt, ...) do { } while (0)
52#   endif /* ZEND_WIN32 */
53
54#   define IFDEBUG(x) do { } while (0)
55#endif /* XCACHE_DEBUG */
56#include <assert.h>
57
58#endif /* XC_TRACE_H_709AE2523EDACB72B54D9CB42DDB0FEE */
Note: See TracBrowser for help on using the repository browser.