diff options
author | Mattias Andrée <maandree@kth.se> | 2021-12-10 21:28:49 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-12-10 21:28:49 +0100 |
commit | ee22267ae381eb3274aff3a6c6d1b0ab6efe53d2 (patch) | |
tree | fd2cd355db5022a2df4b47d56e6326736bf88046 | |
parent | Add liberror_setenv_failed (diff) | |
download | liberror-libc-ee22267ae381eb3274aff3a6c6d1b0ab6efe53d2.tar.gz liberror-libc-ee22267ae381eb3274aff3a6c6d1b0ab6efe53d2.tar.bz2 liberror-libc-ee22267ae381eb3274aff3a6c6d1b0ab6efe53d2.tar.xz |
Fix warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | internal.h | 1 | ||||
-rw-r--r-- | liberror-libc.h | 1 | ||||
-rw-r--r-- | lseek.c | 6 | ||||
-rw-r--r-- | recv.c | 8 | ||||
-rw-r--r-- | send.c | 8 | ||||
-rw-r--r-- | shutdown.c | 1 |
6 files changed, 21 insertions, 4 deletions
@@ -17,6 +17,7 @@ #if defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wsuggest-attribute=const" # define GCC_ATTRIBUTES(...) __attribute__((__VA_ARGS__)) #else # define GCC_ATTRIBUTES(...) diff --git a/liberror-libc.h b/liberror-libc.h index 14ca4a0..7b99d93 100644 --- a/liberror-libc.h +++ b/liberror-libc.h @@ -15,6 +15,7 @@ #define _LIBERROR_WUR _LIBERROR_GCC_ONLY(__attribute__((__warn_unused_result__))) #define _LIBERROR_MALLOC _LIBERROR_GCC_ONLY(__attribute__((__malloc__))) +#define _LIBERROR_CONST _LIBERROR_GCC_ONLY(__attribute__((__const__))) #define LIBERROR_LIBC_ERRROR_SHORT_READ -1 @@ -77,9 +77,9 @@ liberror_lseek_short(int fd, _liberror_off_t offset, int whence, _liberror_uoff_ struct liberror_error *error; int saved_errno = errno; liberror_save_backtrace(NULL); - if (returned < 0 || (size_t)returned < min) { + if (returned < 0 || (_liberror_uoff_t)returned < min) { desc = "Seek resulted in a new offset in an earlier position than expected"; - } else if (returned > max) { + } else if ((_liberror_uoff_t)returned > max) { desc = "Seek resulted in a new offset in an beyond the expectation"; } else { desc = "Seek resulted in an unexpected new offset"; @@ -91,6 +91,8 @@ liberror_lseek_short(int fd, _liberror_off_t offset, int whence, _liberror_uoff_ error->details.one_file.name = fname ? strdup(fname) : NULL; error->details.one_file.role = "Seekable file"; errno = saved_errno; + (void) offset; + (void) whence; } @@ -109,6 +109,9 @@ liberror_recv_failed(int fd, void *buf, size_t n, int flags, const char *fname) break; } liberror_libc_set_error_one_file(desc, "recv", "Socket file", fd, fname); + (void) buf; + (void) n; + (void) flags; } @@ -121,7 +124,7 @@ liberror_recv_short(int fd, void *buf, size_t n, int flags, size_t min, size_t m liberror_save_backtrace(NULL); if (returned < 0 || (size_t)returned < min) { desc = "Received message was shorter than expected"; - } else if (returned > max) { + } else if ((size_t) returned > max) { desc = "Received message was larger than expected"; } else { desc = "Received message was of an unexpected size"; @@ -133,6 +136,9 @@ liberror_recv_short(int fd, void *buf, size_t n, int flags, size_t min, size_t m error->details.one_file.name = fname ? strdup(fname) : NULL; error->details.one_file.role = "Socket file"; errno = saved_errno; + (void) buf; + (void) n; + (void) flags; } @@ -142,6 +142,9 @@ liberror_send_failed(int fd, const void *buf, size_t n, int flags, const char *f break; } liberror_libc_set_error_one_file(desc, "send", "Socket file", fd, fname); + (void) buf; + (void) n; + (void) flags; } @@ -154,7 +157,7 @@ liberror_send_short(int fd, const void *buf, size_t n, int flags, size_t min, si liberror_save_backtrace(NULL); if (returned < 0 || (size_t)returned < min) { desc = "Sent message was shorter than expected"; - } else if (returned > max) { + } else if ((size_t)returned > max) { desc = "Sent message was larger than expected"; } else { desc = "Sent message was of an unexpected size"; @@ -166,6 +169,9 @@ liberror_send_short(int fd, const void *buf, size_t n, int flags, size_t min, si error->details.one_file.name = fname ? strdup(fname) : NULL; error->details.one_file.role = "Socket file"; errno = saved_errno; + (void) buf; + (void) n; + (void) flags; } @@ -30,6 +30,7 @@ liberror_shutdown_failed(int fd, int how, const char *fname) break; } liberror_libc_set_error_one_file(desc, "shutdown", "Socket file", fd, fname); + (void) how; } |