From: Simon Ruderich Date: Fri, 7 Jun 2013 00:01:23 +0000 (+0200) Subject: Fix a few strict compiler warnings. X-Git-Tag: 0.1~98 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=06f483dbeece72fa46fe43700b6e01279c92c916;p=coloredstderr%2Fcoloredstderr.git Fix a few strict compiler warnings. --- diff --git a/src/coloredstderr.c b/src/coloredstderr.c index 4472689..68ef859 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -119,14 +119,14 @@ static void close_fd(int fd) { /* "Action" handlers called when a file descriptor is matched. */ -static char *pre_string; +static char const *pre_string; static size_t pre_string_size; -static char *post_string; +static char const *post_string; static size_t post_string_size; /* Load alternative pre/post strings from the environment if available, fall * back to default values. */ -inline static void init_pre_post_string() { +inline static void init_pre_post_string(void) { pre_string = getenv(ENV_NAME_PRE_STRING); if (!pre_string) { pre_string = DEFAULT_PRE_STRING; @@ -476,7 +476,7 @@ int execve(char const *filename, char * const argv[], char * const env[]) { /* Count arguments. */ \ size_t count = 1; /* arg */ \ va_start(ap, arg); \ - while (va_arg(ap, const char *)) { \ + while (va_arg(ap, char const *)) { \ count++; \ } \ va_end(ap); \ diff --git a/src/debug.h b/src/debug.h index adc0792..aebd88c 100644 --- a/src/debug.h +++ b/src/debug.h @@ -62,7 +62,7 @@ static void debug(char const *format, ...) { static void warning(char const *format, ...) { va_list ap; - char *home = getenv("HOME"); + char const *home = getenv("HOME"); if (!home) { return; } diff --git a/tests/example.c b/tests/example.c index b1eac98..545f3cb 100644 --- a/tests/example.c +++ b/tests/example.c @@ -24,6 +24,8 @@ int main(int argc, char **argv) { + (void)argv; + fprintf(stderr, "write to stderr: %d\n", argc); printf("write to stdout\n"); fflush(stdout); diff --git a/tests/example_vfork.c b/tests/example_vfork.c index 35ceaf4..ed94e56 100644 --- a/tests/example_vfork.c +++ b/tests/example_vfork.c @@ -19,6 +19,7 @@ #include #include +#include #include int main(int argc, char **argv) {