mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
ugly macros to make log_fn play nice on non-GCC compilers.
svn:r2894
This commit is contained in:
+8
-1
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user