diff --git a/Makefile b/Makefile index d35fb5e..aafcecd 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,15 @@ else CFLAGS_EXTRA=-O2 endif -CCFLAGS=-D_GNU_SOURCE=1 -Wall -Wextra -Werror-implicit-function-declaration -Wstrict-prototypes -Wno-missing-field-initializers $(CFLAGS_EXTRA) $(CFLAGS) +# The -Wunreachable-code warning is only implemented in clang, but it +# doesn't break anything for gcc to see it. +WARNINGS=-Wall \ + -Wextra \ + -Werror-implicit-function-declaration \ + -Wstrict-prototypes \ + -Wno-missing-field-initializers \ + -Wunreachable-code +CCFLAGS=-D_GNU_SOURCE=1 $(WARNINGS) $(CFLAGS_EXTRA) $(CFLAGS) LLDFLAGS=-lrt -lev $(LDFLAGS_EXTRA) $(LDFLAGS) CC?=gcc diff --git a/src/common/client.c b/src/common/client.c index aaca2aa..7458068 100644 --- a/src/common/client.c +++ b/src/common/client.c @@ -126,7 +126,9 @@ void write_not_zeroes(struct client* client, uint64_t from, uint64_t len) debug("(run adjusted to %d)", run); } - if (0) /* useful but expensive */ + /* + // Useful but expensive + if (0) { uint64_t i; fprintf(stderr, "full map resolution=%d: ", map->resolution); @@ -139,6 +141,7 @@ void write_not_zeroes(struct client* client, uint64_t from, uint64_t len) } fprintf(stderr, "\n"); } + */ #define DO_READ(dst, len) ERROR_IF_NEGATIVE( \ readloop( \ diff --git a/src/common/mode.c b/src/common/mode.c index f7d31a3..732091c 100644 --- a/src/common/mode.c +++ b/src/common/mode.c @@ -220,7 +220,6 @@ void read_serve_param( int c, char **ip_addr, char **ip_port, char **file, char case 'h': fprintf(stdout, "%s\n", serve_help_text ); exit( 0 ); - break; case 'l': *ip_addr = optarg; break; @@ -263,7 +262,6 @@ void read_listen_param( int c, case 'h': fprintf(stdout, "%s\n", listen_help_text ); exit(0); - break; case 'l': *ip_addr = optarg; break; @@ -297,7 +295,6 @@ void read_readwrite_param( int c, char **ip_addr, char **ip_port, char **bind_ad case 'h': fprintf(stdout, "%s\n", err_text ); exit( 0 ); - break; case 'l': *ip_addr = optarg; break; @@ -331,7 +328,6 @@ void read_sock_param( int c, char **sock, char *help_text ) case 'h': fprintf( stdout, "%s\n", help_text ); exit( 0 ); - break; case 's': *sock = optarg; break; @@ -362,7 +358,6 @@ void read_mirror_speed_param( case 'h': fprintf( stdout, "%s\n", mirror_speed_help_text ); exit( 0 ); - break; case 's': *sock = optarg; break; @@ -394,7 +389,6 @@ void read_mirror_param( case 'h': fprintf( stdout, "%s\n", mirror_help_text ); exit( 0 ); - break; case 's': *sock = optarg; break; @@ -428,7 +422,6 @@ void read_break_param( int c, char **sock ) case 'h': fprintf( stdout, "%s\n", break_help_text ); exit( 0 ); - break; case 's': *sock = optarg; break; diff --git a/src/common/remote.c b/src/common/remote.c index 8accb39..43830a5 100644 --- a/src/common/remote.c +++ b/src/common/remote.c @@ -63,7 +63,5 @@ void do_remote_command(char* command, char* socket_name, int argc, char** argv) print_response( response ); exit(atoi(response)); - - close(remote); } diff --git a/src/proxy-main.c b/src/proxy-main.c index b48e8ca..8c8ea4c 100644 --- a/src/proxy-main.c +++ b/src/proxy-main.c @@ -42,7 +42,6 @@ void read_proxy_param( case 'h' : fprintf( stdout, "%s\n", proxy_help_text ); exit( 0 ); - break; case 'l': *downstream_addr = optarg; break;