From: Dale Weiler Date: Thu, 6 Jun 2013 02:51:13 +0000 (+0000) Subject: Strict prototyping X-Git-Tag: v0.3.0~151^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=144672fada7324651eabbbd0eaec68ed4dd031c1;p=xonotic%2Fgmqcc.git Strict prototyping --- diff --git a/Makefile b/Makefile index a1c08f9..2e5c1ee 100644 --- a/Makefile +++ b/Makefile @@ -29,12 +29,13 @@ ifeq ($(CC), clang) -Wno-conversion \ -Wno-missing-prototypes \ -Wno-float-equal \ - -Wno-unknown-warning-option + -Wno-unknown-warning-option \ + -Wstrict-prototypes else #Tiny C Compiler doesn't know what -pedantic-errors is # and instead of ignoring .. just errors. ifneq ($(CC), tcc) - CFLAGS += -pedantic-errors + CFLAGS += -Wstrict-prototypes -pedantic-errors else CFLAGS += -Wno-pointer-sign -fno-common endif diff --git a/conout.c b/conout.c index 80ec5e1..13a242f 100644 --- a/conout.c +++ b/conout.c @@ -197,7 +197,7 @@ static con_t console; * NOTE: This prevents colored output to piped stdout/err via isatty * checks. */ -static void con_enablecolor() { +static void con_enablecolor(void) { if (console.handle_err == stderr || console.handle_err == stdout) console.color_err = !!(isatty(STDERR_FILENO)); if (console.handle_out == stderr || console.handle_out == stdout) diff --git a/exec.c b/exec.c index 18b9f30..6934a0c 100644 --- a/exec.c +++ b/exec.c @@ -835,7 +835,7 @@ static size_t qc_builtins_count = sizeof(qc_builtins) / sizeof(qc_builtins[0]); static const char *arg0 = NULL; -static void version() { +static void version(void) { printf("GMQCC-QCVM %d.%d.%d Built %s %s\n", GMQCC_VERSION_MAJOR, GMQCC_VERSION_MINOR, @@ -845,7 +845,7 @@ static void version() { ); } -static void usage() { +static void usage(void) { printf("usage: %s [options] [parameters] file\n", arg0); printf("options:\n"); printf(" -h, --help print this message\n" diff --git a/ftepp.c b/ftepp.c index 0a9ff5b..55d4fff 100644 --- a/ftepp.c +++ b/ftepp.c @@ -316,7 +316,7 @@ static void ppmacro_delete(ppmacro *self) mem_d(self); } -static ftepp_t* ftepp_new() +static ftepp_t* ftepp_new(void) { ftepp_t *ftepp; diff --git a/gmqcc.h b/gmqcc.h index 6dde0cd..d6055db 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -287,7 +287,7 @@ GMQCC_IND_STRING(GMQCC_VERSION_PATCH) \ /*===================================================================*/ /*=========================== stat.c ================================*/ /*===================================================================*/ -void stat_info(); +void stat_info (void); char *stat_mem_strdup (const char *, size_t, const char *, bool); void *stat_mem_reallocate(void *, size_t, size_t, const char *); void stat_mem_deallocate(void *); @@ -317,7 +317,7 @@ size_t util_strtononcmd (const char *, char *, size_t); uint16_t util_crc16(uint16_t crc, const char *data, size_t len); void util_seed(uint32_t); -uint32_t util_rand(); +uint32_t util_rand(void); /* * String functions (formatting, copying, concatenating, errors). These are wrapped @@ -373,7 +373,7 @@ typedef struct trie_s { struct trie_s *entries; } correct_trie_t; -correct_trie_t* correct_trie_new(); +correct_trie_t* correct_trie_new(void); typedef struct hash_table_t { size_t size; @@ -763,17 +763,17 @@ enum { LVL_ERROR }; -FILE *con_default_out(); -FILE *con_default_err(); +FILE *con_default_out(void); +FILE *con_default_err(void); void con_vprintmsg (int level, const char *name, size_t line, size_t column, const char *msgtype, const char *msg, va_list ap); void con_printmsg (int level, const char *name, size_t line, size_t column, const char *msgtype, const char *msg, ...); void con_cvprintmsg(void *ctx, int lvl, const char *msgtype, const char *msg, va_list ap); void con_cprintmsg (void *ctx, int lvl, const char *msgtype, const char *msg, ...); -void con_close (); -void con_init (); -void con_reset (); +void con_close (void); +void con_init (void); +void con_reset (void); void con_color (int); int con_change(const char *, const char *); int con_verr (const char *, va_list); @@ -790,7 +790,7 @@ void /********/ compile_error (lex_ctx ctx, /*LVL_ERROR*/ const char *msg, ... void /********/ vcompile_error (lex_ctx ctx, /*LVL_ERROR*/ const char *msg, va_list ap); bool GMQCC_WARN compile_warning (lex_ctx ctx, int warntype, const char *fmt, ...); bool GMQCC_WARN vcompile_warning(lex_ctx ctx, int warntype, const char *fmt, va_list ap); -void compile_show_werrors(); +void compile_show_werrors(void); /*===================================================================*/ /*========================= assembler.c =============================*/ @@ -995,8 +995,7 @@ qcint prog_tempstring(qc_program *prog, const char *_str); /*===================== parser.c commandline ========================*/ /*===================================================================*/ struct parser_s; - -struct parser_s *parser_create (); +struct parser_s *parser_create (void); bool parser_compile_file (struct parser_s *parser, const char *); bool parser_compile_string(struct parser_s *parser, const char *, const char *, size_t); bool parser_finish (struct parser_s *parser, const char *); @@ -1006,7 +1005,7 @@ void parser_cleanup (struct parser_s *parser); /*====================== ftepp.c commandline ========================*/ /*===================================================================*/ struct ftepp_s; -struct ftepp_s *ftepp_create (); +struct ftepp_s *ftepp_create (void); bool ftepp_preprocess_file (struct ftepp_s *ftepp, const char *filename); bool ftepp_preprocess_string(struct ftepp_s *ftepp, const char *name, const char *str); void ftepp_finish (struct ftepp_s *ftepp); @@ -1066,10 +1065,10 @@ void opts_setoptimlevel(unsigned int); void opts_ini_init (const char *); /* Saner flag handling */ -void opts_backup_non_Wall(); -void opts_restore_non_Wall(); -void opts_backup_non_Werror_all(); -void opts_restore_non_Werror_all(); +void opts_backup_non_Wall(void); +void opts_restore_non_Wall(void); +void opts_backup_non_Werror_all(void); +void opts_restore_non_Werror_all(void); enum { # define GMQCC_TYPE_FLAGS diff --git a/intrin.h b/intrin.h index 81af620..00464aa 100644 --- a/intrin.h +++ b/intrin.h @@ -36,7 +36,7 @@ typedef struct { const char *alias; } intrin_t; -static ht intrin_intrinsics() { +static ht intrin_intrinsics(void) { static ht intrinsics = NULL; if (!intrinsics) intrinsics = util_htnew(PARSER_HT_SIZE); diff --git a/main.c b/main.c index cbcadf1..37638e9 100644 --- a/main.c +++ b/main.c @@ -50,7 +50,7 @@ static ppitem *ppems = NULL; static const char *app_name; -static void version() { +static void version(void) { con_out("GMQCC %d.%d.%d Built %s %s\n" GMQCC_DEV_VERSION_STRING, GMQCC_VERSION_MAJOR, GMQCC_VERSION_MINOR, @@ -60,7 +60,7 @@ static void version() { ); } -static int usage() { +static int usage(void) { con_out("usage: %s [options] [files...]", app_name); con_out("options:\n" " -h, --help show this help message\n" diff --git a/opts.c b/opts.c index 4cfa79c..e6ca420 100644 --- a/opts.c +++ b/opts.c @@ -30,7 +30,7 @@ unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS]; opts_cmd_t opts; /* command lien options */ -static void opts_setdefault() { +static void opts_setdefault(void) { memset(&opts, 0, sizeof(opts_cmd_t)); OPTS_OPTION_BOOL(OPTION_CORRECTION) = true; diff --git a/stat.c b/stat.c index 1bfba84..3f342d0 100644 --- a/stat.c +++ b/stat.c @@ -70,7 +70,7 @@ static stat_mem_block_t *stat_mem_block_root = NULL; * sizes. We can use it for other things too, if we need to. This is * very TIGHT, and efficent in terms of space though. */ -static stat_size_table_t stat_size_new() { +static stat_size_table_t stat_size_new(void) { return (stat_size_table_t)memset( mem_a(sizeof(stat_size_entry_t*) * ST_SIZE), 0, ST_SIZE * sizeof(stat_size_entry_t*) @@ -523,7 +523,7 @@ static void stat_dump_mem_contents(stat_mem_block_t *memory, uint16_t cols) { } } -static void stat_dump_mem_leaks() { +static void stat_dump_mem_leaks(void) { stat_mem_block_t *info; for (info = stat_mem_block_root; info; info = info->next) { con_out("lost: %u (bytes) at %s:%u\n", @@ -536,7 +536,7 @@ static void stat_dump_mem_leaks() { } } -static void stat_dump_mem_info() { +static void stat_dump_mem_info(void) { con_out("Memory information:\n\ Total allocations: %llu\n\ Total deallocations: %llu\n\ diff --git a/util.c b/util.c index 5e234ae..efed221 100644 --- a/util.c +++ b/util.c @@ -389,7 +389,7 @@ int util_asprintf(char **ret, const char *fmt, ...) { static uint32_t mt_state[MT_SIZE]; static size_t mt_index = 0; -static GMQCC_INLINE void mt_generate() { +static GMQCC_INLINE void mt_generate(void) { /* * The loop has been unrolled here: the original paper and implemenation * Called for the following code: