Logging: define `BT_LOG*_SUPPORTED` when logging is supported
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 15 Jun 2019 16:58:38 +0000 (12:58 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 20 Jun 2019 18:01:16 +0000 (14:01 -0400)
Rely on those new `BT_LOG_SUPPORTED`, `BT_LIB_LOG_SUPPORTED`,
`BT_COMP_LOG_SUPPORTED`, definitions instead of the header include
guards to know whether or not logging is supported at a given point.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I4d076e30b528882d036f7cfc367b5dbb39401dda
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1472
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/ctf-writer/assert-pre.h
src/lib/assert-pre.h
src/lib/lib-logging.h
src/lib/plugin/plugin.h
src/lib/trace-ir/event.h
src/logging/log.h
src/plugins/comp-logging.h

index 0291190d93059c57e12e0cbeb012baf499ac126a..5444760d77d7bf994c09e0d2c1b234368a126977 100644 (file)
@@ -35,7 +35,7 @@
  * you also need to use logging explicitly.
  */
 
-#ifndef BABELTRACE_LOGGING_INTERNAL_H
+#ifndef BT_LOG_SUPPORTED
 # error Include "logging/log.h" before this header.
 #endif
 
index 7636b56a8dce4b739de9601f4ab7fa5ea16373df..9eeff141489006eedb44075f9d2944d01ba9f3d7 100644 (file)
@@ -35,7 +35,7 @@
  * need to use logging explicitly.
  */
 
-#ifndef BABELTRACE_LIB_LOGGING_INTERNAL_H
+#ifndef BT_LIB_LOG_SUPPORTED
 # error Include "lib/lib-logging.h" before this header.
 #endif
 
index 9ec1fd9bcc907d56d3ae3df8276ecb045043dd48..7bb36c99e2b94edf6288d23759171fd0732849e3 100644 (file)
@@ -190,4 +190,6 @@ int bt_lib_log_level;
 void bt_lib_log(const char *func, const char *file, unsigned line,
                int lvl, const char *tag, const char *fmt, ...);
 
+#define BT_LIB_LOG_SUPPORTED
+
 #endif /* BABELTRACE_LIB_LOGGING_INTERNAL_H */
index 6d9b288d8f5c997221bec3baab853b7c441d76c7..edaad960f0a4738e746e07ac4ee604570268980b 100644 (file)
@@ -36,7 +36,7 @@
 #include "plugin-so.h"
 
 /* Protection: this file uses BT_LIB_LOG*() macros directly */
-#ifndef BABELTRACE_LIB_LOGGING_INTERNAL_H
+#ifndef BT_LIB_LOG_SUPPORTED
 # error Please include "lib/lib-logging.h" before including this file.
 #endif
 
index e1d3e441b639964bb44f7eb1ddd9dc452671573f..9cfbb56ab87227293ce8f9404a29f2efdab48d28 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 /* Protection: this file uses BT_LIB_LOG*() macros directly */
-#ifndef BABELTRACE_LIB_LOGGING_INTERNAL_H
+#ifndef BT_LIB_LOG_SUPPORTED
 # error Please include "lib/lib-logging.h" before including this file.
 #endif
 
index c9aa4bad3242c783987c295426bdaa99a5f84813..cafde89158612a2a03033d5b3717ff8ed168b0d5 100644 (file)
@@ -1143,6 +1143,8 @@ end:
                _level_sym = bt_log_get_level_from_env(_env_var);       \
        }
 
+#define BT_LOG_SUPPORTED
+
 #ifdef __cplusplus
 }
 #endif
index d1399f722d2b09dac560affd1de48878563851a3..612f58636bb3b2663d60bee64cf7268ee2b30c8c 100644 (file)
 #define BT_COMP_LOGV_MEM(_data_ptr, _data_sz, _fmt, ...) \
        BT_COMP_LOG_MEM(BT_LOG_VERBOSE, (BT_COMP_LOG_SELF_COMP), (_data_ptr), (_data_sz), _fmt, ##__VA_ARGS__)
 
+#define BT_COMP_LOG_SUPPORTED
+
 #endif /* BABELTRACE_PLUGINS_COMP_LOGGING_H */
This page took 0.027571 seconds and 4 git commands to generate.