diff options
| author | ruki <[email protected]> | 2017-07-06 05:23:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-07-06 05:23:06 +0800 |
| commit | 54dc847355f7cfec14d2f23db253271baf5bf301 (patch) | |
| tree | 09841ba5183c4f89f8186a64cf0776b4c6f1921c /xmake/modules/detect/tools | |
| parent | 5fd1bfd5c5e2d6a8e72f033325a448a76737d738 (diff) | |
add some c features for gcc and clang
Diffstat (limited to 'xmake/modules/detect/tools')
| -rw-r--r-- | xmake/modules/detect/tools/clang/cfeatures.lua | 13 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/gcc/cfeatures.lua | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/xmake/modules/detect/tools/clang/cfeatures.lua b/xmake/modules/detect/tools/clang/cfeatures.lua index ef373f4b0..29a5f6bc2 100644 --- a/xmake/modules/detect/tools/clang/cfeatures.lua +++ b/xmake/modules/detect/tools/clang/cfeatures.lua @@ -36,8 +36,17 @@ function main() -- init features _g.features = cfeatures() - -- TODO - -- set("", "") + -- init conditions + local clang_minver = "((__clang_major__ * 100) + __clang_minor__) >= 304" + local c11 = clang_minver .. " && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L" + local c99 = clang_minver .. " && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L" + local c90 = clang_minver + + -- set features + _set("c_static_assert", c11) + _set("c_restrict", c99) + _set("c_variadic_macros", c99) + _set("c_function_prototypes", c90) -- get features return _g.features diff --git a/xmake/modules/detect/tools/gcc/cfeatures.lua b/xmake/modules/detect/tools/gcc/cfeatures.lua index b6aca4226..ab336cfa8 100644 --- a/xmake/modules/detect/tools/gcc/cfeatures.lua +++ b/xmake/modules/detect/tools/gcc/cfeatures.lua @@ -31,8 +31,17 @@ end -- get features function main() - -- static_assert() - _set("c_static_assert", "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L") + -- init conditions + local gcc_minver = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304" + local gcc46_c11 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L" + local gcc34_c99 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L" + local gcc_c90 = gcc_minver + + -- set features + _set("c_static_assert", gcc46_c11) + _set("c_restrict", gcc34_c99) + _set("c_variadic_macros", gcc34_c99) + _set("c_function_prototypes", gcc_c90) -- get features return _g.features |
