aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/logging.h
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-08-20 12:33:22 +0200
committerHarald Welte <laforge@gnumonks.org>2018-08-20 20:23:18 +0000
commit983dcb9af330a1a401e2d9e388183932f29b7bac (patch)
tree2687ce2345085519a28d3fdc15711103f4457bd0 /include/osmocom/core/logging.h
parentb3a9820bfc0723626ba647d096f528aed14d7009 (diff)
use __FILE__, not __BASE_FILE__
The intention was to use the file's basename, but __BASE_FILE__ means "the root file that is being parsed and contains #include statements". If we had a function using __BASE_FILE__ and that was defined in an #included file, __BASE_FILE__ would indicate the first file where the #include is, and not the file where the function is defined. __BASE_FILE__ works for us because we don't ever include function definitions that log something, so __BASE_FILE__ always coincides with __FILE__ for our logging; but still __BASE_FILE__ is semantically the wrong constant. Related: OS#2740 Change-Id: Ibc1d3746f1876ac42d6b1faf0e5f83bd2283cdcc
Diffstat (limited to 'include/osmocom/core/logging.h')
-rw-r--r--include/osmocom/core/logging.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index e68f618..3cae63d 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -55,17 +55,17 @@ void logp(int subsys, const char *file, int line, int cont, const char *format,
#define LOGPC(ss, level, fmt, args...) \
do { \
if (log_check_level(ss, level)) \
- logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \
+ logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args); \
} while(0)
/*! Log through the Osmocom logging framework with explicit source.
- * If caller_file is passed as NULL, __BASE_FILE__ and __LINE__ are used
+ * If caller_file is passed as NULL, __FILE__ and __LINE__ are used
* instead of caller_file and caller_line (so that this macro here defines
* both cases in the same place, and to catch cases where callers fail to pass
* a non-null filename string).
* \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
* \param[in] level logging level (e.g. \ref LOGL_NOTICE)
- * \param[in] caller_file caller's source file string (e.g. __BASE_FILE__)
+ * \param[in] caller_file caller's source file string (e.g. __FILE__)
* \param[in] caller_line caller's source line nr (e.g. __LINE__)
* \param[in] fmt format string
* \param[in] args variable argument list
@@ -74,13 +74,13 @@ void logp(int subsys, const char *file, int line, int cont, const char *format,
LOGPSRCC(ss, level, caller_file, caller_line, 0, fmt, ##args)
/*! Log through the Osmocom logging framework with explicit source.
- * If caller_file is passed as NULL, __BASE_FILE__ and __LINE__ are used
+ * If caller_file is passed as NULL, __FILE__ and __LINE__ are used
* instead of caller_file and caller_line (so that this macro here defines
* both cases in the same place, and to catch cases where callers fail to pass
* a non-null filename string).
* \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
* \param[in] level logging level (e.g. \ref LOGL_NOTICE)
- * \param[in] caller_file caller's source file string (e.g. __BASE_FILE__)
+ * \param[in] caller_file caller's source file string (e.g. __FILE__)
* \param[in] caller_line caller's source line nr (e.g. __LINE__)
* \param[in] cont continuation (1) or new line (0)
* \param[in] fmt format string
@@ -92,7 +92,7 @@ void logp(int subsys, const char *file, int line, int cont, const char *format,
if (caller_file) \
logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \
else \
- logp2(ss, level, __BASE_FILE__, __LINE__, cont, fmt, ##args); \
+ logp2(ss, level, __FILE__, __LINE__, cont, fmt, ##args); \
}\
} while(0)