aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-11-21 20:10:58 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2020-11-21 20:10:58 +0200
commitd757b897c5b6f06e58630691e68b7717004c3af7 (patch)
treeeb71af69692ad3ceebdf93a6b87af6537b588dc5
parentb5df58ab12e4ef665100088b4d1f05351fa665d3 (diff)
downloadmeson-d757b897c5b6f06e58630691e68b7717004c3af7.zip
meson-d757b897c5b6f06e58630691e68b7717004c3af7.tar.gz
meson-d757b897c5b6f06e58630691e68b7717004c3af7.tar.bz2
Create unit test for C++ modules and accept ixx as C++ source extension.
-rw-r--r--mesonbuild/compilers/compilers.py2
-rw-r--r--test cases/unit/87 cpp modules/main.cpp7
-rw-r--r--test cases/unit/87 cpp modules/meson.build17
-rw-r--r--test cases/unit/87 cpp modules/src0.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src1.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src2.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src3.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src4.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src5.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src6.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src7.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src8.ixx7
-rw-r--r--test cases/unit/87 cpp modules/src9.ixx5
13 files changed, 93 insertions, 1 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 4e9b86b..e139c49 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -55,7 +55,7 @@ lib_suffixes = ('a', 'lib', 'dll', 'dll.a', 'dylib', 'so') # type: T.Tuple[str,
# This means we can't include .h headers here since they could be C, C++, ObjC, etc.
lang_suffixes = {
'c': ('c',),
- 'cpp': ('cpp', 'cc', 'cxx', 'c++', 'hh', 'hpp', 'ipp', 'hxx', 'ino'),
+ 'cpp': ('cpp', 'cc', 'cxx', 'c++', 'hh', 'hpp', 'ipp', 'hxx', 'ino', 'ixx'),
'cuda': ('cu',),
# f90, f95, f03, f08 are for free-form fortran ('f90' recommended)
# f, for, ftn, fpp are for fixed-form fortran ('f' or 'for' recommended)
diff --git a/test cases/unit/87 cpp modules/main.cpp b/test cases/unit/87 cpp modules/main.cpp
new file mode 100644
index 0000000..d825c7d
--- /dev/null
+++ b/test cases/unit/87 cpp modules/main.cpp
@@ -0,0 +1,7 @@
+import M0;
+#include<cstdio>
+
+int main() {
+ printf("The value is %d", func0());
+ return 0;
+}
diff --git a/test cases/unit/87 cpp modules/meson.build b/test cases/unit/87 cpp modules/meson.build
new file mode 100644
index 0000000..cdc296f
--- /dev/null
+++ b/test cases/unit/87 cpp modules/meson.build
@@ -0,0 +1,17 @@
+project('cppmodules', 'cpp', default_options: ['cpp_std=c++latest'])
+
+e = executable('modtest',
+ 'main.cpp',
+ 'src0.ixx',
+ 'src1.ixx',
+ 'src2.ixx',
+ 'src3.ixx',
+ 'src4.ixx',
+ 'src5.ixx',
+ 'src6.ixx',
+ 'src7.ixx',
+ 'src8.ixx',
+ 'src9.ixx',
+ )
+
+test('modtest', e)
diff --git a/test cases/unit/87 cpp modules/src0.ixx b/test cases/unit/87 cpp modules/src0.ixx
new file mode 100644
index 0000000..3ca4d14
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src0.ixx
@@ -0,0 +1,7 @@
+export module M0;
+
+import M1;
+
+export int func0() {
+ return func1();
+}
diff --git a/test cases/unit/87 cpp modules/src1.ixx b/test cases/unit/87 cpp modules/src1.ixx
new file mode 100644
index 0000000..cea6696
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src1.ixx
@@ -0,0 +1,7 @@
+export module M1;
+
+import M2;
+
+export int func1() {
+ return func2();
+}
diff --git a/test cases/unit/87 cpp modules/src2.ixx b/test cases/unit/87 cpp modules/src2.ixx
new file mode 100644
index 0000000..415714c
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src2.ixx
@@ -0,0 +1,7 @@
+export module M2;
+
+import M3;
+
+export int func2() {
+ return func3();
+}
diff --git a/test cases/unit/87 cpp modules/src3.ixx b/test cases/unit/87 cpp modules/src3.ixx
new file mode 100644
index 0000000..96f135c
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src3.ixx
@@ -0,0 +1,7 @@
+export module M3;
+
+import M4;
+
+export int func3() {
+ return func4();
+}
diff --git a/test cases/unit/87 cpp modules/src4.ixx b/test cases/unit/87 cpp modules/src4.ixx
new file mode 100644
index 0000000..1ac1a6a
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src4.ixx
@@ -0,0 +1,7 @@
+export module M4;
+
+import M5;
+
+export int func4() {
+ return func5();
+}
diff --git a/test cases/unit/87 cpp modules/src5.ixx b/test cases/unit/87 cpp modules/src5.ixx
new file mode 100644
index 0000000..96cf707
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src5.ixx
@@ -0,0 +1,7 @@
+export module M5;
+
+import M6;
+
+export int func5() {
+ return func6();
+}
diff --git a/test cases/unit/87 cpp modules/src6.ixx b/test cases/unit/87 cpp modules/src6.ixx
new file mode 100644
index 0000000..760b71c
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src6.ixx
@@ -0,0 +1,7 @@
+export module M6;
+
+import M7;
+
+export int func6() {
+ return func7();
+}
diff --git a/test cases/unit/87 cpp modules/src7.ixx b/test cases/unit/87 cpp modules/src7.ixx
new file mode 100644
index 0000000..8ce6608
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src7.ixx
@@ -0,0 +1,7 @@
+export module M7;
+
+import M8;
+
+export int func7() {
+ return func8();
+}
diff --git a/test cases/unit/87 cpp modules/src8.ixx b/test cases/unit/87 cpp modules/src8.ixx
new file mode 100644
index 0000000..6a3ef96
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src8.ixx
@@ -0,0 +1,7 @@
+export module M8;
+
+import M9;
+
+export int func8() {
+ return func9();
+}
diff --git a/test cases/unit/87 cpp modules/src9.ixx b/test cases/unit/87 cpp modules/src9.ixx
new file mode 100644
index 0000000..3ecb3be
--- /dev/null
+++ b/test cases/unit/87 cpp modules/src9.ixx
@@ -0,0 +1,5 @@
+export module M9;
+
+export int func9() {
+ return 42;
+}