]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Strict prototyping
authorDale Weiler <killfieldengine@gmail.com>
Thu, 6 Jun 2013 02:51:13 +0000 (02:51 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Thu, 6 Jun 2013 02:51:13 +0000 (02:51 +0000)
Makefile
conout.c
exec.c
ftepp.c
gmqcc.h
intrin.h
main.c
opts.c
stat.c
util.c

index a1c08f9b5e75752a3c8ad944044e82bb4a6b0a9f..2e5c1eea8323b4cac1b55e9933f8d22014c7baa6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -29,12 +29,13 @@ ifeq ($(CC), clang)
            -Wno-conversion                    \
            -Wno-missing-prototypes            \
            -Wno-float-equal                   \
            -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)
 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
        else
                CFLAGS += -Wno-pointer-sign -fno-common
        endif
index 80ec5e1a387499a4485892f28733e0303f4530d1..13a242f4041b613f539c1030bd59a6c2bcf320e1 100644 (file)
--- 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.
  */
  * 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)
     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 18b9f30fc6bd2f031505e66fc3dfca85929aec79..6934a0c0605a9d17bf7145f96a8eec25c7718e17 100644 (file)
--- 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 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,
     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"
     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 0a9ff5b64ee47339cf1a76c0bb44986e348aa14c..55d4fffb1e3330cb4e6f4b605a3c6ce1a61cf414 100644 (file)
--- a/ftepp.c
+++ b/ftepp.c
@@ -316,7 +316,7 @@ static void ppmacro_delete(ppmacro *self)
     mem_d(self);
 }
 
     mem_d(self);
 }
 
-static ftepp_t* ftepp_new()
+static ftepp_t* ftepp_new(void)
 {
     ftepp_t *ftepp;
 
 {
     ftepp_t *ftepp;
 
diff --git a/gmqcc.h b/gmqcc.h
index 6dde0cd71fb1172942d23ad7ffe9671f036c8b65..d6055dbeedf2d27ac8e8a9061744302027fcb515 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -287,7 +287,7 @@ GMQCC_IND_STRING(GMQCC_VERSION_PATCH) \
 /*===================================================================*/
 /*=========================== stat.c ================================*/
 /*===================================================================*/
 /*===================================================================*/
 /*=========================== 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 *);
 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);
 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
 
 /*
  * String functions (formatting, copying, concatenating, errors). These are wrapped
@@ -373,7 +373,7 @@ typedef struct trie_s {
     struct trie_s *entries;
 } correct_trie_t;
 
     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;
 
 typedef struct hash_table_t {
     size_t                size;
@@ -763,17 +763,17 @@ enum {
     LVL_ERROR
 };
 
     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_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);
 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 /********/ 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 =============================*/
 
 /*===================================================================*/
 /*========================= assembler.c =============================*/
@@ -995,8 +995,7 @@ qcint             prog_tempstring(qc_program *prog, const char *_str);
 /*===================== parser.c commandline ========================*/
 /*===================================================================*/
 struct parser_s;
 /*===================== 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 *);
 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;
 /*====================== 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);
 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_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
 
 enum {
 # define GMQCC_TYPE_FLAGS
index 81af620c18a7f8e4966a94e0c8c3dad33ce88340..00464aaa5da1a64fb6be63bd318a16959c1c619d 100644 (file)
--- a/intrin.h
+++ b/intrin.h
@@ -36,7 +36,7 @@ typedef struct {
     const char       *alias;
 } intrin_t;
 
     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);
     static ht intrinsics = NULL;
     if (!intrinsics)
         intrinsics = util_htnew(PARSER_HT_SIZE);
diff --git a/main.c b/main.c
index cbcadf10260a317ceaf96d693f9c254740069e2f..37638e92ae4fb8b0202116f596d48e3d1d27e127 100644 (file)
--- a/main.c
+++ b/main.c
@@ -50,7 +50,7 @@ static ppitem  *ppems = NULL;
 
 static const char *app_name;
 
 
 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,
     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"
     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 4cfa79c9eb13fd900e2cf5935db8fb253169a42c..e6ca420bb4a0b18ca41a1be97b12e237fc4f333b 100644 (file)
--- a/opts.c
+++ b/opts.c
@@ -30,7 +30,7 @@
 unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS];
 opts_cmd_t   opts; /* command lien options */
 
 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;
 
     memset(&opts, 0, sizeof(opts_cmd_t));
     OPTS_OPTION_BOOL(OPTION_CORRECTION) = true;
 
diff --git a/stat.c b/stat.c
index 1bfba84bbb0762586cd8b0a78d9962f68aecca41..3f342d0ce66b0e792836f99da58a266f1ccc437a 100644 (file)
--- 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.
  */
  * 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*)
     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",
     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\
     con_out("Memory information:\n\
     Total allocations:   %llu\n\
     Total deallocations: %llu\n\
diff --git a/util.c b/util.c
index 5e234ae4c749d915742d8f7fe22db01765930f2b..efed22177948bb1fbcf53a78d796ecd76eb3fc1b 100644 (file)
--- 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 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:
     /*
      * The loop has been unrolled here: the original paper and implemenation
      * Called for the following code: