summaryrefslogtreecommitdiff
path: root/tools/build/feature/test-cxx.cpp
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-09-26 07:26:56 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-05 19:59:35 -0300
commit87095f7ddeff3038a0cf8e6574922f9c11688619 (patch)
tree73eb2890678d20f32da70d5f373612e03bd6e509 /tools/build/feature/test-cxx.cpp
parentf61bdc3304281e9ff9eec4f1ed9fb15bcf4d8a5e (diff)
tools build: Add feature detection for g++
Check if g++ is available. The result will be used by builtin clang and LLVM support. Since LLVM requires C++11, this feature detector checks std::move(). Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Alexei Starovoitov <ast@fb.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1474874832-134786-3-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/build/feature/test-cxx.cpp')
-rw-r--r--tools/build/feature/test-cxx.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/build/feature/test-cxx.cpp b/tools/build/feature/test-cxx.cpp
new file mode 100644
index 000000000000..b1dee9a31d6c
--- /dev/null
+++ b/tools/build/feature/test-cxx.cpp
@@ -0,0 +1,15 @@
+#include <iostream>
+#include <memory>
+
+static void print_str(std::string s)
+{
+ std::cout << s << std::endl;
+}
+
+int main()
+{
+ std::string s("Hello World!");
+ print_str(std::move(s));
+ std::cout << "|" << s << "|" << std::endl;
+ return 0;
+}