logging: define _LOGT() macro to check valid arguments

With NM_MORE_LOGGING disabled, we still want the compiler to evaluate
the argument list. By wrapping it in "if(FALSE)", we get compile time
checks, but the logging statement will be optimized out.

(cherry picked from commit cb6bafb9af)
This commit is contained in:
Thomas Haller 2015-04-24 13:51:28 +02:00
parent 72c0379708
commit 093b29a618

View file

@ -99,7 +99,7 @@
#define _LOGT(...) _LOG (LOGL_TRACE, _LOG_DOMAIN, platform, __VA_ARGS__)
#else
#define _LOGT_ENABLED() FALSE
#define _LOGT(...) G_STMT_START { (void) 0; } G_STMT_END
#define _LOGT(...) G_STMT_START { if (FALSE) { _LOG (LOGL_TRACE, _LOG_DOMAIN, platform, __VA_ARGS__); } } G_STMT_END
#endif
#define _LOGD(...) _LOG (LOGL_DEBUG, _LOG_DOMAIN, platform, __VA_ARGS__)