-rw-r--r-- | rsync/trace.h | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/rsync/trace.h b/rsync/trace.h index 60a6477..2bb8552 100644 --- a/rsync/trace.h +++ b/rsync/trace.h | |||
@@ -36,13 +36,15 @@ | |||
36 | * fatal terminates the whole process | 36 | * fatal terminates the whole process |
37 | */ | 37 | */ |
38 | 38 | ||
39 | void rs_fatal0(char const *s, ...); | 39 | #if defined(HAVE_VARARG_MACROS) && defined(__GNUC__) |
40 | void rs_error0(char const *s, ...); | 40 | /* |
41 | void rs_trace0(char const *s, ...); | 41 | * TODO: Don't assume this is a gcc thing; rather test in autoconf for |
42 | 42 | * support for __FUNCTION__. One simple way might just be to try compiling | |
43 | void rs_log0_nofn(int level, char const *fmt, ...); | 43 | * the definition of one of these functions! |
44 | 44 | * | |
45 | #ifdef __GNUC__ | 45 | * TODO: Also look for the C9X predefined identifier `_function', or |
46 | * whatever it's called. | ||
47 | */ | ||
46 | 48 | ||
47 | void rs_log0(int level, char const *fn, char const *fmt, ...) | 49 | void rs_log0(int level, char const *fn, char const *fmt, ...) |
48 | __attribute__ ((format(printf, 3, 4))); | 50 | __attribute__ ((format(printf, 3, 4))); |
@@ -52,18 +54,9 @@ void rs_log0(int level, char const *fn, char const *fmt, ...) | |||
52 | do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \ | 54 | do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \ |
53 | } while (0) | 55 | } while (0) |
54 | #else | 56 | #else |
55 | # define rs_trace(s, str...) | 57 | # define rs_trace(fmt, arg...) |
56 | #endif/* !DO_RS_TRACE */ | 58 | #endif/* !DO_RS_TRACE */ |
57 | 59 | ||
58 | /* | ||
59 | * TODO: Don't assume this is a gcc thing; rather test in autoconf for | ||
60 | * support for __FUNCTION__ and varargs macros. One simple way might | ||
61 | * just be to try compiling the definition of one of these functions! | ||
62 | * | ||
63 | * TODO: Also look for the C9X predefined identifier `_function', or | ||
64 | * whatever it's called. | ||
65 | */ | ||
66 | |||
67 | #define rs_log(l, s, str...) do { \ | 60 | #define rs_log(l, s, str...) do { \ |
68 | rs_log0((l), __FUNCTION__, (s) , ##str); \ | 61 | rs_log0((l), __FUNCTION__, (s) , ##str); \ |
69 | } while (0) | 62 | } while (0) |
@@ -82,19 +75,17 @@ void rs_log0(int level, char const *fn, char const *fmt, ...) | |||
82 | 75 | ||
83 | 76 | ||
84 | #else /************************* ! __GNUC__ */ | 77 | #else /************************* ! __GNUC__ */ |
85 | 78 | # define rs_trace rs_trace0 | |
86 | # define rs_fatal rs_fatal0 | 79 | # define rs_fatal rs_fatal0 |
87 | # define rs_error rs_error0 | 80 | # define rs_error rs_error0 |
88 | # define rs_log rs_log0_nofn | 81 | # define rs_log rs_log0_nofn |
89 | |||
90 | # ifdef DO_RS_TRACE | ||
91 | # define rs_trace rs_trace0 | ||
92 | # endif /* DO_RS_TRACE */ | ||
93 | #endif /* ! __GNUC__ */ | 82 | #endif /* ! __GNUC__ */ |
94 | 83 | ||
95 | 84 | void rs_trace0(char const *s, ...); | |
85 | void rs_fatal0(char const *s, ...); | ||
86 | void rs_error0(char const *s, ...); | ||
96 | void rs_log0(int level, char const *fn, char const *fmt, ...); | 87 | void rs_log0(int level, char const *fn, char const *fmt, ...); |
97 | 88 | void rs_log0_nofn(int level, char const *fmt, ...); | |
98 | 89 | ||
99 | enum { | 90 | enum { |
100 | RS_LOG_PRIMASK = 7, /**< Mask to extract priority | 91 | RS_LOG_PRIMASK = 7, /**< Mask to extract priority |
@@ -105,7 +96,6 @@ enum { | |||
105 | }; | 96 | }; |
106 | 97 | ||
107 | 98 | ||
108 | |||
109 | /** | 99 | /** |
110 | * \macro rs_trace_enabled() | 100 | * \macro rs_trace_enabled() |
111 | * | 101 | * |