summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools/gcc/cfeatures.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-29 23:37:41 +0800
committerruki <[email protected]>2021-09-29 23:37:41 +0800
commit2c906bc87c0140c20509ee2063b64188375225f2 (patch)
tree4c47ac0d606ce270ba93c7305cd2354009ba8876 /xmake/modules/detect/tools/gcc/cfeatures.lua
parentdb6fe6c5fafdac2e719fcfbfc9dbe305ed4cf606 (diff)
improve detect c17
Diffstat (limited to 'xmake/modules/detect/tools/gcc/cfeatures.lua')
-rw-r--r--xmake/modules/detect/tools/gcc/cfeatures.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/gcc/cfeatures.lua b/xmake/modules/detect/tools/gcc/cfeatures.lua
index 9f4ee275b..b9ebaa036 100644
--- a/xmake/modules/detect/tools/gcc/cfeatures.lua
+++ b/xmake/modules/detect/tools/gcc/cfeatures.lua
@@ -29,6 +29,7 @@ function main()
-- init conditions
local gcc_minver = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304"
+ local gcc10_c17 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 1000 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201710L"
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
@@ -37,6 +38,7 @@ function main()
_set("c_std_89", gcc46_c90)
_set("c_std_99", gcc34_c99)
_set("c_std_11", gcc46_c11)
+ _set("c_std_17", gcc46_c17)
-- set features
_set("c_static_assert", gcc46_c11) -- GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it to 201000L