aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2019-01-11 00:34:38 +0800
committerruki <waruqi@gmail.com>2019-01-10 21:27:49 +0800
commit555f6037018772e1397b503235b3f2c038bff971 (patch)
tree9783e244047245a40c5b89345208a20e293984c5
parent57b274c8a98f71729e5efbf3ce6349b6796a66f9 (diff)
downloadxmake-docs-555f6037018772e1397b503235b3f2c038bff971.tar.gz
xmake-docs-555f6037018772e1397b503235b3f2c038bff971.zip
update add_cxxsnippet
-rw-r--r--manual.md4
-rw-r--r--zh/manual.md4
2 files changed, 6 insertions, 2 deletions
diff --git a/manual.md b/manual.md
index 4867bebf..f471f47e 100644
--- a/manual.md
+++ b/manual.md
@@ -3388,9 +3388,11 @@ target("test")
```lua
option("constexpr")
- add_cxxsnippet("constexpr int f(int x) { int sum=0; for (int i=0; i<=x; ++i) sum += i; return sum; } constexpr int x = f(5); static_assert(x == 15);")
+ add_cxxsnippet("constexpr", "constexpr int f(int x) { int sum=0; for (int i=0; i<=x; ++i) sum += i; return sum; } constexpr int x = f(5); static_assert(x == 15);")
```
+第一个参数设置代码片段的名字作为标示,检测输出信息时候会有显示。
+
上述代码,实现对c++的constexpr特性的检测,如果检测通过,则启用constexpr选项,当然这里只是个例子。
对于编译器特性的检测,有更加方便高效的检测模块,提供更强大的检测支持,具体见:[compiler.has_features](#compiler-has_features)和[detect.check_cxsnippets](#detect-check_cxsnippets)
diff --git a/zh/manual.md b/zh/manual.md
index 90d4365b..427c8c43 100644
--- a/zh/manual.md
+++ b/zh/manual.md
@@ -3409,9 +3409,11 @@ target("test")
```lua
option("constexpr")
- add_cxxsnippet("constexpr int f(int x) { int sum=0; for (int i=0; i<=x; ++i) sum += i; return sum; } constexpr int x = f(5); static_assert(x == 15);")
+ add_cxxsnippet("constexpr", "constexpr int f(int x) { int sum=0; for (int i=0; i<=x; ++i) sum += i; return sum; } constexpr int x = f(5); static_assert(x == 15);")
```
+第一个参数设置代码片段的名字作为标示,检测输出信息时候会有显示。
+
上述代码,实现对c++的constexpr特性的检测,如果检测通过,则启用constexpr选项,当然这里只是个例子。
对于编译器特性的检测,有更加方便高效的检测模块,提供更强大的检测支持,具体见:[compiler.has_features](#compiler-has_features)和[detect.check_cxsnippets](#detect-check_cxsnippets)