From 96bc699d269ff79bf31dad182f1a2b96226e8ce5 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 12 May 2026 12:37:27 -0400 Subject: Replace __FUNCTION__ with __func__ (portable) --- src/lib/core/include/log.h | 2 +- tests/include/testing.h | 6 +++--- tests/test_conda.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/core/include/log.h b/src/lib/core/include/log.h index 18617c4..cad954f 100644 --- a/src/lib/core/include/log.h +++ b/src/lib/core/include/log.h @@ -16,7 +16,7 @@ struct ExecPoint { const char *function; // function of origin }; -#define EXECPOINT (struct ExecPoint) {.line = __LINE__, .file = __FILE__, .function = __FUNCTION__} +#define EXECPOINT (struct ExecPoint) {.line = __LINE__, .file = __FILE__, .function = __func__} void log_print_error(struct ExecPoint ep, const char *fmt, ...); void log_print_warning(struct ExecPoint ep, const char *fmt, ...); diff --git a/tests/include/testing.h b/tests/include/testing.h index 728b6a6..d11398c 100644 --- a/tests/include/testing.h +++ b/tests/include/testing.h @@ -224,7 +224,7 @@ inline void stasis_testing_teardown_workspace() { #define STASIS_ASSERT(COND, REASON) do { \ stasis_testing_record_result((struct stasis_test_result_t) { \ .filename = __FILE_NAME__, \ - .funcname = __FUNCTION__, \ + .funcname = __func__, \ .lineno = __LINE__, \ .status = (COND), \ .msg_assertion = "ASSERT(" #COND ")", \ @@ -234,7 +234,7 @@ inline void stasis_testing_teardown_workspace() { #define STASIS_ASSERT_FATAL(COND, REASON) do { \ stasis_testing_record_result((struct stasis_test_result_t) { \ .filename = __FILE_NAME__, \ - .funcname = __FUNCTION__, \ + .funcname = __func__, \ .lineno = __LINE__, \ .status = (COND), \ .msg_assertion = "ASSERT FATAL (" #COND ")", \ @@ -248,7 +248,7 @@ inline void stasis_testing_teardown_workspace() { #define STASIS_SKIP_IF(COND, REASON) do { \ stasis_testing_record_result((struct stasis_test_result_t) { \ .filename = __FILE_NAME__, \ - .funcname = __FUNCTION__, \ + .funcname = __func__, \ .lineno = __LINE__, \ .status = true, \ .skip = (COND), \ diff --git a/tests/test_conda.c b/tests/test_conda.c index f6ee2f8..bbbef3c 100644 --- a/tests/test_conda.c +++ b/tests/test_conda.c @@ -110,13 +110,13 @@ void test_conda_setup_headless() { void test_conda_env_create_from_uri() { const char *url = "https://ssb.stsci.edu/jhunk/stasis_test/test_conda_env_create_from_uri.yml"; - char *name = strdup(__FUNCTION__); + char *name = strdup(__func__); STASIS_ASSERT(conda_env_create_from_uri(name, (char *) url, "3.11") == 0, "creating an environment from a remote source failed"); free(name); } void test_conda_env_create_export_remove() { - char *name = strdup(__FUNCTION__); + char *name = strdup(__func__); STASIS_ASSERT(conda_env_create(name, "3", "fitsverify") == 0, "unable to create a simple environment"); STASIS_ASSERT(conda_env_export(name, ".", name) == 0, "unable to export an environment"); STASIS_ASSERT(conda_env_remove(name) == 0, "unable to remove an environment"); -- cgit