mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 14:21:36 +00:00
Make it compile with -Wall and -pedantic
This commit is contained in:
parent
af2324e922
commit
b5507b3127
5 changed files with 22 additions and 17 deletions
3
Makefile
3
Makefile
|
@ -3,12 +3,11 @@ PREFIX := /usr/local
|
|||
BINDIR := $(PREFIX)/bin
|
||||
|
||||
CC ?= clang
|
||||
CFLAGS += -Wall -I.
|
||||
CFLAGS += -Wall -I. -Wall -pedantic
|
||||
#turn on tons of warnings if clang is present
|
||||
ifeq ($(CC), clang)
|
||||
CFLAGS += \
|
||||
-Weverything \
|
||||
-Wno-missing-prototypes \
|
||||
-Wno-padded \
|
||||
-Wno-format-nonliteral \
|
||||
-Wno-disabled-macro-expansion \
|
||||
|
|
2
con.c
2
con.c
|
@ -281,7 +281,7 @@ int con_change(const char *out, const char *err) {
|
|||
con_enablecolor();
|
||||
} else if (!(console.handle_err = fopen(err, "w"))) return 0;
|
||||
|
||||
// no buffering
|
||||
/* no buffering */
|
||||
setvbuf(console.handle_out, NULL, _IONBF, 0);
|
||||
setvbuf(console.handle_err, NULL, _IONBF, 0);
|
||||
|
||||
|
|
3
ftepp.c
3
ftepp.c
|
@ -134,8 +134,9 @@ static void pptoken_delete(pptoken *self)
|
|||
|
||||
static ppmacro *ppmacro_new(lex_ctx ctx, const char *name)
|
||||
{
|
||||
(void)ctx;
|
||||
ppmacro *macro = (ppmacro*)mem_a(sizeof(ppmacro));
|
||||
|
||||
(void)ctx;
|
||||
memset(macro, 0, sizeof(*macro));
|
||||
macro->name = util_strdup(name);
|
||||
return macro;
|
||||
|
|
10
parser.c
10
parser.c
|
@ -2485,10 +2485,11 @@ static ast_expression *array_setter_node(parser_t *parser, ast_value *array, ast
|
|||
lex_ctx ctx = ast_ctx(array);
|
||||
|
||||
if (from+1 == afterend) {
|
||||
// set this value
|
||||
/* set this value */
|
||||
ast_block *block;
|
||||
ast_return *ret;
|
||||
ast_array_index *subscript;
|
||||
ast_store *st;
|
||||
int assignop = type_store_instr[value->expression.vtype];
|
||||
|
||||
if (value->expression.vtype == TYPE_FIELD && value->expression.next->expression.vtype == TYPE_VECTOR)
|
||||
|
@ -2498,7 +2499,7 @@ static ast_expression *array_setter_node(parser_t *parser, ast_value *array, ast
|
|||
if (!subscript)
|
||||
return NULL;
|
||||
|
||||
ast_store *st = ast_store_new(ctx, assignop, (ast_expression*)subscript, (ast_expression*)value);
|
||||
st = ast_store_new(ctx, assignop, (ast_expression*)subscript, (ast_expression*)value);
|
||||
if (!st) {
|
||||
ast_delete(subscript);
|
||||
return NULL;
|
||||
|
@ -2543,11 +2544,12 @@ static ast_expression *array_field_setter_node(
|
|||
lex_ctx ctx = ast_ctx(array);
|
||||
|
||||
if (from+1 == afterend) {
|
||||
// set this value
|
||||
/* set this value */
|
||||
ast_block *block;
|
||||
ast_return *ret;
|
||||
ast_entfield *entfield;
|
||||
ast_array_index *subscript;
|
||||
ast_store *st;
|
||||
int assignop = type_storep_instr[value->expression.vtype];
|
||||
|
||||
if (value->expression.vtype == TYPE_FIELD && value->expression.next->expression.vtype == TYPE_VECTOR)
|
||||
|
@ -2566,7 +2568,7 @@ static ast_expression *array_field_setter_node(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ast_store *st = ast_store_new(ctx, assignop, (ast_expression*)entfield, (ast_expression*)value);
|
||||
st = ast_store_new(ctx, assignop, (ast_expression*)entfield, (ast_expression*)value);
|
||||
if (!st) {
|
||||
ast_delete(entfield);
|
||||
return NULL;
|
||||
|
|
21
util.c
21
util.c
|
@ -498,11 +498,23 @@ size_t util_strtononcmd(const char *in, char *out, size_t outsz) {
|
|||
*out = *in + 'a' - 'A';
|
||||
else
|
||||
*out = *in;
|
||||
|
||||
*out = (isalpha(*in) && isupper(*in)) ? *in + 'a' - 'A' : *in;
|
||||
}
|
||||
*out = 0;
|
||||
return sz-1;
|
||||
}
|
||||
|
||||
|
||||
bool util_filexists(const char *file) {
|
||||
FILE *fp = fopen(file, "rb");
|
||||
if (!fp) return false;
|
||||
|
||||
/* it exists */
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
FILE *util_fopen(const char *filename, const char *mode)
|
||||
{
|
||||
#ifdef WIN32
|
||||
|
@ -515,15 +527,6 @@ FILE *util_fopen(const char *filename, const char *mode)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool util_filexists(const char *file) {
|
||||
FILE *fp = fopen(file, "rb");
|
||||
if (!fp) return false;
|
||||
|
||||
/* it exists */
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
void _util_vec_grow(void **a, size_t i, size_t s) {
|
||||
size_t m = *a ? 2*_vec_beg(*a)+i : i+1;
|
||||
void *p = mem_r((*a ? _vec_raw(*a) : NULL), s * m + sizeof(size_t)*2);
|
||||
|
|
Loading…
Reference in a new issue