mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 20:10:35 +00:00
Rework some build stuff for better output and to enable strict prototypes
This commit is contained in:
parent
7df42c95d2
commit
a622d5163b
9 changed files with 43 additions and 34 deletions
18
BSDmakefile
18
BSDmakefile
|
@ -10,7 +10,7 @@ GITINFO :=
|
|||
GITINFO != git describe --always
|
||||
.endif
|
||||
|
||||
CFLAGS += -Wall -Wextra -Werror -fno-strict-aliasing -DGMQCC_GITINFO=\"$(GITINFO)\"$(OPTIONAL)
|
||||
CFLAGS += -Wall -Wextra -Werror -Wstrict-aliasing
|
||||
|
||||
.if $(CC) == clang
|
||||
CFLAGS += -Weverything\
|
||||
|
@ -18,19 +18,23 @@ CFLAGS += -Wall -Wextra -Werror -fno-strict-aliasing -DGMQCC_GITINFO=\"$(GITI
|
|||
-Wno-format-nonliteral\
|
||||
-Wno-disabled-macro-expansion\
|
||||
-Wno-conversion\
|
||||
-Wno-missing-prototypes\
|
||||
-Wno-float-equal\
|
||||
-Wno-unknown-warning-option\
|
||||
-Wno-cast-align\
|
||||
-Wstrict-prototypes
|
||||
-pedantic-errors
|
||||
.else
|
||||
. if $(CC) == tcc
|
||||
CFLAGS += -Wstrict-prototypes -pedantic-errors
|
||||
. if $(CC) != g++
|
||||
CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
|
||||
. endif
|
||||
|
||||
. if $(CC) != tcc
|
||||
CFLAGS += -pedantic-errors
|
||||
. else
|
||||
CFLAGS += -Wno-pointer-sign -fno-common
|
||||
. endif
|
||||
.endif
|
||||
|
||||
CFLAGS += -DGMQCC_GITINFO=\"$(GITINFO)\" $(OPTIONAL)
|
||||
DEPS != for i in $(OBJ_C) $(OBJ_P) $(OBJ_T) $(OBJ_X); do echo $$i; done | sort | uniq
|
||||
|
||||
QCVM = qcvm
|
||||
|
@ -40,10 +44,10 @@ PAK = gmqpak
|
|||
|
||||
#standard rules
|
||||
c.o: ${.IMPSRC}
|
||||
$(CC) -c ${.IMPSRC} -o ${.TARGET} $(CPPFLAGS) $(CFLAGS)
|
||||
$(CC) -c ${.IMPSRC} -o ${.TARGET} $(CFLAGS) $(CPPFLAGS)
|
||||
|
||||
exec-standalone.o: exec.c
|
||||
$(CC) -c ${.ALLSRC} -o ${.TARGET} $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
|
||||
$(CC) -c ${.ALLSRC} -o ${.TARGET} $(CFLAGS) $(CPPFLAGS) -DQCVM_EXECUTOR=1
|
||||
|
||||
$(QCVM): $(OBJ_X)
|
||||
$(CC) -o ${.TARGET} ${.IMPSRC} $(LDFLAGS) $(LIBS) $(OBJ_X)
|
||||
|
|
31
Makefile
31
Makefile
|
@ -4,10 +4,7 @@ UNAME ?= $(shell uname)
|
|||
CYGWIN = $(findstring CYGWIN, $(UNAME))
|
||||
MINGW = $(findstring MINGW32, $(UNAME))
|
||||
|
||||
CFLAGS += -O3 -Wall -Wextra -Wstrict-aliasing -Werror $(OPTIONAL)
|
||||
ifneq ($(shell git describe --always 2>/dev/null),)
|
||||
CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
|
||||
endif
|
||||
CFLAGS += -Wall -Wextra -Werror -Wstrict-aliasing
|
||||
#turn on tons of warnings if clang is present
|
||||
# but also turn off the STUPID ONES
|
||||
ifeq ($(CC), clang)
|
||||
|
@ -17,26 +14,30 @@ ifeq ($(CC), clang)
|
|||
-Wno-format-nonliteral \
|
||||
-Wno-disabled-macro-expansion \
|
||||
-Wno-conversion \
|
||||
-Wno-missing-prototypes \
|
||||
-Wno-float-equal \
|
||||
-Wno-unknown-warning-option \
|
||||
-Wno-cast-align \
|
||||
-Wstrict-prototypes
|
||||
-pedantic-errors
|
||||
else
|
||||
#Tiny C Compiler doesn't know what -pedantic-errors is
|
||||
# and instead of ignoring .. just errors.
|
||||
ifneq ($(CC), g++)
|
||||
CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
|
||||
endif
|
||||
|
||||
ifneq ($(CC), tcc)
|
||||
CFLAGS += -pedantic-errors
|
||||
else
|
||||
CFLAGS += -Wno-pointer-sign -fno-common
|
||||
endif
|
||||
|
||||
#-Wstrict-prototypes is not valid in g++
|
||||
ifneq ($(CC), g++)
|
||||
CFLAGS += -Wstrict-prototypes
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(shell git describe --always 2>/dev/null),)
|
||||
CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
|
||||
endif
|
||||
|
||||
# do this last otherwise there is whitespace in the command output and
|
||||
# it makes my OCD act up
|
||||
CFLAGS += $(OPTIONAL)
|
||||
|
||||
#we have duplicate object files when dealing with creating a simple list
|
||||
#for dependinces. To combat this we use some clever recrusive-make to
|
||||
#filter the list and remove duplicates which we use for make depend
|
||||
|
@ -76,10 +77,10 @@ endif
|
|||
|
||||
#standard rules
|
||||
%.o: %.c
|
||||
$(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
|
||||
$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
|
||||
|
||||
exec-standalone.o: exec.c
|
||||
$(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
|
||||
$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) -DQCVM_EXECUTOR=1
|
||||
|
||||
$(QCVM): $(OBJ_X)
|
||||
$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
|
||||
|
|
4
code.c
4
code.c
|
@ -256,7 +256,8 @@ static void code_stats(const char *filename, const char *lnofile, code_t *code,
|
|||
* directly out to allocated memory. Which is actually very useful for the future library support
|
||||
* we're going to add.
|
||||
*/
|
||||
bool code_write_memory(code_t *code, uint8_t **datmem, size_t *sizedat, uint8_t **lnomem, size_t *sizelno) {
|
||||
#if 0
|
||||
static bool code_write_memory(code_t *code, uint8_t **datmem, size_t *sizedat, uint8_t **lnomem, size_t *sizelno) GMQCC_UNUSED {
|
||||
prog_header_t code_header;
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
@ -319,6 +320,7 @@ bool code_write_memory(code_t *code, uint8_t **datmem, size_t *sizedat, uint8_t
|
|||
code_stats("<<memory>>", (lnomem) ? "<<memory>>" : NULL, code, &code_header);
|
||||
return true;
|
||||
}
|
||||
#endif /*!#if 0 reenable when ready to be used */
|
||||
#undef WRITE_CHUNK
|
||||
|
||||
bool code_write(code_t *code, const char *filename, const char *lnofile) {
|
||||
|
|
6
exec.c
6
exec.c
|
@ -206,7 +206,7 @@ qcany_t* prog_getedict(qc_program_t *prog, qcint_t e) {
|
|||
return (qcany_t*)(prog->entitydata + (prog->entityfields * e));
|
||||
}
|
||||
|
||||
qcint_t prog_spawn_entity(qc_program_t *prog) {
|
||||
static qcint_t prog_spawn_entity(qc_program_t *prog) {
|
||||
char *data;
|
||||
qcint_t e;
|
||||
for (e = 0; e < (qcint_t)vec_size(prog->entitypool); ++e) {
|
||||
|
@ -223,7 +223,7 @@ qcint_t prog_spawn_entity(qc_program_t *prog) {
|
|||
return e;
|
||||
}
|
||||
|
||||
void prog_free_entity(qc_program_t *prog, qcint_t e) {
|
||||
static void prog_free_entity(qc_program_t *prog, qcint_t e) {
|
||||
if (!e) {
|
||||
prog->vmerror++;
|
||||
fprintf(stderr, "Trying to free world entity\n");
|
||||
|
@ -903,7 +903,7 @@ static void prog_main_setparams(qc_program_t *prog) {
|
|||
}
|
||||
}
|
||||
|
||||
void escapestring(char* dest, const char* src) {
|
||||
static void escapestring(char* dest, const char* src) {
|
||||
char c;
|
||||
while ((c = *(src++))) {
|
||||
switch(c) {
|
||||
|
|
6
fold.c
6
fold.c
|
@ -483,7 +483,7 @@ static GMQCC_INLINE ast_expression *fold_op_rshift(fold_t *fold, ast_value *a, a
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static GMQCC_INLINE ast_expression *fold_op_andor(fold_t *fold, ast_value *a, ast_value *b, float or) {
|
||||
static GMQCC_INLINE ast_expression *fold_op_andor(fold_t *fold, ast_value *a, ast_value *b, float expr) {
|
||||
if (fold_can_2(a, b)) {
|
||||
if (OPTS_FLAG(PERL_LOGIC)) {
|
||||
if (fold_immediate_true(fold, a))
|
||||
|
@ -491,8 +491,8 @@ static GMQCC_INLINE ast_expression *fold_op_andor(fold_t *fold, ast_value *a, as
|
|||
} else {
|
||||
return fold_constgen_float (
|
||||
fold,
|
||||
((or) ? (fold_immediate_true(fold, a) || fold_immediate_true(fold, b))
|
||||
: (fold_immediate_true(fold, a) && fold_immediate_true(fold, b)))
|
||||
((expr) ? (fold_immediate_true(fold, a) || fold_immediate_true(fold, b))
|
||||
: (fold_immediate_true(fold, a) && fold_immediate_true(fold, b)))
|
||||
? 1
|
||||
: 0
|
||||
);
|
||||
|
|
1
ftepp.c
1
ftepp.c
|
@ -226,6 +226,7 @@ static GMQCC_INLINE int ftepp_predef_index(const char *name) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool ftepp_predef_exists(const char *name);
|
||||
bool ftepp_predef_exists(const char *name) {
|
||||
return ftepp_predef_index(name) != -1;
|
||||
}
|
||||
|
|
4
pak.c
4
pak.c
|
@ -396,7 +396,8 @@ err:
|
|||
* Like pak_insert_one, except this collects files in all directories
|
||||
* from a root directory, and inserts them all.
|
||||
*/
|
||||
bool pak_insert_all(pak_file_t *pak, const char *dir) {
|
||||
#if 0
|
||||
static bool pak_insert_all(pak_file_t *pak, const char *dir) {
|
||||
DIR *dp;
|
||||
struct dirent *dirp;
|
||||
|
||||
|
@ -416,6 +417,7 @@ bool pak_insert_all(pak_file_t *pak, const char *dir) {
|
|||
fs_dir_close(dp);
|
||||
return true;
|
||||
}
|
||||
#endif /*!if 0 renable when ready to use */
|
||||
|
||||
static bool pak_close(pak_file_t *pak) {
|
||||
size_t itr;
|
||||
|
|
5
parser.c
5
parser.c
|
@ -1448,8 +1448,7 @@ static ast_expression* parse_vararg(parser_t *parser)
|
|||
}
|
||||
|
||||
/* not to be exposed */
|
||||
extern bool ftepp_predef_exists(const char *name);
|
||||
|
||||
bool ftepp_predef_exists(const char *name);
|
||||
static bool parse_sya_operand(parser_t *parser, shunt *sy, bool with_labels)
|
||||
{
|
||||
if (OPTS_FLAG(TRANSLATABLE_STRINGS) &&
|
||||
|
@ -5430,7 +5429,7 @@ skipvar:
|
|||
parseerror(parser, "error parsing break definition");
|
||||
break;
|
||||
}
|
||||
(void)!!parsewarning(parser, WARN_BREAKDEF, "break definition ignored (suggest removing it)");
|
||||
(void)!parsewarning(parser, WARN_BREAKDEF, "break definition ignored (suggest removing it)");
|
||||
} else {
|
||||
parseerror(parser, "missing semicolon or initializer, got: `%s`", parser_tokval(parser));
|
||||
break;
|
||||
|
|
2
stat.c
2
stat.c
|
@ -206,7 +206,6 @@ void *stat_mem_reallocate(void *ptr, size_t size, size_t line, const char *file)
|
|||
stat_mem_peak = stat_mem_high;
|
||||
|
||||
free(oldinfo);
|
||||
|
||||
return newinfo + 1;
|
||||
}
|
||||
|
||||
|
@ -514,6 +513,7 @@ void *util_htget(hash_table_t *ht, const char *key) {
|
|||
return util_htgeth(ht, key, util_hthash(ht, key));
|
||||
}
|
||||
|
||||
void *code_util_str_htgeth(hash_table_t *ht, const char *key, size_t bin);
|
||||
void *code_util_str_htgeth(hash_table_t *ht, const char *key, size_t bin) {
|
||||
hash_node_t *pair;
|
||||
size_t len, keylen;
|
||||
|
|
Loading…
Reference in a new issue