From e048bed13dc9cee444acad45cfa96f89a6f33ac2 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sun, 2 Nov 2014 00:16:48 +0100 Subject: [PATCH] More tests for the Waf preprocessor --- ChangeLog | 2 +- tests/preproc/recursion/a.c | 6 ++++++ tests/preproc/recursion/a.h | 8 ++++++++ tests/preproc/recursion/b.h | 1 + tests/preproc/recursion/c.h | 3 +++ tests/preproc/wscript | 17 +++++++++++++++++ waf-light | 2 +- waflib/Context.py | 6 +++--- wscript | 2 +- 9 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 tests/preproc/recursion/a.c create mode 100644 tests/preproc/recursion/a.h create mode 100644 tests/preproc/recursion/b.h create mode 100644 tests/preproc/recursion/c.h diff --git a/ChangeLog b/ChangeLog index 31096208..8a1037c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -NEW IN WAF 1.8.3 +NEW IN WAF 1.8.4 ---------------- * Various improvements in stale.py * More robust file scanning in Qt processing #1502 diff --git a/tests/preproc/recursion/a.c b/tests/preproc/recursion/a.c new file mode 100644 index 00000000..3a9c9f79 --- /dev/null +++ b/tests/preproc/recursion/a.c @@ -0,0 +1,6 @@ +#include "a.h" + +int main() { + return 0; +} + diff --git a/tests/preproc/recursion/a.h b/tests/preproc/recursion/a.h new file mode 100644 index 00000000..f3e46db3 --- /dev/null +++ b/tests/preproc/recursion/a.h @@ -0,0 +1,8 @@ +#ifdef FOO +#include "c.h" +#endif + +#ifdef BAR +#include "b.h" +#endif + diff --git a/tests/preproc/recursion/b.h b/tests/preproc/recursion/b.h new file mode 100644 index 00000000..f40c757c --- /dev/null +++ b/tests/preproc/recursion/b.h @@ -0,0 +1 @@ +#include "c.h" diff --git a/tests/preproc/recursion/c.h b/tests/preproc/recursion/c.h new file mode 100644 index 00000000..9c974ec9 --- /dev/null +++ b/tests/preproc/recursion/c.h @@ -0,0 +1,3 @@ +#undef FOO +#undef BAR +#include "a.h" diff --git a/tests/preproc/wscript b/tests/preproc/wscript index 4f886588..b7d794de 100644 --- a/tests/preproc/wscript +++ b/tests/preproc/wscript @@ -171,6 +171,23 @@ def build(bld): test('a&&b&&c&&d', 0) test('e', 1) + def test_rec(defines, expected): + main = bld.path.find_resource('recursion/a.c') + bld.env.DEFINES = defines.split() + gruik = c_preproc.c_parser([main.parent]) + gruik.start(main, bld.env) + result = "".join([x.name[0] for x in gruik.nodes]) + if result == expected: + color = "GREEN" + else: + color = "RED" + pprint(color, "%s\t\t%r" % (expected, gruik.nodes)) + + test_rec("", "a") + test_rec("FOO=1", "aca") + test_rec("BAR=1", "abca") + test_rec("FOO=1 BAR=1", "aca") + return test("1?1,(0?5:9):3,4", 0) # <- invalid expression diff --git a/waf-light b/waf-light index 264e6e3f..022f0252 100755 --- a/waf-light +++ b/waf-light @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. import os, sys, inspect -VERSION="1.8.3" +VERSION="1.8.4" REVISION="x" INSTALL="x" C1='x' diff --git a/waflib/Context.py b/waflib/Context.py index 7e8d06b9..941a75b2 100644 --- a/waflib/Context.py +++ b/waflib/Context.py @@ -11,13 +11,13 @@ from waflib import Utils, Errors, Logs import waflib.Node # the following 3 constants are updated on each new release (do not touch) -HEXVERSION=0x1080300 +HEXVERSION=0x1080400 """Constant updated on new releases""" -WAFVERSION="1.8.3" +WAFVERSION="1.8.4" """Constant updated on new releases""" -WAFREVISION="2fa4078c47451df99ba831a98ab6c28a7ee36ae2" +WAFREVISION="67a5bb5c730ba3abebccdbe64a4f509d92f33b9e" """Constant updated on new releases""" ABI = 98 diff --git a/wscript b/wscript index 44dbe773..eb4bd596 100644 --- a/wscript +++ b/wscript @@ -10,7 +10,7 @@ To add a tool that does not exist in the folder compat15, pass an absolute path: """ -VERSION="1.8.3" +VERSION="1.8.4" APPNAME='waf' REVISION=''