diff options
| author | OpportunityLiu <[email protected]> | 2019-05-20 19:01:11 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-05-21 09:49:08 +0800 |
| commit | fc17d122cbfadf4af3aac274e4481c3ecf72e816 (patch) | |
| tree | 6aaf492ee7218c255c941fe3a9ae4b069fead1df | |
| parent | 7ed7da5e9b333930081b50ff3781ea0a07417a1b (diff) | |
support more warnings
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 14 | ||||
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 33 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 13 | ||||
| -rw-r--r-- | 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 |
