mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-24 09:21:16 -03:00
Silence unused result warnings on newer compilers
Newer versions of GCC and Clang are not satisfied by a cast to void, this fix is adapted from glibc's solution. New wrapper function ignore_result should be used when a function with explicit _unused_attribute_ wrapper is called whose result will not be handled.
This commit is contained in:
committed by
Kurtis Rader
parent
5356384d0a
commit
e6bb7fc973
@@ -616,14 +616,14 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
||||
const char *end = strchr(cursor, '%');
|
||||
if (end == NULL) end = cursor + strlen(cursor);
|
||||
|
||||
(void)write(STDERR_FILENO, cursor, end - cursor);
|
||||
ignore_result(write(STDERR_FILENO, cursor, end - cursor));
|
||||
|
||||
if (end[0] == '%' && end[1] == 's') {
|
||||
// Handle a format string.
|
||||
assert(param_idx < sizeof params / sizeof *params);
|
||||
const char *format = params[param_idx++];
|
||||
if (!format) format = "(null)";
|
||||
(void)write(STDERR_FILENO, format, strlen(format));
|
||||
ignore_result(write(STDERR_FILENO, format, strlen(format)));
|
||||
cursor = end + 2;
|
||||
} else if (end[0] == '\0') {
|
||||
// Must be at the end of the string.
|
||||
@@ -635,7 +635,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
||||
}
|
||||
|
||||
// We always append a newline.
|
||||
(void)write(STDERR_FILENO, "\n", 1);
|
||||
ignore_result(write(STDERR_FILENO, "\n", 1));
|
||||
|
||||
errno = errno_old;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user