summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-26 22:44:05 +0800
committerruki <[email protected]>2024-01-26 22:44:05 +0800
commitb67d2ce203e9535e0f2004ce7f81a690a79ec0ca (patch)
tree9026db9a6a7a4ac11cf58f1d03dd9147a1201fcb
parent3b12cd7ac54e33af6891fc7444128bb5c493366f (diff)
improve more warnings
-rw-r--r--xmake/core/sandbox/modules/import/core/project/policy.lua2
-rw-r--r--xmake/modules/core/tools/cparser.lua5
-rw-r--r--xmake/modules/core/tools/nasm.lua5
-rw-r--r--xmake/modules/core/tools/yasm.lua5
-rw-r--r--xmake/plugins/watch/main.lua3
5 files changed, 10 insertions, 10 deletions
diff --git a/xmake/core/sandbox/modules/import/core/project/policy.lua b/xmake/core/sandbox/modules/import/core/project/policy.lua
index fd61dc13e..bebb0aab4 100644
--- a/xmake/core/sandbox/modules/import/core/project/policy.lua
+++ b/xmake/core/sandbox/modules/import/core/project/policy.lua
@@ -40,7 +40,7 @@ function sandbox_core_project_policy.build_warnings(opt)
end
local warnings = sandbox_core_project_policy._BUILD_WARNINGS
if warnings == nil then
- warnings = option.get("diagnosis") or option.get("warning")
+ warnings = option.get("diagnosis")
if warnings == nil and os.isfile(os.projectfile()) and project.policy("build.warning") ~= nil then
warnings = project.policy("build.warning")
end
diff --git a/xmake/modules/core/tools/cparser.lua b/xmake/modules/core/tools/cparser.lua
index 0eb9847f0..ab6972e71 100644
--- a/xmake/modules/core/tools/cparser.lua
+++ b/xmake/modules/core/tools/cparser.lua
@@ -22,6 +22,7 @@
import("core.base.option")
import("core.project.config")
import("core.project.project")
+import("core.project.policy")
import("core.language.language")
-- init it
@@ -154,7 +155,7 @@ function compargv(self, sourcefile, objectfile, flags)
end
-- compile the source file
-function compile(self, sourcefile, objectfile, dependinfo, flags)
+function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -198,7 +199,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
function (ok, warnings)
-- print some warnings
- if warnings and #warnings > 0 and (option.get("verbose") or option.get("warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings(opt) then
cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
end
diff --git a/xmake/modules/core/tools/nasm.lua b/xmake/modules/core/tools/nasm.lua
index f7e5c9792..52a35201c 100644
--- a/xmake/modules/core/tools/nasm.lua
+++ b/xmake/modules/core/tools/nasm.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.project.policy")
import("core.language.language")
-- init it
@@ -92,7 +93,7 @@ function compargv(self, sourcefile, objectfile, flags)
end
-- compile the source file
-function compile(self, sourcefile, objectfile, dependinfo, flags)
+function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -119,7 +120,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
function (ok, outdata, errdata)
-- show warnings?
- if ok and errdata and (option.get("diagnosis") or option.get("warning")) then
+ if ok and errdata and policy.build_warnings(opt) then
errdata = errdata:trim()
if #errdata > 0 then
cprint("${color.warning}%s", errdata)
diff --git a/xmake/modules/core/tools/yasm.lua b/xmake/modules/core/tools/yasm.lua
index 2979f1d49..7f912f1c3 100644
--- a/xmake/modules/core/tools/yasm.lua
+++ b/xmake/modules/core/tools/yasm.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.project.policy")
import("core.language.language")
-- init it
@@ -80,7 +81,7 @@ function compargv(self, sourcefile, objectfile, flags)
end
-- compile the source file
-function compile(self, sourcefile, objectfile, dependinfo, flags)
+function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -107,7 +108,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
function (ok, outdata, errdata)
-- show warnings?
- if ok and errdata and (option.get("diagnosis") or option.get("warning")) then
+ if ok and errdata and policy.build_warnings(opt) then
errdata = errdata:trim()
if #errdata > 0 then
cprint("${color.warning}%s", errdata)
diff --git a/xmake/plugins/watch/main.lua b/xmake/plugins/watch/main.lua
index 1b9890be6..cbef811ae 100644
--- a/xmake/plugins/watch/main.lua
+++ b/xmake/plugins/watch/main.lua
@@ -91,9 +91,6 @@ function _run_command(events)
if option.get("diagnosis") then
table.insert(argv, "-D")
end
- if option.get("warning") then
- table.insert(argv, "-w")
- end
local target = option.get("target")
if target then
table.insert(argv, target)