summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-26 12:31:40 +0800
committerGitHub <[email protected]>2024-01-26 12:31:40 +0800
commitef4d0a665fe010b3cb0f1d58cbb110a7469ebe78 (patch)
tree47077704a2308301bb79efbdf1a3e7a0cec072b7
parentddd492657889e5a1a9315047b125e764e10e4abb (diff)
parente8c8fae2e3ada7f38b47c9238ee547ac06193241 (diff)
Merge pull request #4651 from xmake-io/warn
Enable warning output by default
-rw-r--r--xmake/actions/build/xmake.lua2
-rw-r--r--xmake/actions/global/xmake.lua3
-rw-r--r--xmake/core/project/policy.lua4
-rw-r--r--xmake/core/sandbox/modules/import/core/project/policy.lua15
-rw-r--r--xmake/modules/core/tools/armasm.lua5
-rw-r--r--xmake/modules/core/tools/armasm_msvc.lua5
-rw-r--r--xmake/modules/core/tools/armcc.lua5
-rw-r--r--xmake/modules/core/tools/armlink.lua4
-rw-r--r--xmake/modules/core/tools/c51.lua2
-rw-r--r--xmake/modules/core/tools/cl.lua2
-rw-r--r--xmake/modules/core/tools/clang_cl.lua4
-rw-r--r--xmake/modules/core/tools/cparser.lua5
-rw-r--r--xmake/modules/core/tools/gcc.lua2
-rw-r--r--xmake/modules/core/tools/llvm_rc.lua5
-rw-r--r--xmake/modules/core/tools/nasm.lua5
-rw-r--r--xmake/modules/core/tools/nvcc.lua5
-rw-r--r--xmake/modules/core/tools/sdasstm8.lua8
-rw-r--r--xmake/modules/core/tools/sdcc.lua7
-rw-r--r--xmake/modules/core/tools/tcc.lua5
-rw-r--r--xmake/modules/core/tools/windres.lua5
-rw-r--r--xmake/modules/core/tools/yasm.lua5
-rw-r--r--xmake/modules/lib/detect/check_cxsnippets.lua2
-rw-r--r--xmake/plugins/watch/main.lua3
23 files changed, 61 insertions, 47 deletions
diff --git a/xmake/actions/build/xmake.lua b/xmake/actions/build/xmake.lua
index 6f54fb69e..61174105c 100644
--- a/xmake/actions/build/xmake.lua
+++ b/xmake/actions/build/xmake.lua
@@ -42,7 +42,7 @@ task("build")
, {'j', "jobs", "kv", tostring(os.default_njob()),
"Set the number of parallel compilation jobs." }
, {nil, "linkjobs", "kv", nil, "Set the number of parallel link jobs." }
- , {'w', "warning", "k", false , "Enable the warnings output." }
+ , {'w', "warning", "k", false , "Enable the warnings output. (deprecated)" }
, {nil, "files", "kv", nil , "Build the given source files.",
"e.g. ",
" - xmake --files=src/main.c",
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index f9bd90921..b8709d70f 100644
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -37,12 +37,11 @@ task("global")
{nil, "debugger", "kv", "auto" , "The debugger program path." },
{nil, "ccache", "kv", nil , "Enable or disable the c/c++ compiler cache." },
{category = "Build Configuration"},
- {nil, "build_warning", "kv", nil , "Enable the warnings output by default when building." },
{nil, "cachedir", "kv", nil , "The global cache directory." },
{nil, "policies", "kv", nil , "Set the global project policies.",
" e.g.",
" - xmake g --policies=run.autobuild",
- " - xmake g --policies=build.warning" },
+ " - xmake g --policies=build.warning:n" },
-- network configuration
{category = "Network Configuration"},
{nil, "network", "kv", "public" , "Set the network mode."
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua
index 84f29dd06..e7212189e 100644
--- a/xmake/core/project/policy.lua
+++ b/xmake/core/project/policy.lua
@@ -48,8 +48,8 @@ function policy.policies()
["build.ccache"] = {description = "Enable C/C++ build cache.", type = "boolean"},
-- Use global storage if build.ccache is enabled
["build.ccache.global_storage"] = {description = "Use global storge if build.ccache is enabled.", type = "boolean"},
- -- Enable build warning output, it's disabled by default and we need `xmake -w/-vD` to look at it.
- ["build.warning"] = {description = "Enable build warning output.", type = "boolean"},
+ -- Enable build warning output, it's enabled by default.
+ ["build.warning"] = {description = "Enable build warning output.", default = true, type = "boolean"},
-- Enable LTO linker-time optimization for c/c++ building.
["build.optimization.lto"] = {description = "Enable LTO linker-time optimization for c/c++ building.", type = "boolean"},
-- Enable address sanitizer for c/c++ building.
diff --git a/xmake/core/sandbox/modules/import/core/project/policy.lua b/xmake/core/sandbox/modules/import/core/project/policy.lua
index 254ab8620..e4e1c576c 100644
--- a/xmake/core/sandbox/modules/import/core/project/policy.lua
+++ b/xmake/core/sandbox/modules/import/core/project/policy.lua
@@ -25,6 +25,7 @@ local sandbox_core_project_policy = sandbox_core_project_policy or {}
local table = require("base/table")
local global = require("base/global")
local option = require("base/option")
+local utils = require("base/utils")
local policy = require("project/policy")
local project = require("project/project")
local raise = require("sandbox/modules/raise")
@@ -33,16 +34,20 @@ local raise = require("sandbox/modules/raise")
sandbox_core_project_policy.policies = policy.policies
-- has build warnings?
-function sandbox_core_project_policy.build_warnings()
+function sandbox_core_project_policy.build_warnings(opt)
+ opt = opt or {}
+ if opt.build_warnings == false and not option.get("diagnosis") then
+ return false
+ end
local warnings = sandbox_core_project_policy._BUILD_WARNINGS
if warnings == nil then
- warnings = option.get("diagnosis") or option.get("warning")
+ if option.get("warning") then
+ utils.warning("\"xmake build -w\" option has been deprecated, the warning output has been enabled by default.")
+ end
+ 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
- if warnings == nil then
- warnings = global.get("build_warning")
- end
sandbox_core_project_policy._BUILD_WARNINGS = warnings or false
end
return warnings
diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua
index 84c38b8c6..3aaddc2fa 100644
--- a/xmake/modules/core/tools/armasm.lua
+++ b/xmake/modules/core/tools/armasm.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.language.language")
import("utils.progress")
@@ -82,7 +83,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))
@@ -126,7 +127,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings(opt) then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/armasm_msvc.lua b/xmake/modules/core/tools/armasm_msvc.lua
index 6a2e5c755..a66e4cea9 100644
--- a/xmake/modules/core/tools/armasm_msvc.lua
+++ b/xmake/modules/core/tools/armasm_msvc.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.language.language")
import("utils.progress")
@@ -76,7 +77,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))
@@ -120,7 +121,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings(opt) then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/armcc.lua b/xmake/modules/core/tools/armcc.lua
index b4c349873..85aeda98c 100644
--- a/xmake/modules/core/tools/armcc.lua
+++ b/xmake/modules/core/tools/armcc.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.language.language")
import("utils.progress")
@@ -125,7 +126,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))
@@ -175,7 +176,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings(opt) then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/armlink.lua b/xmake/modules/core/tools/armlink.lua
index 36bc48a58..35a17e8c2 100644
--- a/xmake/modules/core/tools/armlink.lua
+++ b/xmake/modules/core/tools/armlink.lua
@@ -64,7 +64,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
end
-- link the target file
-function link(self, objectfiles, targetkind, targetfile, flags)
+function link(self, objectfiles, targetkind, targetfile, flags, opt)
opt = opt or {}
try
{
@@ -109,7 +109,7 @@ function link(self, objectfiles, targetkind, targetfile, flags)
function (ok, outdata, errdata)
-- show warnings?
- if ok and errdata and #errdata > 0 and policy.build_warnings() then
+ if ok and errdata and #errdata > 0 and policy.build_warnings(opt) then
local lines = errdata:split('\n', {plain = true})
if #lines > 0 then
if not option.get("diagnosis") then
diff --git a/xmake/modules/core/tools/c51.lua b/xmake/modules/core/tools/c51.lua
index 105c0dbc3..d9c751bdc 100644
--- a/xmake/modules/core/tools/c51.lua
+++ b/xmake/modules/core/tools/c51.lua
@@ -110,7 +110,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
{
function (ok, outdata, errdata)
-- show warnings?
- if ok and outdata and #outdata > 0 and policy.build_warnings() then
+ if ok and outdata and #outdata > 0 and policy.build_warnings(opt) then
local warnings_count = outdata:match("(%d-) WARNING")
if warnings_count and tonumber(warnings_count) > 0 then
local lines = outdata:split('\n', {plain = true})
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 2d267f508..2d60f2a1b 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -714,7 +714,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
function (ok, outdata, errdata)
-- show warnings?
- if ok and policy.build_warnings() then
+ if ok and policy.build_warnings(opt) then
local output = outdata or ""
if #output:trim() == 0 then
output = errdata or ""
diff --git a/xmake/modules/core/tools/clang_cl.lua b/xmake/modules/core/tools/clang_cl.lua
index 69459ad3e..cf35af067 100644
--- a/xmake/modules/core/tools/clang_cl.lua
+++ b/xmake/modules/core/tools/clang_cl.lua
@@ -137,7 +137,7 @@ function nf_pcxxheader(self, pcheaderfile, opt)
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))
@@ -197,7 +197,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
{
function (ok, outdata, errdata)
-- show warnings?
- if ok and errdata and #errdata > 0 and policy.build_warnings() then
+ if ok and errdata and #errdata > 0 and policy.build_warnings(opt) then
local lines = errdata:split('\n', {plain = true})
if #lines > 0 then
local warnings = table.concat(table.slice(lines, 1, (#lines > 8 and 8 or #lines)), "\n")
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/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 15ce30280..e519b376a 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -845,7 +845,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
{
function (ok, outdata, errdata)
-- show warnings?
- if ok and errdata and #errdata > 0 and policy.build_warnings() then
+ if ok and errdata and #errdata > 0 and policy.build_warnings(opt) then
local lines = errdata:split('\n', {plain = true})
if #lines > 0 then
if not option.get("diagnosis") then
diff --git a/xmake/modules/core/tools/llvm_rc.lua b/xmake/modules/core/tools/llvm_rc.lua
index 7feb8a621..95de7c3e9 100644
--- a/xmake/modules/core/tools/llvm_rc.lua
+++ b/xmake/modules/core/tools/llvm_rc.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.project.project")
-- init it
@@ -53,7 +54,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))
@@ -78,7 +79,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
function (ok, warnings)
-- print some warnings
- if warnings and #warnings > 0 and (option.get("diagnosis") or option.get("warning") or global.get("build_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/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index e67dc0749..604fbe505 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -25,6 +25,7 @@ import("core.project.config")
import("core.project.project")
import("core.platform.platform")
import("core.language.language")
+import("core.project.policy")
import("utils.progress")
-- init it
@@ -346,7 +347,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))
@@ -423,7 +424,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings(opt) then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/sdasstm8.lua b/xmake/modules/core/tools/sdasstm8.lua
index 82c19c9fe..eb3ab12c6 100644
--- a/xmake/modules/core/tools/sdasstm8.lua
+++ b/xmake/modules/core/tools/sdasstm8.lua
@@ -21,9 +21,9 @@
-- imports
import("core.base.option")
import("core.base.global")
-import("utils.progress")
+import("core.project.policy")
import("core.language.language")
-
+import("utils.progress")
-- make the includedir flag
function nf_includedir(self, dir)
@@ -41,7 +41,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))
@@ -85,7 +85,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings(opt) then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/sdcc.lua b/xmake/modules/core/tools/sdcc.lua
index 624b23454..ee5ffbb79 100644
--- a/xmake/modules/core/tools/sdcc.lua
+++ b/xmake/modules/core/tools/sdcc.lua
@@ -21,8 +21,9 @@
-- imports
import("core.base.option")
import("core.base.global")
-import("utils.progress")
+import("core.project.policy")
import("core.language.language")
+import("utils.progress")
-- init it
function init(self)
@@ -181,7 +182,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))
@@ -225,7 +226,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") or global.get("build_warning")) then
+ if warnings and #warnings > 0 and policy.build_warnings(opt) then
if progress.showing_without_scroll() then
print("")
end
diff --git a/xmake/modules/core/tools/tcc.lua b/xmake/modules/core/tools/tcc.lua
index 84eae246d..0fbaa202b 100644
--- a/xmake/modules/core/tools/tcc.lua
+++ b/xmake/modules/core/tools/tcc.lua
@@ -23,6 +23,7 @@ import("core.base.option")
import("core.base.global")
import("core.project.config")
import("core.project.project")
+import("core.project.policy")
import("core.language.language")
-- init it
@@ -142,7 +143,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))
@@ -186,7 +187,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") or global.get("build_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/windres.lua b/xmake/modules/core/tools/windres.lua
index a7940ce67..4eedd484c 100644
--- a/xmake/modules/core/tools/windres.lua
+++ b/xmake/modules/core/tools/windres.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
+import("core.project.policy")
import("core.project.project")
-- init it
@@ -54,7 +55,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)
os.mkdir(path.directory(objectfile))
try
{
@@ -72,7 +73,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
finally
{
function (ok, warnings)
- if warnings and #warnings > 0 and (option.get("diagnosis") or option.get("warning") or global.get("build_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/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/modules/lib/detect/check_cxsnippets.lua b/xmake/modules/lib/detect/check_cxsnippets.lua
index 987e7f10e..0cc736975 100644
--- a/xmake/modules/lib/detect/check_cxsnippets.lua
+++ b/xmake/modules/lib/detect/check_cxsnippets.lua
@@ -239,6 +239,8 @@ function main(snippets, opt)
if option.get("diagnosis") then
cprint("${dim}> %s", compiler.compcmd(sourcefile, objectfile, opt))
end
+ opt = table.clone(opt)
+ opt.build_warnings = false
compiler.compile(sourcefile, objectfile, opt)
if #links > 0 or opt.tryrun or opt.binary_match then
if option.get("diagnosis") then
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)