summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/cl.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-09-17 21:41:32 +0800
committerruki <[email protected]>2023-09-17 21:41:39 +0800
commit97831c56d2ba3a719de0c80d9bcdc8db9163eb00 (patch)
treeaedaa7962d1c52bab5c916624bf89e7cf0b6e56c /xmake/modules/core/tools/cl.lua
parenta9e9084863ffc3d9e6aeb044e3f92a7deaa78036 (diff)
add pedantic warning #4209
Diffstat (limited to 'xmake/modules/core/tools/cl.lua')
-rw-r--r--xmake/modules/core/tools/cl.lua26
1 files changed, 20 insertions, 6 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 5f44197f6..607f0f4d9 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -130,8 +130,7 @@ end
-- make the fp-model flag
function nf_fpmodel(self, level)
- local maps =
- {
+ local maps = {
precise = "-fp:precise" -- default
, fast = "-fp:fast"
, strict = "-fp:strict"
@@ -142,9 +141,16 @@ function nf_fpmodel(self, level)
end
-- make the warning flag
-function nf_warning(self, level)
- local maps =
- {
+function nf_warnings(self, levels)
+ local flags = {}
+ local values = hashset.from(levels)
+ if values:has("all") and values:has("extra") then
+ table.insert(flags, "-W4")
+ values:remove("all")
+ values:remove("extra")
+ end
+
+ local maps = {
none = "-w"
, less = "-W1"
, more = "-W3"
@@ -153,7 +159,15 @@ function nf_warning(self, level)
, everything = "-Wall"
, error = "-WX"
}
- return maps[level]
+ for _, level in values:keys() do
+ local flag = maps[level]
+ if flag then
+ table.insert(flags, flag)
+ end
+ end
+ if #flags > 0 then
+ return flags
+ end
end
-- make the optimize flag