]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Merge branch 'master' into cooking
authorDale Weiler <killfieldengine@gmail.com>
Wed, 24 Apr 2013 01:46:53 +0000 (01:46 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Wed, 24 Apr 2013 01:46:53 +0000 (01:46 +0000)
Makefile
doc/gmqcc.1
misc/check-doc.sh [new file with mode: 0644]
parser.c
tests/noreturn2.tmpl
tests/noreturn3.tmpl

index cd576ba1a88b284b557808a7576110910a5f963f..8f4fb9682c924f292b947302becec9d9acc31ca8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,12 @@ UNAME  ?= $(shell uname)
 CYGWIN  = $(findstring CYGWIN,  $(UNAME))
 MINGW   = $(findstring MINGW32, $(UNAME))
 
-CC     ?= clang
-CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
+CC      ?= clang
+# linker flags and optional additional libraries if required
+LDFLAGS :=
+LIBS    :=
+
+CFLAGS  += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
 ifneq ($(shell git describe --always 2>/dev/null),)
     CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
 endif
@@ -169,22 +173,22 @@ SPLINTFLAGS =            \
 #standard rules
 default: all
 %.o: %.c
-       $(CC) -c $< -o $@ $(CFLAGS)
+       $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
 
 exec-standalone.o: exec.c
-       $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
+       $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
 
 $(QCVM): $(OBJ_X)
-       $(CC) -o $@ $^ $(CFLAGS) -lm
+       $(CC) -o $@ $^ $(LDFLAGS) -lm $(LIBS)
 
 $(GMQCC): $(OBJ_C) $(OBJ_D)
-       $(CC) -o $@ $^ $(CFLAGS) -lm
+       $(CC) -o $@ $^ $(LDFLAGS) -lm $(LIBS)
 
 $(TESTSUITE): $(OBJ_T)
-       $(CC) -o $@ $^ $(CFLAGS) -lm
+       $(CC) -o $@ $^ $(LDFLAGS) -lm $(LIBS)
 
 $(PAK): $(OBJ_P)
-       $(CC) -o $@ $^ $(CFLAGS)
+       $(CC) -o $@ $^ $(LDFLAGS)
 
 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
 
index 59afdb99dd85abc5bce9239c2697ecbe2e968cf0..da79a5bd0415b15165c7b3e4f09d708a38478ecf 100644 (file)
@@ -24,10 +24,6 @@ there are also traditional long-options available.
 .Bl -tag -width Ds
 .It Fl h , Fl -help
 Show a usage message and exit.
-.It Fl "debug"
-Turn on some compiler debugging mechanisms.
-.It Fl memchk
-Turn on compiler mem-check. (Shows allocations and checks for leaks.)
 .It Fl o , Fl -output= Ns Ar filename
 Specify the output filename. Defaults to progs.dat. This will overwrite
 the output file listed in a
@@ -46,7 +42,7 @@ Minimal optimization level
 Disable optimization entirely
 .El
 .Pp
-.It Fl O Ns Ar name Fl Ono- Ns Ar name
+.It Fl O Ns Ar name Fl Ono- Ns Ar name
 Enable or disable a specific optimization. Note that these options
 must be used after setting the optimization level, otherwise they'll
 be overwritten.
@@ -57,6 +53,8 @@ activated at.
 Be less verbose. In particular removes the messages about which files
 are being processed, and which compilation mode is being used, and
 some others. Warnings and errors will of course still be displayed.
+.It Fl D Ns Ar macroname , Fl D Ns Ar macroname Ns = Ns Ar value
+Predefine a macro, optionally with a optional value.
 .It Fl E
 Run only the preprocessor as if
 .Fl f Ns Cm ftepp
@@ -93,6 +91,12 @@ Use an ini file to read all the
 and
 .Fl f
 flag from. See the
+.It Fl "debug"
+Turn on some compiler debugging mechanisms.
+.It Fl memchk
+Turn on compiler mem-check. (Shows allocations and checks for leaks.)
+.It Fl -memdumpcols Ns Ar columns
+Changes the number of columns to use for the debug memory dump, defaults to 16.
 .Sx CONFIG
 section about the file format.
 .It Fl redirout= Ns Ar file
diff --git a/misc/check-doc.sh b/misc/check-doc.sh
new file mode 100644 (file)
index 0000000..73b169a
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+prog=$0
+
+die() {
+       echo "$@"
+       exit 1
+}
+
+want() {
+       test -e "$1" && return
+       echo "$prog: missing $1"
+       echo "$prog: run this script from the top of a gmqcc source tree"
+       exit 1
+}
+
+for i in opts.def          \
+         doc/gmqcc.1       \
+         gmqcc.ini.example
+do want "$i"; done
+
+# y/_ABCDEFGHIJKLMNOPQRSTUVWXYZ/-abcdefghijklmnopqrstuvwxyz/;
+check_opt() {
+       opt_def_name=$1
+       arg_char=$2
+
+       for i in $(sed -ne \
+       '/^#ifdef GMQCC_TYPE_'${opt_def_name}'$/,/^#endif/{
+               /GMQCC_DEFINE_FLAG/{
+                       s/^.*GMQCC_DEFINE_FLAG(\([^,)]*\)[),].*$/\1/;p;
+               }
+       }' opts.def)
+       do
+               opt=$(echo "$i" | tr -- '_A-Z' '-a-z')
+               grep -qF -- ".It Fl "${arg_char}" Ns Cm $opt" \
+                       doc/gmqcc.1 || echo "doc/gmqcc.1: missing: -${arg_char}$opt"
+               grep -q -- "[^a-zA-Z_]$i[^a-zA-Z_]" \
+                       gmqcc.ini.example || echo "gmqcc.ini.example: missing: $i"
+       done
+}
+
+check_opt FLAGS f
+check_opt WARNS W
+check_opt OPTIMIZATIONS O
index c50eb176a9f296160f705e9c3b068a0c39c6ddcc..836f6ca663b82b4e6395b8bbddcc762e43ed992d 100755 (executable)
--- a/parser.c
+++ b/parser.c
@@ -5114,7 +5114,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
     bool      cleanvar  = true;
     bool      wasarray  = false;
 
-    ast_member *me[3];
+    ast_member *me[3] = { NULL, NULL, NULL };
 
     if (!localblock && is_static)
         parseerror(parser, "`static` qualifier is not supported in global scope");
index d328c4f65b79df5c808d414bfb3fcf2d6d162461..6751bf9605a71cebf9bd3994a46aba729c89a6ef 100644 (file)
@@ -1,5 +1,5 @@
 I: noreturn.qc
-D: noreturn keyword - should fail
+D: noreturn keyword - should work
 T: -compile
 C: -std=fteqcc -Wall -Werror -DTEST=2 -DNORETURN=[[noreturn]]
 F: -no-defs
index 653bd8afd4e01ffb42671c3e3e6781a49fb36b6f..1dcf570dcb5a9bed201cf74cba9116cf8ce8d475 100644 (file)
@@ -1,5 +1,5 @@
 I: noreturn.qc
-D: noreturn keyword - should work
+D: noreturn keyword - should fail
 T: -fail
 C: -std=fteqcc -Wall -Werror -DTEST=1 -DNORETURN
 F: -no-defs