From 2baeb3acd2eceb65416f0837aa49196c6bfdf335 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 22 Feb 2026 20:23:50 +0100 Subject: Fix warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- liberror.h | 3 +++ save_backtrace.c | 5 +++++ set_error.c | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/liberror.h b/liberror.h index d692c7b..9f93fe9 100644 --- a/liberror.h +++ b/liberror.h @@ -251,6 +251,9 @@ struct liberror_state { * * @return The current error, `NULL` if none */ +#if defined(__GNUC__) +__attribute__((__pure__)) +#endif struct liberror_error *liberror_get_error(void); /** diff --git a/save_backtrace.c b/save_backtrace.c index 7df2fb5..d4e1068 100644 --- a/save_backtrace.c +++ b/save_backtrace.c @@ -2,6 +2,11 @@ #include "internal.h" +#if defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#endif + + WEAK int liberror_save_backtrace(struct liberror_error *error) { diff --git a/set_error.c b/set_error.c index e7a16ac..839a027 100644 --- a/set_error.c +++ b/set_error.c @@ -33,7 +33,7 @@ liberror_set_error(const char description[256], const char source[64], const cha } else if (!strcmp(code_group, "h_errno")) { if (code >= (long long int)INT_MIN && code <= (long long int)INT_MAX) { saved_errno = errno; - errstr = hstrerror(code); + errstr = hstrerror((int)code); if (errstr) strncpy(error->description, errstr, sizeof(error->description)); errno = saved_errno; @@ -43,7 +43,7 @@ liberror_set_error(const char description[256], const char source[64], const cha strerror_r(errno, error->description, sizeof(error->description)); } else if (code >= (long long int)INT_MIN && code <= (long long int)INT_MAX) { saved_errno = errno; - errstr = gai_strerror(code); + errstr = gai_strerror((int)code); if (errstr) strncpy(error->description, errstr, sizeof(error->description)); errno = saved_errno; -- cgit v1.2.3-70-g09d2