Strict prototyping

This commit is contained in:
Dale Weiler 2013-06-06 02:51:13 +00:00
parent 4f02d4b556
commit 144672fada
10 changed files with 30 additions and 30 deletions

View file

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

View file

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

4
exec.c
View file

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

View file

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

31
gmqcc.h
View file

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

View file

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

4
main.c
View file

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

2
opts.c
View file

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

6
stat.c
View file

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

2
util.c
View file

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