From fa401b6f568ef80a40194722e3ddc103f7378adb Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Sat, 22 Dec 2012 08:22:50 +0000 Subject: [PATCH] Cleanups and make compile with clang again with no warnings. --- Makefile | 4 +++- ast.c | 1 - exec.c | 4 ---- main.c | 2 -- parser.c | 3 --- test.c | 13 +++++++++++++ 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index eae6f3e..0d1cee7 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,9 @@ ifeq ($(CC), clang) -Wno-format-nonliteral \ -Wno-disabled-macro-expansion \ -Wno-conversion \ - -Wno-missing-prototypes + -Wno-missing-prototypes \ + -Wno-float-equal \ + -Wno-cast-align endif ifeq ($(track), no) CFLAGS += -DNOTRACK diff --git a/ast.c b/ast.c index 23ed28a..e544e48 100644 --- a/ast.c +++ b/ast.c @@ -1085,7 +1085,6 @@ void _ast_codegen_output_type(ast_expression_common *self, ir_value *out) } #define codegen_output_type(a,o) (_ast_codegen_output_type(&((a)->expression),(o))) -#define codegen_output_type_expr(a,o) (_ast_codegen_output_type(a,(o))) bool ast_value_codegen(ast_value *self, ast_function *func, bool lvalue, ir_value **out) { diff --git a/exec.c b/exec.c index aaaa88b..f4a986e 100644 --- a/exec.c +++ b/exec.c @@ -560,28 +560,24 @@ bool prog_exec(qc_program *prog, prog_section_function *func, size_t flags, long #define QCVM_PROFILE 0 #define QCVM_TRACE 0 # include __FILE__ - break; } case (VMXF_TRACE): { #define QCVM_PROFILE 0 #define QCVM_TRACE 1 # include __FILE__ - break; } case (VMXF_PROFILE): { #define QCVM_PROFILE 1 #define QCVM_TRACE 0 # include __FILE__ - break; } case (VMXF_TRACE|VMXF_PROFILE): { #define QCVM_PROFILE 1 #define QCVM_TRACE 1 # include __FILE__ - break; } }; diff --git a/main.c b/main.c index aaa61c3..d6edd5c 100644 --- a/main.c +++ b/main.c @@ -206,8 +206,6 @@ static bool options_parse(int argc, char **argv) { /* show defaults (like pathscale) */ if (!strcmp(argv[0]+1, "show-defaults")) { - size_t itr; - char buffer[1024]; for (itr = 0; itr < COUNT_FLAGS; ++itr) { if (!OPTS_FLAG(itr)) continue; diff --git a/parser.c b/parser.c index 9955058..d647415 100644 --- a/parser.c +++ b/parser.c @@ -26,8 +26,6 @@ #include "gmqcc.h" #include "lexer.h" -#define PARSER_HT_FIELDS 0 -#define PARSER_HT_GLOBALS 1 /* beginning of locals */ #define PARSER_HT_LOCALS 2 @@ -4375,7 +4373,6 @@ skipvar: } else if (parser->tok == '{' || parser->tok == '[') { - size_t i; if (localblock) { parseerror(parser, "cannot declare functions within functions"); break; diff --git a/test.c b/test.c index 1a12f07..b29a3d4 100644 --- a/test.c +++ b/test.c @@ -127,8 +127,21 @@ FILE ** task_popen(const char *command, const char *mode) { goto task_popen_error_3; } + /* + * clang is stupid, it doesn't understand that yes, this code + * is actually reachable. + */ +# ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunreachable-code" +# endif if (argv) vec_free(argv); + +# ifdef __clang__ +# pragma clang diagnostic pop +# endif + return data->handles; task_popen_error_3: close(errhandle[0]), close(errhandle[1]); -- 2.39.2