summaryrefslogtreecommitdiff
path: root/xmake/modules/core
diff options
context:
space:
mode:
authorruki <[email protected]>2026-01-13 22:34:19 +0800
committerruki <[email protected]>2026-01-13 22:34:19 +0800
commita07a54f06c1341f9082b967d0c8205b214cc04e3 (patch)
tree2c254456ca540468b44231af8500c5b24360aa84 /xmake/modules/core
parent08bc9d63514a9eb28401aef5726ab9870c6b270e (diff)
improve nvcc warningscl
Diffstat (limited to 'xmake/modules/core')
-rw-r--r--xmake/modules/core/tools/cl/parse_include.lua7
-rw-r--r--xmake/modules/core/tools/gcc.lua21
-rw-r--r--xmake/modules/core/tools/nvcc.lua24
3 files changed, 34 insertions, 18 deletions
diff --git a/xmake/modules/core/tools/cl/parse_include.lua b/xmake/modules/core/tools/cl/parse_include.lua
index 4ca3803e1..3541c28df 100644
--- a/xmake/modules/core/tools/cl/parse_include.lua
+++ b/xmake/modules/core/tools/cl/parse_include.lua
@@ -90,11 +90,8 @@ end
-- has include note?
function has_include_note(line)
local note = _g.note
- if note then
- if line:startswith(note) then
- return note
- end
- return
+ if note and line:startswith(note) then
+ return note
end
local notes = get_include_notes()
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index c1a98b752..6fc7a641b 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -912,6 +912,18 @@ function add_sourceflags(self, sourcefile, fileconfig, target, targetkind)
end
end
+-- show warnings
+function _show_warnings(self, output)
+ local lines = output:split('\n', {plain = true})
+ if #lines > 0 then
+ if not option.get("diagnosis") then
+ lines = table.slice(lines, 1, (#lines > 16 and 16 or #lines))
+ end
+ local warnings = table.concat(lines, "\n")
+ progress.show_output("${color.warning}%s", warnings)
+ end
+end
+
-- make the link arguments list
function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
@@ -1064,14 +1076,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(opt) then
- local lines = errdata:split('\n', {plain = true})
- if #lines > 0 then
- if not option.get("diagnosis") then
- lines = table.slice(lines, 1, (#lines > 16 and 16 or #lines))
- end
- local warnings = table.concat(lines, "\n")
- progress.show_output("${color.warning}%s", warnings)
- end
+ _show_warnings(self, errdata)
end
-- generate the dependent includes
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index 27f0340f5..41ae28274 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -326,6 +326,18 @@ function link(self, objectfiles, targetkind, targetfile, flags, opt)
os.runv(program, argv, {envs = self:runenvs()})
end
+-- show warnings
+function _show_warnings(self, output)
+ local lines = output:split('\n', {plain = true})
+ if #lines > 0 then
+ if not option.get("diagnosis") then
+ lines = table.slice(lines, 1, (#lines > 16 and 16 or #lines))
+ end
+ local warnings = table.concat(lines, "\n")
+ progress.show_output("${color.warning}%s", warnings)
+ end
+end
+
-- support `-MD -MF depfile.d`?
function _has_flags_md_mf(self)
local has_md_mf = _g._HAS_MD_MF
@@ -446,11 +458,13 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
},
finally
{
- function (ok, warnings)
-
- -- print some warnings
- if warnings and #warnings > 0 and policy.build_warnings(opt) then
- progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n', {plain = true}), 1, 8), '\n'))
+ function (ok, outdata, errdata)
+ -- show warnings?
+ if ok and policy.build_warnings(opt) then
+ local output = (outdata or "") .. (errdata or "")
+ if #output > 0 then
+ _show_warnings(self, output)
+ end
end
-- generate the dependent includes