summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-05-21 10:25:44 +0800
committerGitHub <[email protected]>2019-05-21 10:25:44 +0800
commite0dd88cfd0f55f656fe865da208bc629bf78faa5 (patch)
tree3638e595e9acb54c09deb776975ca72f3de202f2
parent7ed7da5e9b333930081b50ff3781ea0a07417a1b (diff)
parentc9208456c2d0c8175d19290a50ccb6fdf95139bb (diff)
Merge pull request #420 from OpportunityLiu/more-warnings
support more warnings
-rw-r--r--xmake/modules/core/tools/cl.lua14
-rw-r--r--xmake/modules/core/tools/clang.lua34
-rw-r--r--xmake/modules/core/tools/cparser.lua22
-rw-r--r--xmake/modules/core/tools/dmd.lua2
-rw-r--r--xmake/modules/core/tools/gcc.lua14
-rw-r--r--xmake/modules/core/tools/ml.lua18
-rw-r--r--xmake/modules/core/tools/swiftc.lua14
-rw-r--r--xmake/modules/core/tools/tcc.lua13
8 files changed, 96 insertions, 35 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..693dad71a 100644
--- a/xmake/modules/core/tools/clang.lua
+++ b/xmake/modules/core/tools/clang.lua
@@ -31,6 +31,21 @@ 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"
+ , ["-W4"] = "-Wextra"
+
+ -- strip
+ , ["-s"] = "-s"
+ , ["-S"] = "-S"
+ })
+
end
-- make the optimize flag
@@ -50,3 +65,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/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 9253bf75c..997d3109f 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -52,6 +52,8 @@ function init(self)
["-W1"] = "-Wall"
, ["-W2"] = "-Wall"
, ["-W3"] = "-Wall"
+ , ["-W4"] = "-Wextra"
+ , ["-Weverything"] = "-Wall -Wextra -Weffc++"
-- strip
, ["-s"] = "-s"
@@ -115,11 +117,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
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