summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/clang.lua
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-05-20 19:01:11 +0800
committerOpportunityLiu <[email protected]>2019-05-21 09:49:08 +0800
commitfc17d122cbfadf4af3aac274e4481c3ecf72e816 (patch)
tree6aaf492ee7218c255c941fe3a9ae4b069fead1df /xmake/modules/core/tools/clang.lua
parent7ed7da5e9b333930081b50ff3781ea0a07417a1b (diff)
support more warnings
Diffstat (limited to 'xmake/modules/core/tools/clang.lua')
-rw-r--r--xmake/modules/core/tools/clang.lua33
1 files changed, 33 insertions, 0 deletions
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