Removed even more warnings

This commit is contained in:
Dale Weiler 2012-06-07 11:09:29 -04:00
parent ce941066db
commit f4bc6ba08a
5 changed files with 15 additions and 5 deletions

View file

@ -15,8 +15,6 @@ ifeq ($(CC), clang)
-Wno-padded \
-Wno-undef \
-Wno-conditional-uninitialized \
-Wno-missing-noreturn \
-Wno-ignored-qualifiers \
-Wno-format-nonliteral
endif

2
asm.c
View file

@ -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;

2
ast.c
View file

@ -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();

12
gmqcc.h
View file

@ -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

2
main.c
View file

@ -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<file> -oprog.dat -- compile file\n"
" %s -a<file> -oprog.dat -- assemble file\n"