mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-13 03:09:51 +03:00
78 lines
3.9 KiB
Diff
78 lines
3.9 KiB
Diff
From b92bb60a032689af9fcc61f015113d873f21dabf Mon Sep 17 00:00:00 2001
|
|
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
|
|
Date: Wed, 20 Nov 2024 13:04:49 +0100
|
|
Subject: [PATCH 3/4] config: special case for default logger
|
|
|
|
The current version taking an unlimited number of args, and with
|
|
multiple levels of helpers doesn't seem to be supported on some embedded
|
|
environments, e.g. Alpine Linux:
|
|
|
|
configuration.c: In function 'mptcpd_config_create':
|
|
configuration.c:54:47: error: pasting "l_log_set_" and "(" does not give a valid preprocessing token
|
|
54 | #define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
|
| ^~~~~~~~~~
|
|
configuration.c:42:36: note: in definition of macro 'MPTCPD_CONCAT_IMPL'
|
|
42 | #define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__
|
|
| ^
|
|
configuration.c:54:33: note: in expansion of macro 'MPTCPD_CONCAT'
|
|
54 | #define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
|
| ^~~~~~~~~~~~~
|
|
configuration.c:802:9: note: in expansion of macro 'MPTCPD_SET_LOG_FUNCTION'
|
|
802 | MPTCPD_SET_LOG_FUNCTION(); // For early logging.
|
|
| ^~~~~~~~~~~~~~~~~~~~~~~
|
|
configuration.c:54:47: error: implicit declaration of function 'l_log_set_'; did you mean 'l_log_set_null'? [-Werror=implicit-function-declaration]
|
|
54 | #define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
|
| ^~~~~~~~~~
|
|
configuration.c:42:36: note: in definition of macro 'MPTCPD_CONCAT_IMPL'
|
|
42 | #define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__
|
|
| ^
|
|
configuration.c:54:33: note: in expansion of macro 'MPTCPD_CONCAT'
|
|
54 | #define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
|
| ^~~~~~~~~~~~~
|
|
configuration.c:802:9: note: in expansion of macro 'MPTCPD_SET_LOG_FUNCTION'
|
|
802 | MPTCPD_SET_LOG_FUNCTION(); // For early logging.
|
|
| ^~~~~~~~~~~~~~~~~~~~~~~
|
|
configuration.c:54:47: error: called object is not a function or function pointer
|
|
54 | #define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
|
| ^~~~~~~~~~
|
|
configuration.c:42:36: note: in definition of macro 'MPTCPD_CONCAT_IMPL'
|
|
42 | #define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__
|
|
| ^
|
|
configuration.c:54:33: note: in expansion of macro 'MPTCPD_CONCAT'
|
|
54 | #define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
|
| ^~~~~~~~~~~~~
|
|
configuration.c:802:9: note: in expansion of macro 'MPTCPD_SET_LOG_FUNCTION'
|
|
802 | MPTCPD_SET_LOG_FUNCTION(); // For early logging.
|
|
| ^~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
It is not clear to me why it is failing, and simplifying the
|
|
concatenation to two items, plus modifying the main helper to take the
|
|
prefix in argument don't seem to help . A simple workaround is to have a
|
|
special case for the default value, and do the concatenation only with
|
|
the other cases.
|
|
|
|
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
|
|
---
|
|
src/configuration.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/src/configuration.c b/src/configuration.c
|
|
index e78c8b5..8dcd3dd 100644
|
|
--- a/src/configuration.c
|
|
+++ b/src/configuration.c
|
|
@@ -50,8 +50,12 @@
|
|
// This should never occur!
|
|
# error Problem configuring default log message destination.
|
|
#endif
|
|
+#if MPTCPD_LOGGER == stderr
|
|
+#define MPTCPD_SET_LOG_FUNCTION l_log_set_stderr
|
|
+#else
|
|
/// Name of the default logging function determined at compile-time.
|
|
#define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
|
|
+#endif
|
|
|
|
/**
|
|
* @brief Get the function that sets the log message destination.
|
|
--
|
|
2.45.2
|
|
|