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.
This commit is contained in:
Todd Carson 2020-07-01 00:16:19 +09:00
parent 0355479b51
commit 73603c97e2
1 changed files with 1 additions and 1 deletions

View File

@ -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;