diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-11-15 21:18:07 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-11-15 21:18:07 +0000 |
commit | 5b668d855767a9331fb60c06708d58ed3ef5ffb1 (patch) | |
tree | e245222f3e894cfb0fbad2eddc9c75f8a2d12959 /src/common/log.h | |
parent | 7a8ac5dfef401fa26e37dcfd2b2a8ccb4285613b (diff) | |
download | tor-5b668d855767a9331fb60c06708d58ed3ef5ffb1.tar.gz tor-5b668d855767a9331fb60c06708d58ed3ef5ffb1.zip |
ugly macros to make log_fn play nice on non-GCC compilers.
svn:r2894
Diffstat (limited to 'src/common/log.h')
-rw-r--r-- | src/common/log.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/common/log.h b/src/common/log.h index 2f90ce8c48..00eebd05c5 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -81,7 +81,14 @@ void _log_fn(int severity, const char *funcname, const char *format, ...) #define log_fn(severity, args...) \ _log_fn(severity, __PRETTY_FUNCTION__, args) #else -#define log_fn _log +/* We don't have GCC's varargs macros, so use a global variable to pass the + * function name to log_fn */ +extern const char *_log_fn_function_name; +void _log_fn(int severity, const char *format, ...); +/* We abuse the comma operator here, since we can't use the standard + * do {...} while(0) trick to wrap this macro, since the macro can't take + * arguments. */ +#define log_fn (_log_fn_function_name=__FUNCTION__),_log_fn #endif #define log _log /* hack it so we don't conflict with log() as much */ |