aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--builtin.cpp2
-rw-r--r--common.cpp18
-rw-r--r--common.h13
-rw-r--r--configure.ac3
-rw-r--r--fish_tests.cpp4
-rw-r--r--key_reader.cpp2
-rw-r--r--proc.cpp4
-rw-r--r--wutil.cpp2
8 files changed, 30 insertions, 18 deletions
diff --git a/builtin.cpp b/builtin.cpp
index 70829acb..9f63e515 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -3622,8 +3622,6 @@ static int builtin_history(parser_t &parser, wchar_t **argv)
return STATUS_BUILTIN_ERROR;
}
-#pragma mark Simulator
-
int builtin_parse(parser_t &parser, wchar_t **argv)
{
struct sigaction act;
diff --git a/common.cpp b/common.cpp
index 0a247fe6..4bb15104 100644
--- a/common.cpp
+++ b/common.cpp
@@ -716,6 +716,18 @@ void print_stderr(const wcstring &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)
{
@@ -736,7 +748,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
if (end == NULL)
end = cursor + strlen(cursor);
- write(STDERR_FILENO, cursor, end - cursor);
+ write_ignore(STDERR_FILENO, cursor, end - cursor);
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++];
if (! format)
format = "(null)";
- write(STDERR_FILENO, format, strlen(format));
+ write_ignore(STDERR_FILENO, format, strlen(format));
cursor = end + 2;
}
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
- write(STDERR_FILENO, "\n", 1);
+ write_ignore(STDERR_FILENO, "\n", 1);
errno = errno_old;
}
diff --git a/common.h b/common.h
index 057db144..b22720b0 100644
--- a/common.h
+++ b/common.h
@@ -157,6 +157,10 @@ extern bool g_profiling_active;
*/
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
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() \
{ \
- char exit_read_buff; \
- show_stackframe(); \
- int ignore __attribute__((unused)); \
- ignore = read( 0, &exit_read_buff, 1 ); \
- exit_without_destructors( 1 ); \
+ char exit_read_buff; \
+ show_stackframe(); \
+ read_ignore( 0, &exit_read_buff, 1 ); \
+ exit_without_destructors( 1 ); \
} \
diff --git a/configure.ac b/configure.ac
index 23c5b16a..ae1a6183 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,9 +200,10 @@ CXXFLAGS="$CXXFLAGS -fno-exceptions"
#
# -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
diff --git a/fish_tests.cpp b/fish_tests.cpp
index 382abb39..7ec4ab8b 100644
--- a/fish_tests.cpp
+++ b/fish_tests.cpp
@@ -1330,7 +1330,7 @@ static void test_expand()
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)
@@ -3117,7 +3117,7 @@ static void test_highlighting(void)
// Generate the text
wcstring text;
- std::vector<int> expected_colors;
+ std::vector<highlight_spec_t> expected_colors;
for (size_t i=0; i < component_count; i++)
{
if (i > 0)
diff --git a/key_reader.cpp b/key_reader.cpp
index fae6f33f..382f4b22 100644
--- a/key_reader.cpp
+++ b/key_reader.cpp
@@ -22,7 +22,7 @@
int writestr(char *str)
{
- write(1, str, strlen(str));
+ write_ignore(1, str, strlen(str));
return 0;
}
diff --git a/proc.cpp b/proc.cpp
index 8ebcdb01..f62b00f6 100644
--- a/proc.cpp
+++ b/proc.cpp
@@ -383,8 +383,6 @@ static void mark_process_status(const job_t *j, process_t *p, int status)
}
else
{
- ssize_t ignore __attribute__((unused));
-
/* This should never be reached */
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
give up.
*/
- ignore = write(2, mess, strlen(mess));
+ write_ignore(2, mess, strlen(mess));
}
}
diff --git a/wutil.cpp b/wutil.cpp
index ffb4f2b2..7750a3e4 100644
--- a/wutil.cpp
+++ b/wutil.cpp
@@ -364,7 +364,7 @@ void safe_perror(const char *message)
safe_append(buff, safe_strerror(err), sizeof buff);
safe_append(buff, "\n", sizeof buff);
- write(STDERR_FILENO, buff, strlen(buff));
+ write_ignore(STDERR_FILENO, buff, strlen(buff));
errno = err;
}