summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-05-05 12:12:46 +0800
committerGitHub <[email protected]>2024-05-05 12:12:46 +0800
commit382b22c3d6ec529bf085aaa7498c39dd83758e69 (patch)
tree35d1f72ef8e81de1b1041d73755198394c3c80ad
parent57a6b50a9ff4b87360b0147fab067ee806ebf587 (diff)
parentc781861cbd021ecbf7a3297c36e24321fd07c019 (diff)
Merge pull request #5056 from Arthapz/add-c23-cpp26-msvc
add support of c23 and c++26 for msvc
-rw-r--r--xmake/modules/core/tools/cl.lua32
1 files changed, 22 insertions, 10 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index bad9f5f6d..be521098b 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -76,10 +76,16 @@ function init(self)
-- language
, ["-ansi"] = ""
- , ["-std=c99"] = "-TP" -- compile as c++ files because msvc only support c89
- , ["-std=c11"] = "-TP" -- compile as c++ files because msvc only support c89
- , ["-std=gnu99"] = "-TP" -- compile as c++ files because msvc only support c89
- , ["-std=gnu11"] = "-TP" -- compile as c++ files because msvc only support c89
+ , ["-std=c99"] = "-TP" -- compile as c++ files because msvc doesn't support c99
+ , ["-std=c11"] = "-std:c11"
+ , ["-std=c17"] = "-std:c17"
+ , ["-std=c2x"] = "-std:clatest"
+ , ["-std=c23"] = "-std:clatest"
+ , ["-std=gnu99"] = "-TP" -- compile as c++ files because msvc doesn't support c99
+ , ["-std=gnu11"] = "-std:c11"
+ , ["-std=gnu17"] = "-std:c17"
+ , ["-std=gnu2x"] = "-std:clatest"
+ , ["-std=gnu23"] = "-std:clatest"
, ["-std=.*"] = ""
-- others
@@ -227,12 +233,16 @@ function nf_language(self, stdname)
-- stdc
c99 = "-TP" -- compile as c++ files because older msvc only support c89
, gnu99 = "-TP"
- , c11 = {"-std:c11", "-TP"}
- , gnu11 = {"-std:c11", "-TP"}
- , c17 = {"-std:c17", "-TP"}
- , gnu17 = {"-std:c17", "-TP"}
- , clatest = {"-std:c17", "-std:c11"}
- , gnulatest = {"-std:c17", "-std:c11"}
+ , c11 = {"-std:c11", "-std:clatest", "-TP"}
+ , gnu11 = {"-std:c11", "-std:clatest", "-TP"}
+ , c17 = {"-std:c17", "-std:clatest", "-TP"}
+ , gnu17 = {"-std:c17", "-std:clatest", "-TP"}
+ , c2x = {"-std:c23", "-std:clatest", "-TP"}
+ , gnu2x = {"-std:c23", "-std:clatest", "-TP"}
+ , c23 = {"-std:c23", "-std:clatest", "-TP"}
+ , gnu23 = {"-std:c23", "-std:clatest", "-TP"}
+ , clatest = {"-std:clatest", "-std:c23", "-std:c17", "-std:c11", "-TP"}
+ , gnulatest = {"-std:clatest", "-std:c23", "-std:c17", "-std:c11", "-TP"}
}
end
@@ -256,6 +266,8 @@ function nf_language(self, stdname)
, gnuxx23 = {"-std:c++23", "-std:c++latest"}
, cxx2b = {"-std:c++23", "-std:c++latest"}
, gnuxx2b = {"-std:c++23", "-std:c++latest"}
+ , cxx26 = {"-std:c++26", "-std:c++latest"}
+ , gnuxx26 = {"-std:c++26", "-std:c++latest"}
, cxxlatest = "-std:c++latest"
, gnuxxlatest = "-std:c++latest"
}