aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-05-05 16:53:45 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-05-05 17:37:07 +0530
commit2b8196a1c8793fbdd4a41477d77be3fcd0e8287e (patch)
tree6819ff41896cbb789fae5da1b785fc426e18a1c4
parentf14684c5cb2241665e9ea152f842632b70f4296b (diff)
downloadmeson-2b8196a1c8793fbdd4a41477d77be3fcd0e8287e.zip
meson-2b8196a1c8793fbdd4a41477d77be3fcd0e8287e.tar.gz
meson-2b8196a1c8793fbdd4a41477d77be3fcd0e8287e.tar.bz2
tests/common/140: Add a test for PR #1738
The bug is only encountered with headers in the default compiler search path, so use zlib.h since that is commonly available. See: https://github.com/mesonbuild/meson/issues/1726
-rw-r--r--test cases/common/140 get define/meson.build9
1 files changed, 9 insertions, 0 deletions
diff --git a/test cases/common/140 get define/meson.build b/test cases/common/140 get define/meson.build
index 339e37a..9342340 100644
--- a/test cases/common/140 get define/meson.build
+++ b/test cases/common/140 get define/meson.build
@@ -20,6 +20,15 @@ foreach lang : ['c', 'cpp']
error('Please report a bug and help us improve support for this platform')
endif
+ if cc.find_library('z', required : false).found()
+ # When a C file containing #include <foo.h> is pre-processed and foo.h is
+ # found in the compiler's default search path, GCC inserts an extra comment
+ # between the delimiter and the define which causes a parsing error.
+ # https://github.com/mesonbuild/meson/issues/1726
+ ver = cc.get_define('ZLIB_VER_MAJOR', prefix : '#include <zlib.h>')
+ assert(ver == '1', 'ZLIB_VER_MAJOR value is "@0@" instead of "1"'.format(ver))
+ endif
+
# Check that an undefined value is empty.
have = cc.get_define('MESON_FAIL_VALUE')
assert(have == '', 'MESON_FAIL_VALUE value is "@0@" instead of ""'.format(have))