From 97831c56d2ba3a719de0c80d9bcdc8db9163eb00 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 17 Sep 2023 21:41:32 +0800 Subject: add pedantic warning #4209 --- xmake/modules/core/tools/cl.lua | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'xmake/modules/core/tools/cl.lua') 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 -- cgit v1.3.1