From 463426ad47b15c9ae6ac38df0fc308477e3b2ccf Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Sun, 25 May 2014 02:27:02 -0400 Subject: [PATCH] Some fixes --- BSDmakefile | 2 -- Makefile | 3 +-- exec.c | 4 ++-- include.mk | 15 +++++++++++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/BSDmakefile b/BSDmakefile index 584c2f1..b34cb1e 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -11,8 +11,6 @@ GITINFO := GITINFO != git describe --always .endif -CFLAGS += -Wall -Wextra -Werror -Wstrict-aliasing -Wno-attributes - .if $(CC) == clang CFLAGS += -Weverything\ -Wno-padded\ diff --git a/Makefile b/Makefile index 6f8eb9a..f6a21ff 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,7 @@ UNAME ?= $(shell uname) CYGWIN = $(findstring CYGWIN, $(UNAME)) MINGW = $(findstring MINGW, $(UNAME)) -CFLAGS += -Wall -Wextra -Werror -Wstrict-aliasing -Wno-attributes -O3 -#turn on tons of warnings if clang is present +# turn on tons of warnings if clang is present # but also turn off the STUPID ONES ifeq ($(CC), clang) CFLAGS += \ diff --git a/exec.c b/exec.c index 29a04a3..3c36e11 100644 --- a/exec.c +++ b/exec.c @@ -912,7 +912,7 @@ static void prog_main_setparams(qc_program_t *prog) { } } -void prog_disasm_function(qc_program_t *prog, size_t id); +static void prog_disasm_function(qc_program_t *prog, size_t id); int main(int argc, char **argv) { size_t i; @@ -1227,7 +1227,7 @@ int main(int argc, char **argv) { return 0; } -void prog_disasm_function(qc_program_t *prog, size_t id) { +static void prog_disasm_function(qc_program_t *prog, size_t id) { prog_section_function_t *fdef = prog->functions + id; prog_section_statement_t *st; diff --git a/include.mk b/include.mk index 23c3fb9..081ce3b 100644 --- a/include.mk +++ b/include.mk @@ -5,6 +5,9 @@ BINDIR := $(PREFIX)/bin DATADIR := $(PREFIX)/share MANDIR := $(DATADIR)/man +# default flags +CFLAGS += -Wall -Wextra -Werror -Wstrict-aliasing -Wno-attributes -O2 + # compiler CC ?= clang @@ -101,7 +104,12 @@ SPLINTFLAGS = \ -observertrans \ -abstract \ -statictrans \ - -castfcnptr + -castfcnptr \ + -shiftimplementation \ + -shiftnegative \ + -boolcompare \ + -infloops \ + -sysunrecog #always the right rule default: all @@ -118,13 +126,16 @@ uninstall: #style rule STYLE_MATCH = \( -name '*.[ch]' -or -name '*.def' -or -name '*.qc' \) +# splint cannot parse the MSVC source +SPLINT_MATCH = \( -name '*.[ch]' -and ! -name 'msvc.c' -and ! -path './doc/*' \) + style: find . -type f $(STYLE_MATCH) -exec sed -i 's/ *$$//' '{}' ';' find . -type f $(STYLE_MATCH) -exec sed -i -e '$$a\' '{}' ';' find . -type f $(STYLE_MATCH) -exec sed -i 's/\t/ /g' '{}' ';' splint: - @splint $(SPLINTFLAGS) *.c *.h + @splint $(SPLINTFLAGS) `find . -type f $(SPLINT_MATCH)` gource: @gource $(GOURCEFLAGS) -- 2.39.2