summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-05-21 09:47:51 +0800
committerOpportunityLiu <[email protected]>2019-05-21 09:54:01 +0800
commitb9a9de043eccb54e6be4cf8a0108f96d856f2b43 (patch)
tree3638e595e9acb54c09deb776975ca72f3de202f2
parenta4dfd8fd27eed47d760c78db4672fd50d0f2fbac (diff)
add more support
-rw-r--r--xmake/modules/core/tools/clang.lua1
-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.lua1
-rw-r--r--xmake/modules/core/tools/nvcc.lua31
-rw-r--r--xmake/modules/core/tools/swiftc.lua14
-rw-r--r--xmake/modules/core/tools/tcc.lua13
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