osmith submitted this change.
firmware(libosmocore): add missing 'if !EMBEDDED'
Fix compilation with GCC 14.2, which otherwise fails with errors like:
../../src/utils.c:49:22: error: implicit declaration of function 'strcasecmp' [-Wimplicit-function-declaration]
Change-Id: Ia7fdd5edd5edd1ee126dfbcaa75b3d988143f2e1
---
M src/shared/libosmocore/src/logging.c
M src/shared/libosmocore/src/utils.c
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/shared/libosmocore/src/logging.c b/src/shared/libosmocore/src/logging.c
index e187df2..4738f99 100644
--- a/src/shared/libosmocore/src/logging.c
+++ b/src/shared/libosmocore/src/logging.c
@@ -151,6 +151,7 @@
return -EINVAL;
}
+#if (!EMBEDDED)
/*! \brief parse the log category mask
* \param[in] target log target to be configured
* \param[in] _mask log category mask string
@@ -202,6 +203,7 @@
free(mask);
}
+#endif /* !EMBEDDED */
static const char* color(int subsys)
{
@@ -436,12 +438,14 @@
target->categories[category].loglevel = level;
}
+#if (!EMBEDDED)
static void _file_output(struct log_target *target, unsigned int level,
const char *log)
{
fprintf(target->tgt_file.out, "%s", log);
fflush(target->tgt_file.out);
}
+#endif /* !EMBEDDED */
/*! \brief Create a new log target skeleton */
struct log_target *log_target_create(void)
@@ -500,6 +504,7 @@
#endif /* stderr */
}
+#if (!EMBEDDED)
/*! \brief Create a new file-based log target
* \param[in] fname File name of the new log file
* \returns Log target in case of success, NULL otherwise
@@ -523,6 +528,7 @@
return target;
}
+#endif /* !EMBEDDED */
/*! \brief Find a registered log target
* \param[in] type Log target type
@@ -552,6 +558,7 @@
/* just in case, to make sure we don't have any references */
log_del_target(target);
+#if (!EMBEDDED)
if (target->output == &_file_output) {
/* since C89/C99 says stderr is a macro, we can safely do this! */
#ifdef stderr
@@ -563,10 +570,12 @@
target->tgt_file.out = NULL;
}
}
+#endif /* !EMBEDDED */
talloc_free(target);
}
+#if (!EMBEDDED)
/*! \brief close and re-open a log file (for log file rotation) */
int log_target_file_reopen(struct log_target *target)
{
@@ -580,6 +589,7 @@
return 0;
}
+#endif /* !EMBEDDED */
/*! \brief Generates the logging command string for VTY
* \param[in] unused_info Deprecated parameter, no longer used!
diff --git a/src/shared/libosmocore/src/utils.c b/src/shared/libosmocore/src/utils.c
index cf0c934..79c42cb 100644
--- a/src/shared/libosmocore/src/utils.c
+++ b/src/shared/libosmocore/src/utils.c
@@ -1,4 +1,5 @@
+#include "config.h"
#include <string.h>
#include <stdint.h>
#include <errno.h>
@@ -34,6 +35,7 @@
return namebuf;
}
+#if (!EMBEDDED)
/*! \brief get numeric value for given human-readable string
* \param[in] vs Array of value_string tuples
* \param[in] str human-readable string
@@ -51,6 +53,7 @@
}
return -EINVAL;
}
+#endif /* !EMBEDDED */
/*! \brief Convert BCD-encoded digit into printable character
* \param[in] bcd A single BCD-encoded digit
To view, visit change 41190. To unsubscribe, or for help writing mail filters, visit settings.