From 73603c97e22256540a32cc2dcd2003e3e6ad4293 Mon Sep 17 00:00:00 2001 From: Todd Carson Date: Wed, 1 Jul 2020 00:16:19 +0900 Subject: [PATCH] Don't declare mu_str_size_s() with the const attribute. When this function is declared const or pure, clang at -O1 or higher optimizes away the call to mu_str_size_s() inside mu_str_size(), so that it ignores its argument and returns whatever is in mu_str_size_s()'s static buffer. Found when test-mu-str failed while testing an update of mu in OpenBSD's ports tree. --- lib/utils/mu-str.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/mu-str.h b/lib/utils/mu-str.h index 45867d7a..f009a118 100644 --- a/lib/utils/mu-str.h +++ b/lib/utils/mu-str.h @@ -48,7 +48,7 @@ G_BEGIN_DECLS * @return a string representation of the size; see above * for what to do with it */ -const char* mu_str_size_s (size_t s) G_GNUC_CONST; +const char* mu_str_size_s (size_t s); char* mu_str_size (size_t s) G_GNUC_WARN_UNUSED_RESULT;