From bb61c0c96becce30ea114f9e1aa6808949d89e9e Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 2 Jun 2025 22:48:41 +0200 Subject: [PATCH] Prefer __func__ to __FUNCTION__. The former is part of the C99 standard, while the latter is only provided for backward compatibility. This change also silences many gcc warnings when compiling with -Wpendantic (disabled in the default build). --- para.h | 14 +++++++------- play.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/para.h b/para.h index d97ffd2b..973cc5a5 100644 --- a/para.h +++ b/para.h @@ -217,13 +217,13 @@ enum sample_format {SAMPLE_FORMATS}; /** Debug, Info, etc. */ enum loglevels {LOGLEVELS, NUM_LOGLEVELS}; -#define PARA_DEBUG_LOG(f,...) para_log(LL_DEBUG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#define PARA_INFO_LOG(f,...) para_log(LL_INFO, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#define PARA_NOTICE_LOG(f,...) para_log(LL_NOTICE, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#define PARA_WARNING_LOG(f,...) para_log(LL_WARNING, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#define PARA_ERROR_LOG(f,...) para_log(LL_ERROR, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#define PARA_CRIT_LOG(f,...) para_log(LL_CRIT, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#define PARA_EMERG_LOG(f,...) para_log(LL_EMERG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#define PARA_DEBUG_LOG(f,...) para_log(LL_DEBUG, "%s: " f, __func__, ## __VA_ARGS__) +#define PARA_INFO_LOG(f,...) para_log(LL_INFO, "%s: " f, __func__, ## __VA_ARGS__) +#define PARA_NOTICE_LOG(f,...) para_log(LL_NOTICE, "%s: " f, __func__, ## __VA_ARGS__) +#define PARA_WARNING_LOG(f,...) para_log(LL_WARNING, "%s: " f, __func__, ## __VA_ARGS__) +#define PARA_ERROR_LOG(f,...) para_log(LL_ERROR, "%s: " f, __func__, ## __VA_ARGS__) +#define PARA_CRIT_LOG(f,...) para_log(LL_CRIT, "%s: " f, __func__, ## __VA_ARGS__) +#define PARA_EMERG_LOG(f,...) para_log(LL_EMERG, "%s: " f, __func__, ## __VA_ARGS__) /** \cond status_items */ #define STATUS_ITEMS \ diff --git a/play.c b/play.c index df06b1cc..815dc609 100644 --- a/play.c +++ b/play.c @@ -962,7 +962,7 @@ static int run_command(char *line) struct lls_parse_result *lpr; const struct lls_command *cmd; - attach_stdout(__FUNCTION__); + attach_stdout(__func__); ret = create_argv(line, " ", &argv); if (ret < 0) goto out; @@ -1065,7 +1065,7 @@ static void session_open(void) ici.bound_keyseqs = get_mapped_keyseqs(); pt->btrn = ici.producer = btr_new_node(&(struct btr_node_description) - EMBRACE(.name = __FUNCTION__)); + EMBRACE(.name = __func__)); ret = i9e_open(&ici, &sched); if (ret < 0) goto out; @@ -1137,7 +1137,7 @@ static int play_post_monitor(__a_unused struct sched *s, __a_unused void *contex if (pt->background) detach_stdout(); else - attach_stdout(__FUNCTION__); + attach_stdout(__func__); i9e_error = i9e_get_error(); ret = eof_cleanup(); if (pt->rq == CRT_TERM_RQ || i9e_error < 0) /* com_quit() or CTRL+D */ -- 2.39.5