source: trunk/util/xc_trace.h @ 1044

Last change on this file since 1044 was 1044, checked in by moo, 2 years ago

refactor: fix c89 compatibility

  • 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
35#       define TRACE(fmt, ...) \
36        xc_trace("%s:%d: " fmt "\r\n", __FILE__, __LINE__, __VA_ARGS__)
37#   endif /* ZEND_WIN32 */
38#   undef NDEBUG
39#   undef inline
40#   define inline
41#else /* XCACHE_DEBUG */
42
43#   ifdef ZEND_WIN32
44static inline int TRACE_DUMMY(const char *fmt, ...)
45{
46    return 0;
47}
48#       define TRACE 1 ? 0 : TRACE_DUMMY
49#   else
50#       define TRACE(fmt, ...) do { } while (0)
51#   endif /* ZEND_WIN32 */
52
53#   define IFDEBUG(x) do { } while (0)
54#endif /* XCACHE_DEBUG */
55#include <assert.h>
56
57#endif /* XC_TRACE_H_709AE2523EDACB72B54D9CB42DDB0FEE */
Note: See TracBrowser for help on using the repository browser.