diff options
| author | ruki <[email protected]> | 2024-01-26 22:43:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-01-26 22:43:11 +0800 |
| commit | 3b12cd7ac54e33af6891fc7444128bb5c493366f (patch) | |
| tree | b7fc835f51ba9d346f82b0148f3ca2c1c309a44c | |
| parent | 37ea03445cb35ed3f3966f3433211451175eead1 (diff) | |
improve check warnings
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/policy.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/core/tools/armasm.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/armasm_msvc.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/armcc.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/armlink.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/c51.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/clang_cl.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/llvm_rc.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/nvcc.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/sdasstm8.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/sdcc.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/tcc.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/windres.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/check_cxsnippets.lua | 2 |
16 files changed, 32 insertions, 26 deletions
diff --git a/xmake/core/sandbox/modules/import/core/project/policy.lua b/xmake/core/sandbox/modules/import/core/project/policy.lua index 7a1338a6b..fd61dc13e 100644 --- a/xmake/core/sandbox/modules/import/core/project/policy.lua +++ b/xmake/core/sandbox/modules/import/core/project/policy.lua @@ -33,7 +33,11 @@ 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") diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua index 4da0d83ab..3aaddc2fa 100644 --- a/xmake/modules/core/tools/armasm.lua +++ b/xmake/modules/core/tools/armasm.lua @@ -83,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)) @@ -127,7 +127,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and policy.build_warnings() 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 cc21b94b1..a66e4cea9 100644 --- a/xmake/modules/core/tools/armasm_msvc.lua +++ b/xmake/modules/core/tools/armasm_msvc.lua @@ -77,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)) @@ -121,7 +121,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and policy.build_warnings() 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 369ebaa48..85aeda98c 100644 --- a/xmake/modules/core/tools/armcc.lua +++ b/xmake/modules/core/tools/armcc.lua @@ -126,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)) @@ -176,7 +176,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and policy.build_warnings() 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/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 e1f353902..95de7c3e9 100644 --- a/xmake/modules/core/tools/llvm_rc.lua +++ b/xmake/modules/core/tools/llvm_rc.lua @@ -54,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)) @@ -79,7 +79,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and policy.build_warnings() 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/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 49041d7ba..604fbe505 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -347,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)) @@ -424,7 +424,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and policy.build_warnings() 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 86927a345..eb3ab12c6 100644 --- a/xmake/modules/core/tools/sdasstm8.lua +++ b/xmake/modules/core/tools/sdasstm8.lua @@ -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 policy.build_warnings() 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 fbbe496d6..ee5ffbb79 100644 --- a/xmake/modules/core/tools/sdcc.lua +++ b/xmake/modules/core/tools/sdcc.lua @@ -182,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)) @@ -226,7 +226,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and policy.build_warnings() 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 13592a045..0fbaa202b 100644 --- a/xmake/modules/core/tools/tcc.lua +++ b/xmake/modules/core/tools/tcc.lua @@ -143,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)) @@ -187,7 +187,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) function (ok, warnings) -- print some warnings - if warnings and #warnings > 0 and policy.build_warnings() 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 74f8da7c0..4eedd484c 100644 --- a/xmake/modules/core/tools/windres.lua +++ b/xmake/modules/core/tools/windres.lua @@ -55,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 { @@ -73,7 +73,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) finally { function (ok, warnings) - if warnings and #warnings > 0 and policy.build_warnings() 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/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 |
