aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--liberror.h3
-rw-r--r--save_backtrace.c5
-rw-r--r--set_error.c4
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;