From f4bc6ba08aae93b42e674295224e36eeac677420 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Thu, 7 Jun 2012 11:09:29 -0400 Subject: [PATCH] Removed even more warnings --- Makefile | 2 -- asm.c | 2 +- ast.c | 2 +- gmqcc.h | 12 ++++++++++++ main.c | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4090ab4..fe0f5fc 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,6 @@ ifeq ($(CC), clang) -Wno-padded \ -Wno-undef \ -Wno-conditional-uninitialized \ - -Wno-missing-noreturn \ - -Wno-ignored-qualifiers \ -Wno-format-nonliteral endif diff --git a/asm.c b/asm.c index afb155c..c73f25c 100644 --- a/asm.c +++ b/asm.c @@ -44,7 +44,7 @@ VECTOR_MAKE(asm_sym, asm_symbols); * Assembly text processing: this handles the internal collection * of text to allow parsing and assemblation. */ -static char *const asm_getline(size_t *byte, FILE *fp) { +static char* asm_getline(size_t *byte, FILE *fp) { char *line = NULL; size_t read = util_getline(&line, byte, fp); *byte = read; diff --git a/ast.c b/ast.c index 00ab611..acffbdc 100644 --- a/ast.c +++ b/ast.c @@ -36,7 +36,7 @@ ( (ast_node*)self )->node.destroy = (ast_node_delete*)destroyfn /* It must not be possible to get here. */ -static void _ast_node_destroy(ast_node *self) +static GMQCC_NORETURN void _ast_node_destroy(ast_node *self) { fprintf(stderr, "ast node missing destroy()\n"); abort(); diff --git a/gmqcc.h b/gmqcc.h index 27597f4..78acf4a 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -95,6 +95,18 @@ # define GMQCC_INLINE inline #endif +/* + * noreturn is present in GCC and clang + * it's required for _ast_node_destory otherwise -Wmissing-noreturn + * in clang complains about there being no return since abort() is + * called. + */ +#if (defined(__GNUC__) && __GNUC__ >= 2) || defined(__CLANG__) +# define GMQCC_NORETURN __attribute__ ((noreturn)) +#else +# define GMQCC_NORETURN +#endif + /* * stdint.h and inttypes.h -less subset * for systems that don't have it, which we must diff --git a/main.c b/main.c index fe2f426..1ffcd99 100644 --- a/main.c +++ b/main.c @@ -24,7 +24,7 @@ typedef struct { char *name, type; } argitem; VECTOR_MAKE(argitem, items); -static const int usage(const char *const app) { +static int usage(const char *app) { printf("usage:\n" " %s -c -oprog.dat -- compile file\n" " %s -a -oprog.dat -- assemble file\n" -- 2.39.2