mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Squelch some more warnings on Linux
This commit is contained in:
parent
fb89c762fc
commit
4948508277
8 changed files with 30 additions and 18 deletions
|
@ -3622,8 +3622,6 @@ static int builtin_history(parser_t &parser, wchar_t **argv)
|
||||||
return STATUS_BUILTIN_ERROR;
|
return STATUS_BUILTIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark Simulator
|
|
||||||
|
|
||||||
int builtin_parse(parser_t &parser, wchar_t **argv)
|
int builtin_parse(parser_t &parser, wchar_t **argv)
|
||||||
{
|
{
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
|
18
common.cpp
18
common.cpp
|
@ -716,6 +716,18 @@ void print_stderr(const wcstring &str)
|
||||||
fprintf(stderr, "%ls\n", str.c_str());
|
fprintf(stderr, "%ls\n", str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void read_ignore(int fd, void *buff, size_t count)
|
||||||
|
{
|
||||||
|
size_t ignore __attribute__((unused));
|
||||||
|
ignore = read(fd, buff, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_ignore(int fd, const void *buff, size_t count)
|
||||||
|
{
|
||||||
|
size_t ignore __attribute__((unused));
|
||||||
|
ignore = write(fd, buff, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void debug_safe(int level, const char *msg, const char *param1, const char *param2, const char *param3, const char *param4, const char *param5, const char *param6, const char *param7, const char *param8, const char *param9, const char *param10, const char *param11, const char *param12)
|
void debug_safe(int level, const char *msg, const char *param1, const char *param2, const char *param3, const char *param4, const char *param5, const char *param6, const char *param7, const char *param8, const char *param9, const char *param10, const char *param11, const char *param12)
|
||||||
{
|
{
|
||||||
|
@ -736,7 +748,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
||||||
if (end == NULL)
|
if (end == NULL)
|
||||||
end = cursor + strlen(cursor);
|
end = cursor + strlen(cursor);
|
||||||
|
|
||||||
write(STDERR_FILENO, cursor, end - cursor);
|
write_ignore(STDERR_FILENO, cursor, end - cursor);
|
||||||
|
|
||||||
if (end[0] == '%' && end[1] == 's')
|
if (end[0] == '%' && end[1] == 's')
|
||||||
{
|
{
|
||||||
|
@ -745,7 +757,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
||||||
const char *format = params[param_idx++];
|
const char *format = params[param_idx++];
|
||||||
if (! format)
|
if (! format)
|
||||||
format = "(null)";
|
format = "(null)";
|
||||||
write(STDERR_FILENO, format, strlen(format));
|
write_ignore(STDERR_FILENO, format, strlen(format));
|
||||||
cursor = end + 2;
|
cursor = end + 2;
|
||||||
}
|
}
|
||||||
else if (end[0] == '\0')
|
else if (end[0] == '\0')
|
||||||
|
@ -761,7 +773,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
||||||
}
|
}
|
||||||
|
|
||||||
// We always append a newline
|
// We always append a newline
|
||||||
write(STDERR_FILENO, "\n", 1);
|
write_ignore(STDERR_FILENO, "\n", 1);
|
||||||
|
|
||||||
errno = errno_old;
|
errno = errno_old;
|
||||||
}
|
}
|
||||||
|
|
13
common.h
13
common.h
|
@ -157,6 +157,10 @@ extern bool g_profiling_active;
|
||||||
*/
|
*/
|
||||||
extern const wchar_t *program_name;
|
extern const wchar_t *program_name;
|
||||||
|
|
||||||
|
/* Variants of read() and write() that ignores return values, defeating a warning */
|
||||||
|
void read_ignore(int fd, void *buff, size_t count);
|
||||||
|
void write_ignore(int fd, const void *buff, size_t count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This macro is used to check that an input argument is not null. It
|
This macro is used to check that an input argument is not null. It
|
||||||
is a bit lika a non-fatal form of assert. Instead of exit-ing on
|
is a bit lika a non-fatal form of assert. Instead of exit-ing on
|
||||||
|
@ -180,11 +184,10 @@ extern const wchar_t *program_name;
|
||||||
*/
|
*/
|
||||||
#define FATAL_EXIT() \
|
#define FATAL_EXIT() \
|
||||||
{ \
|
{ \
|
||||||
char exit_read_buff; \
|
char exit_read_buff; \
|
||||||
show_stackframe(); \
|
show_stackframe(); \
|
||||||
int ignore __attribute__((unused)); \
|
read_ignore( 0, &exit_read_buff, 1 ); \
|
||||||
ignore = read( 0, &exit_read_buff, 1 ); \
|
exit_without_destructors( 1 ); \
|
||||||
exit_without_destructors( 1 ); \
|
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -200,9 +200,10 @@ CXXFLAGS="$CXXFLAGS -fno-exceptions"
|
||||||
|
|
||||||
#
|
#
|
||||||
# -Wall is there to keep me on my toes
|
# -Wall is there to keep me on my toes
|
||||||
|
# But signed comparison warnings are way too aggressive
|
||||||
#
|
#
|
||||||
|
|
||||||
CXXFLAGS="$CXXFLAGS -Wall"
|
CXXFLAGS="$CXXFLAGS -Wall -Wno-sign-compare"
|
||||||
|
|
||||||
#
|
#
|
||||||
# This is needed in order to get the really cool backtraces on Linux
|
# This is needed in order to get the really cool backtraces on Linux
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ static void test_expand()
|
||||||
err(L"Expansion not correctly handling literal path components in dotfiles");
|
err(L"Expansion not correctly handling literal path components in dotfiles");
|
||||||
}
|
}
|
||||||
|
|
||||||
system("rm -Rf /tmp/fish_expand_test");
|
if (system("rm -Rf /tmp/fish_expand_test")) err(L"rm failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_fuzzy_match(void)
|
static void test_fuzzy_match(void)
|
||||||
|
@ -3117,7 +3117,7 @@ static void test_highlighting(void)
|
||||||
|
|
||||||
// Generate the text
|
// Generate the text
|
||||||
wcstring text;
|
wcstring text;
|
||||||
std::vector<int> expected_colors;
|
std::vector<highlight_spec_t> expected_colors;
|
||||||
for (size_t i=0; i < component_count; i++)
|
for (size_t i=0; i < component_count; i++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
int writestr(char *str)
|
int writestr(char *str)
|
||||||
{
|
{
|
||||||
write(1, str, strlen(str));
|
write_ignore(1, str, strlen(str));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
proc.cpp
4
proc.cpp
|
@ -383,8 +383,6 @@ static void mark_process_status(const job_t *j, process_t *p, int status)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ssize_t ignore __attribute__((unused));
|
|
||||||
|
|
||||||
/* This should never be reached */
|
/* This should never be reached */
|
||||||
p->completed = 1;
|
p->completed = 1;
|
||||||
|
|
||||||
|
@ -398,7 +396,7 @@ static void mark_process_status(const job_t *j, process_t *p, int status)
|
||||||
handler. If things aren't working properly, it's safer to
|
handler. If things aren't working properly, it's safer to
|
||||||
give up.
|
give up.
|
||||||
*/
|
*/
|
||||||
ignore = write(2, mess, strlen(mess));
|
write_ignore(2, mess, strlen(mess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ void safe_perror(const char *message)
|
||||||
safe_append(buff, safe_strerror(err), sizeof buff);
|
safe_append(buff, safe_strerror(err), sizeof buff);
|
||||||
safe_append(buff, "\n", sizeof buff);
|
safe_append(buff, "\n", sizeof buff);
|
||||||
|
|
||||||
write(STDERR_FILENO, buff, strlen(buff));
|
write_ignore(STDERR_FILENO, buff, strlen(buff));
|
||||||
errno = err;
|
errno = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue