summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/cl/parse_include.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-01-13 00:54:49 +0800
committerruki <[email protected]>2026-01-12 23:38:29 +0800
commit08bc9d63514a9eb28401aef5726ab9870c6b270e (patch)
tree2b705a31105d201468bb3ba11a070842a27ba02c /xmake/modules/core/tools/cl/parse_include.lua
parent0569f75900e97a721cc7acbff3e9738095743d8c (diff)
improve warnings outpur for cl.exe
Diffstat (limited to 'xmake/modules/core/tools/cl/parse_include.lua')
-rw-r--r--xmake/modules/core/tools/cl/parse_include.lua27
1 files changed, 20 insertions, 7 deletions
diff --git a/xmake/modules/core/tools/cl/parse_include.lua b/xmake/modules/core/tools/cl/parse_include.lua
index 597e033f8..4ca3803e1 100644
--- a/xmake/modules/core/tools/cl/parse_include.lua
+++ b/xmake/modules/core/tools/cl/parse_include.lua
@@ -87,17 +87,30 @@ function get_include_notes()
return notes
end
--- main entry
-function main(line)
+-- has include note?
+function has_include_note(line)
+ local note = _g.note
+ if note then
+ if line:startswith(note) then
+ return note
+ end
+ return
+ end
+
local notes = get_include_notes()
for idx, note in ipairs(notes) do
if line:startswith(note) then
- -- optimization: move this note to head
- if idx ~= 1 then
- table.insert(notes, 1, note)
- end
- return line:sub(#note):trim()
+ _g.note = note
+ return note
end
end
end
+-- parse note includes
+function main(line)
+ local note = has_include_note(line)
+ if note then
+ return line:sub(#note):trim()
+ end
+end
+