From f358360be5afca83877628ff457131171db1e1b5 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Mon, 20 May 2019 19:01:11 +0800 Subject: support more warnings --- xmake/modules/core/tools/cl.lua | 14 +++++++++----- xmake/modules/core/tools/clang.lua | 33 +++++++++++++++++++++++++++++++++ xmake/modules/core/tools/gcc.lua | 13 ++++++++----- xmake/modules/core/tools/ml.lua | 18 ++++++++++++------ 4 files changed, 62 insertions(+), 16 deletions(-) diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index fac42e377..3c8699c7e 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -43,6 +43,8 @@ function init(self) , ["-fvisibility=.*"] = "" -- warnings + , ["-Weverything"] = "-Wall" + , ["-Wextra"] = "-W4" , ["-Wall"] = "-W3" -- = "-Wall" will enable too more warnings , ["-W1"] = "-W1" , ["-W2"] = "-W2" @@ -119,11 +121,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-W0" - , less = "-W1" - , more = "-W3" - , all = "-W3" -- = "-Wall" will enable too more warnings - , error = "-WX" + none = "-W0" + , less = "-W1" + , more = "-W3" + , all = "-W3" -- = "-Wall" will enable too more warnings + , extra = "-W4" + , everything = "-Wall" + , error = "-WX" } -- make it diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 5cfe55b5d..32524ea55 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -31,6 +31,20 @@ function init(self) self:add("cxflags", "-Qunused-arguments") self:add("mxflags", "-Qunused-arguments") self:add("asflags", "-Qunused-arguments") + + -- init flags map + self:set("mapflags", + { + -- warnings + ["-W1"] = "-Wall" + , ["-W2"] = "-Wall" + , ["-W3"] = "-Wall" + + -- strip + , ["-s"] = "-s" + , ["-S"] = "-S" + }) + end -- make the optimize flag @@ -50,3 +64,22 @@ function nf_optimize(self, level) -- make it return maps[level] end + +-- make the warning flag +function nf_warning(self, level) + + -- the maps + local maps = + { + none = "-w" + , less = "-Wall" + , more = "-Wall" + , all = "-Wall" + , extra = "-Wextra" + , everything = "-Weverything" + , error = "-Werror" + } + + -- make it + return maps[level] +end diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 9253bf75c..f31f4f876 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -52,6 +52,7 @@ function init(self) ["-W1"] = "-Wall" , ["-W2"] = "-Wall" , ["-W3"] = "-Wall" + , ["-Weverything"] = "-Wall -Wextra -Weffc++" -- strip , ["-s"] = "-s" @@ -115,11 +116,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-Wall" - , more = "-Wall" - , all = "-Wall" - , error = "-Werror" + none = "-w" + , less = "-Wall" + , more = "-Wall" + , all = "-Wall" + , extra = "-Wextra" + , everything = "-Wall -Wextra -Weffc++" + , error = "-Werror" } -- make it diff --git a/xmake/modules/core/tools/ml.lua b/xmake/modules/core/tools/ml.lua index bfdacba20..4f186a58d 100644 --- a/xmake/modules/core/tools/ml.lua +++ b/xmake/modules/core/tools/ml.lua @@ -18,6 +18,8 @@ -- @file ml.lua -- +-- https://docs.microsoft.com/en-us/cpp/assembler/masm/ml-and-ml64-command-line-reference + -- init it function init(self) @@ -36,10 +38,12 @@ function init(self) , ["-fvisibility=.*"] = "" -- warnings - , ["-Wall"] = "-W3" -- = "-Wall" will enable too more warnings , ["-W1"] = "-W1" , ["-W2"] = "-W2" , ["-W3"] = "-W3" + , ["-Wall"] = "-W3" -- /W level Sets the warning level, where level = 0, 1, 2, or 3. + , ["-Wextra"] = "-W3" + , ["-Weverything"] = "-W3" , ["-Werror"] = "-WX" , ["%-Wno%-error=.*"] = "" @@ -61,11 +65,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-W1" - , more = "-W3" - , all = "-W3" - , error = "-WX" + none = "-w" + , less = "-W1" + , more = "-W3" + , all = "-W3" + , extra = "-W3" + , everything = "-W3" + , error = "-WX" } -- make it -- cgit v1.3.1 From 814b8c684bbd367c9cf0643309983d27aa665840 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Mon, 20 May 2019 19:01:11 +0800 Subject: support more warnings --- xmake/modules/core/tools/cl.lua | 14 +++++++++----- xmake/modules/core/tools/clang.lua | 33 +++++++++++++++++++++++++++++++++ xmake/modules/core/tools/gcc.lua | 13 ++++++++----- xmake/modules/core/tools/ml.lua | 18 ++++++++++++------ 4 files changed, 62 insertions(+), 16 deletions(-) diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index fac42e377..3c8699c7e 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -43,6 +43,8 @@ function init(self) , ["-fvisibility=.*"] = "" -- warnings + , ["-Weverything"] = "-Wall" + , ["-Wextra"] = "-W4" , ["-Wall"] = "-W3" -- = "-Wall" will enable too more warnings , ["-W1"] = "-W1" , ["-W2"] = "-W2" @@ -119,11 +121,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-W0" - , less = "-W1" - , more = "-W3" - , all = "-W3" -- = "-Wall" will enable too more warnings - , error = "-WX" + none = "-W0" + , less = "-W1" + , more = "-W3" + , all = "-W3" -- = "-Wall" will enable too more warnings + , extra = "-W4" + , everything = "-Wall" + , error = "-WX" } -- make it diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 5cfe55b5d..32524ea55 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -31,6 +31,20 @@ function init(self) self:add("cxflags", "-Qunused-arguments") self:add("mxflags", "-Qunused-arguments") self:add("asflags", "-Qunused-arguments") + + -- init flags map + self:set("mapflags", + { + -- warnings + ["-W1"] = "-Wall" + , ["-W2"] = "-Wall" + , ["-W3"] = "-Wall" + + -- strip + , ["-s"] = "-s" + , ["-S"] = "-S" + }) + end -- make the optimize flag @@ -50,3 +64,22 @@ function nf_optimize(self, level) -- make it return maps[level] end + +-- make the warning flag +function nf_warning(self, level) + + -- the maps + local maps = + { + none = "-w" + , less = "-Wall" + , more = "-Wall" + , all = "-Wall" + , extra = "-Wextra" + , everything = "-Weverything" + , error = "-Werror" + } + + -- make it + return maps[level] +end diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 9253bf75c..f31f4f876 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -52,6 +52,7 @@ function init(self) ["-W1"] = "-Wall" , ["-W2"] = "-Wall" , ["-W3"] = "-Wall" + , ["-Weverything"] = "-Wall -Wextra -Weffc++" -- strip , ["-s"] = "-s" @@ -115,11 +116,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-Wall" - , more = "-Wall" - , all = "-Wall" - , error = "-Werror" + none = "-w" + , less = "-Wall" + , more = "-Wall" + , all = "-Wall" + , extra = "-Wextra" + , everything = "-Wall -Wextra -Weffc++" + , error = "-Werror" } -- make it diff --git a/xmake/modules/core/tools/ml.lua b/xmake/modules/core/tools/ml.lua index bfdacba20..4f186a58d 100644 --- a/xmake/modules/core/tools/ml.lua +++ b/xmake/modules/core/tools/ml.lua @@ -18,6 +18,8 @@ -- @file ml.lua -- +-- https://docs.microsoft.com/en-us/cpp/assembler/masm/ml-and-ml64-command-line-reference + -- init it function init(self) @@ -36,10 +38,12 @@ function init(self) , ["-fvisibility=.*"] = "" -- warnings - , ["-Wall"] = "-W3" -- = "-Wall" will enable too more warnings , ["-W1"] = "-W1" , ["-W2"] = "-W2" , ["-W3"] = "-W3" + , ["-Wall"] = "-W3" -- /W level Sets the warning level, where level = 0, 1, 2, or 3. + , ["-Wextra"] = "-W3" + , ["-Weverything"] = "-W3" , ["-Werror"] = "-WX" , ["%-Wno%-error=.*"] = "" @@ -61,11 +65,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-W1" - , more = "-W3" - , all = "-W3" - , error = "-WX" + none = "-w" + , less = "-W1" + , more = "-W3" + , all = "-W3" + , extra = "-W3" + , everything = "-W3" + , error = "-WX" } -- make it -- cgit v1.3.1 From 9f0d35366cfbbe8c49cf645be0e430c469a77b3e Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Mon, 20 May 2019 19:41:34 +0800 Subject: tool --- xmake/modules/core/tools/nvcc.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index b14ec8829..05afaf1b9 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.tool.tool") import("core.project.config") import("core.project.project") import("core.language.language") @@ -78,8 +79,17 @@ function nf_warning(self, level) , error = "-Werror" } + local cu_cxx = config.get("cu-cxx") + local cu_cxx_tool = nil tool.load("cxx") + if is_plat("windows") or not cu_cxx then + cu_cxx_tool = tool.load("cxx") + elseif cu_cxx then + cu_cxx_tool = tool.load("cxx", cu_cxx) + end + + local cu_cxx_tool_warning = cu_cxx_tool.nf_warning(level) -- make it - return maps[level] + return maps[level] .. ' -Xcompiler "' .. cu_cxx_tool_warning .. '" -Xlinker "' .. cu_cxx_tool_warning ..'"' end -- make the optimize flag -- cgit v1.3.1 From 9ef48cab2e2ea42faa115ea2c472a70f2095d6b5 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Mon, 20 May 2019 19:56:33 +0800 Subject: nvcc warning map --- xmake/modules/core/tools/nvcc.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 05afaf1b9..4048929b8 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -20,7 +20,7 @@ -- imports import("core.base.option") -import("core.tool.tool") +import("core.tool.compiler") import("core.project.config") import("core.project.project") import("core.language.language") @@ -72,15 +72,17 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-W1" - , more = "-W3" - , all = "-Wall" - , error = "-Werror" + none = "-w" + , less = "" + , more = "" + , all = "" + , extra = "-Wreorder" + , everything = "-Wreorder" + , error = "-Werror" } local cu_cxx = config.get("cu-cxx") - local cu_cxx_tool = nil tool.load("cxx") + local cu_cxx_tool = nil if is_plat("windows") or not cu_cxx then cu_cxx_tool = tool.load("cxx") elseif cu_cxx then -- cgit v1.3.1 From fc17d122cbfadf4af3aac274e4481c3ecf72e816 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Mon, 20 May 2019 19:01:11 +0800 Subject: support more warnings --- xmake/modules/core/tools/cl.lua | 14 +++++++++----- xmake/modules/core/tools/clang.lua | 33 +++++++++++++++++++++++++++++++++ xmake/modules/core/tools/gcc.lua | 13 ++++++++----- xmake/modules/core/tools/ml.lua | 18 ++++++++++++------ 4 files changed, 62 insertions(+), 16 deletions(-) diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index fac42e377..3c8699c7e 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -43,6 +43,8 @@ function init(self) , ["-fvisibility=.*"] = "" -- warnings + , ["-Weverything"] = "-Wall" + , ["-Wextra"] = "-W4" , ["-Wall"] = "-W3" -- = "-Wall" will enable too more warnings , ["-W1"] = "-W1" , ["-W2"] = "-W2" @@ -119,11 +121,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-W0" - , less = "-W1" - , more = "-W3" - , all = "-W3" -- = "-Wall" will enable too more warnings - , error = "-WX" + none = "-W0" + , less = "-W1" + , more = "-W3" + , all = "-W3" -- = "-Wall" will enable too more warnings + , extra = "-W4" + , everything = "-Wall" + , error = "-WX" } -- make it diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 5cfe55b5d..32524ea55 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -31,6 +31,20 @@ function init(self) self:add("cxflags", "-Qunused-arguments") self:add("mxflags", "-Qunused-arguments") self:add("asflags", "-Qunused-arguments") + + -- init flags map + self:set("mapflags", + { + -- warnings + ["-W1"] = "-Wall" + , ["-W2"] = "-Wall" + , ["-W3"] = "-Wall" + + -- strip + , ["-s"] = "-s" + , ["-S"] = "-S" + }) + end -- make the optimize flag @@ -50,3 +64,22 @@ function nf_optimize(self, level) -- make it return maps[level] end + +-- make the warning flag +function nf_warning(self, level) + + -- the maps + local maps = + { + none = "-w" + , less = "-Wall" + , more = "-Wall" + , all = "-Wall" + , extra = "-Wextra" + , everything = "-Weverything" + , error = "-Werror" + } + + -- make it + return maps[level] +end diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 9253bf75c..f31f4f876 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -52,6 +52,7 @@ function init(self) ["-W1"] = "-Wall" , ["-W2"] = "-Wall" , ["-W3"] = "-Wall" + , ["-Weverything"] = "-Wall -Wextra -Weffc++" -- strip , ["-s"] = "-s" @@ -115,11 +116,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-Wall" - , more = "-Wall" - , all = "-Wall" - , error = "-Werror" + none = "-w" + , less = "-Wall" + , more = "-Wall" + , all = "-Wall" + , extra = "-Wextra" + , everything = "-Wall -Wextra -Weffc++" + , error = "-Werror" } -- make it diff --git a/xmake/modules/core/tools/ml.lua b/xmake/modules/core/tools/ml.lua index bfdacba20..4f186a58d 100644 --- a/xmake/modules/core/tools/ml.lua +++ b/xmake/modules/core/tools/ml.lua @@ -18,6 +18,8 @@ -- @file ml.lua -- +-- https://docs.microsoft.com/en-us/cpp/assembler/masm/ml-and-ml64-command-line-reference + -- init it function init(self) @@ -36,10 +38,12 @@ function init(self) , ["-fvisibility=.*"] = "" -- warnings - , ["-Wall"] = "-W3" -- = "-Wall" will enable too more warnings , ["-W1"] = "-W1" , ["-W2"] = "-W2" , ["-W3"] = "-W3" + , ["-Wall"] = "-W3" -- /W level Sets the warning level, where level = 0, 1, 2, or 3. + , ["-Wextra"] = "-W3" + , ["-Weverything"] = "-W3" , ["-Werror"] = "-WX" , ["%-Wno%-error=.*"] = "" @@ -61,11 +65,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-W1" - , more = "-W3" - , all = "-W3" - , error = "-WX" + none = "-w" + , less = "-W1" + , more = "-W3" + , all = "-W3" + , extra = "-W3" + , everything = "-W3" + , error = "-WX" } -- make it -- cgit v1.3.1 From 5a9914c5de7ee2ef65e3011c9e6ff73714de51e6 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Mon, 20 May 2019 19:41:34 +0800 Subject: tool --- xmake/modules/core/tools/nvcc.lua | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 543d5d5a4..b282ab8ce 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.tool.tool") import("core.project.config") import("core.project.project") import("core.language.language") @@ -76,23 +77,18 @@ function nf_warning(self, level) , everything = "-Wreorder" , error = "-Werror" } - - local warning = maps[level] - if not warning then - -- for cl.exe - if is_plat("windows") then - maps.less = "-Xcompiler -W1" - maps.more = "-Xcompiler -W3" - maps.all = "-Xcompiler -W3" - -- for gcc/clang - elseif self:has_flags("-Xcompiler -Wall", "cxflags") then - maps.less = "-Xcompiler -Wall" - maps.more = "-Xcompiler -Wall" - maps.all = "-Xcompiler -Wall" - end - warning = maps[level] + + local cu_cxx = config.get("cu-cxx") + local cu_cxx_tool = nil tool.load("cxx") + if is_plat("windows") or not cu_cxx then + cu_cxx_tool = tool.load("cxx") + elseif cu_cxx then + cu_cxx_tool = tool.load("cxx", cu_cxx) end - return warning + + local cu_cxx_tool_warning = cu_cxx_tool.nf_warning(level) + -- make it + return maps[level] .. ' -Xcompiler "' .. cu_cxx_tool_warning .. '" -Xlinker "' .. cu_cxx_tool_warning ..'"' end -- make the optimize flag -- cgit v1.3.1 From a4dfd8fd27eed47d760c78db4672fd50d0f2fbac Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Mon, 20 May 2019 19:56:33 +0800 Subject: nvcc warning map --- xmake/modules/core/tools/nvcc.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index b282ab8ce..4048929b8 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -20,7 +20,7 @@ -- imports import("core.base.option") -import("core.tool.tool") +import("core.tool.compiler") import("core.project.config") import("core.project.project") import("core.language.language") @@ -73,13 +73,16 @@ function nf_warning(self, level) local maps = { none = "-w" + , less = "" + , more = "" + , all = "" , extra = "-Wreorder" , everything = "-Wreorder" , error = "-Werror" } local cu_cxx = config.get("cu-cxx") - local cu_cxx_tool = nil tool.load("cxx") + local cu_cxx_tool = nil if is_plat("windows") or not cu_cxx then cu_cxx_tool = tool.load("cxx") elseif cu_cxx then -- cgit v1.3.1 From b9a9de043eccb54e6be4cf8a0108f96d856f2b43 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Tue, 21 May 2019 09:47:51 +0800 Subject: add more support --- xmake/modules/core/tools/clang.lua | 1 + xmake/modules/core/tools/cparser.lua | 22 +++++++++++++--------- xmake/modules/core/tools/dmd.lua | 2 ++ xmake/modules/core/tools/gcc.lua | 1 + xmake/modules/core/tools/nvcc.lua | 31 ++++++++++++++++--------------- xmake/modules/core/tools/swiftc.lua | 14 +++++++++----- xmake/modules/core/tools/tcc.lua | 13 ++++++++----- 7 files changed, 50 insertions(+), 34 deletions(-) diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 32524ea55..693dad71a 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -39,6 +39,7 @@ function init(self) ["-W1"] = "-Wall" , ["-W2"] = "-Wall" , ["-W3"] = "-Wall" + , ["-W4"] = "-Wextra" -- strip , ["-s"] = "-s" diff --git a/xmake/modules/core/tools/cparser.lua b/xmake/modules/core/tools/cparser.lua index 967714c37..6e2541c32 100644 --- a/xmake/modules/core/tools/cparser.lua +++ b/xmake/modules/core/tools/cparser.lua @@ -46,9 +46,11 @@ function init(self) self:set("mapflags", { -- warnings - ["-W1"] = "-Wall" - , ["-W2"] = "-Wall" - , ["-W3"] = "-Wall" + ["-W1"] = "-Wall" + , ["-W2"] = "-Wall" + , ["-W3"] = "-Wall" + , ["-W4"] = "-Wall -Wextra" + , ["-Weverything"] = "-Wall -Wextra" -- strip , ["-s"] = "-s" @@ -95,12 +97,14 @@ function nf_warning(self, level) -- the maps local maps = - { - none = "-w" - , less = "-W1" - , more = "-W3" - , all = "-Wall" - , error = "-Werror" + { + none = "-w" + , less = "-Wall" + , more = "-Wall" + , all = "-Wall" + , extra = "-Wextra" + , everything = "-Wextra -Wall" + , error = "-Werror" } -- make it diff --git a/xmake/modules/core/tools/dmd.lua b/xmake/modules/core/tools/dmd.lua index 2acddc2e6..8c4a50fdb 100644 --- a/xmake/modules/core/tools/dmd.lua +++ b/xmake/modules/core/tools/dmd.lua @@ -96,6 +96,8 @@ function nf_warning(self, level) , less = "-w" , more = "-w -wi" , all = "-w -wi" + , extra = "-w -wi" + , everything = "-w -wi" , error = "-de" } diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index f31f4f876..997d3109f 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -52,6 +52,7 @@ function init(self) ["-W1"] = "-Wall" , ["-W2"] = "-Wall" , ["-W3"] = "-Wall" + , ["-W4"] = "-Wextra" , ["-Weverything"] = "-Wall -Wextra -Weffc++" -- strip diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 4048929b8..543d5d5a4 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -20,7 +20,6 @@ -- imports import("core.base.option") -import("core.tool.compiler") import("core.project.config") import("core.project.project") import("core.language.language") @@ -73,25 +72,27 @@ function nf_warning(self, level) local maps = { none = "-w" - , less = "" - , more = "" - , all = "" , extra = "-Wreorder" , everything = "-Wreorder" , error = "-Werror" } - - local cu_cxx = config.get("cu-cxx") - local cu_cxx_tool = nil - if is_plat("windows") or not cu_cxx then - cu_cxx_tool = tool.load("cxx") - elseif cu_cxx then - cu_cxx_tool = tool.load("cxx", cu_cxx) + + local warning = maps[level] + if not warning then + -- for cl.exe + if is_plat("windows") then + maps.less = "-Xcompiler -W1" + maps.more = "-Xcompiler -W3" + maps.all = "-Xcompiler -W3" + -- for gcc/clang + elseif self:has_flags("-Xcompiler -Wall", "cxflags") then + maps.less = "-Xcompiler -Wall" + maps.more = "-Xcompiler -Wall" + maps.all = "-Xcompiler -Wall" + end + warning = maps[level] end - - local cu_cxx_tool_warning = cu_cxx_tool.nf_warning(level) - -- make it - return maps[level] .. ' -Xcompiler "' .. cu_cxx_tool_warning .. '" -Xlinker "' .. cu_cxx_tool_warning ..'"' + return warning end -- make the optimize flag diff --git a/xmake/modules/core/tools/swiftc.lua b/xmake/modules/core/tools/swiftc.lua index c29829787..df4736a59 100644 --- a/xmake/modules/core/tools/swiftc.lua +++ b/xmake/modules/core/tools/swiftc.lua @@ -35,6 +35,8 @@ function init(self) , ["-w"] = "-suppress-warnings" , ["-W%d*"] = "-warn-swift3-objc-inference-minimal" , ["-Wall"] = "-warn-swift3-objc-inference-complete" + , ["-Wextra"] = "-warn-swift3-objc-inference-complete" + , ["-Weverything"] = "-warn-swift3-objc-inference-complete" , ["-Werror"] = "-warnings-as-errors" -- optimize @@ -94,11 +96,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-suppress-warnings" - , less = "-warn-swift3-objc-inference-minimal" - , more = "-warn-swift3-objc-inference-minimal" - , all = "-warn-swift3-objc-inference-complete" - , error = "-warnings-as-errors" + none = "-suppress-warnings" + , less = "-warn-swift3-objc-inference-minimal" + , more = "-warn-swift3-objc-inference-minimal" + , all = "-warn-swift3-objc-inference-complete" + , extra = "-warn-swift3-objc-inference-complete" + , everything = "-warn-swift3-objc-inference-complete" + , error = "-warnings-as-errors" } -- make it diff --git a/xmake/modules/core/tools/tcc.lua b/xmake/modules/core/tools/tcc.lua index ce64777ad..8c819938a 100644 --- a/xmake/modules/core/tools/tcc.lua +++ b/xmake/modules/core/tools/tcc.lua @@ -49,6 +49,7 @@ function init(self) ["-W1"] = "-Wall" , ["-W2"] = "-Wall" , ["-W3"] = "-Wall" + , ["-W4"] = "-Wall -Wunsupported" -- strip , ["-s"] = "-s" @@ -96,11 +97,13 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-W1" - , more = "-W3" - , all = "-Wall" - , error = "-Werror" + none = "-w" + , less = "-W1" + , more = "-W3" + , all = "-Wall" + , extra = "-Wunsupported" + , everything = "-Wall -Wunsupported -Wwrite-strings" + , error = "-Werror" } -- make it -- cgit v1.3.1