summaryrefslogtreecommitdiff
path: root/build2/cxx-modules/modtest/foo
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-09-28 18:03:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-09-28 18:03:28 +0200
commit297bc80eab5128e1cde7cd597368109a033b6cc0 (patch)
tree251806183b14a8b643b2bfe1c934c73022c90628 /build2/cxx-modules/modtest/foo
parenta00f98381c708fbba986844762368be3d0e20a6f (diff)
Update idea: C++ modules support
Add module test for Clang and VC
Diffstat (limited to 'build2/cxx-modules/modtest/foo')
-rw-r--r--build2/cxx-modules/modtest/foo54
1 files changed, 54 insertions, 0 deletions
diff --git a/build2/cxx-modules/modtest/foo b/build2/cxx-modules/modtest/foo
new file mode 100644
index 0000000..620816b
--- /dev/null
+++ b/build2/cxx-modules/modtest/foo
@@ -0,0 +1,54 @@
+// file : foo -*- C++ -*-
+// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+// #include <string>
+
+// Define foo module interface.
+//
+// For VC must be included only into module implementation (foo.cxx). The
+// module should be imported into consumer file (with the import declaration).
+//
+// For CLang must be #included into both module implementation and consumer
+// files.
+//
+
+#if defined(MODTEST_USE_MODULES) && defined(_MSC_VER)
+module foo;
+export
+{
+#endif
+
+// Required by macro isolation test.
+//
+#ifdef MODTEST_MACRO
+# undef MODTEST_MACRO
+#endif
+
+#define MODTEST_MACRO 1
+
+int
+foo_value (int v);
+
+struct foo
+{
+ explicit foo (int v);
+
+ int
+ value ();
+
+ int
+ macro ();
+
+// std::string
+// message (const char* s) const;
+
+private:
+ int v_;
+};
+
+// Close module export declaration.
+//
+#if defined(MODTEST_USE_MODULES) && defined(_MSC_VER)
+}
+#endif