summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/gcc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-07-08 20:58:02 +0800
committerruki <[email protected]>2018-07-08 20:58:02 +0800
commitc522037051e329770ce2a489890a7b6ec4cdbc04 (patch)
tree738b9c0cf29b9d52a1263ec7302b84ab7250aaba /xmake/modules/core/tools/gcc.lua
parent9235eb49f5dcfab6052e2a5f958024376d318469 (diff)
improve compile errors output
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
-rw-r--r--xmake/modules/core/tools/gcc.lua28
1 files changed, 16 insertions, 12 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index dbe25a5c2..c4b56c0fc 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -451,20 +451,24 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags)
-- try removing the old object file for forcing to rebuild this source file
os.tryrm(objectfile)
- -- find the start line of error
- local lines = errors:split("\n")
- local start = 0
- for index, line in ipairs(lines) do
- if line:find("error:", 1, true) or line:find("错误:", 1, true) then
- start = index
- break
+ -- parse and strip errors
+ if not option.get("verbose") then
+
+ -- find the start line of error
+ local lines = errors:split("\n")
+ local start = 0
+ for index, line in ipairs(lines) do
+ if line:find("error:", 1, true) or line:find("错误:", 1, true) then
+ start = index
+ break
+ end
end
- end
- -- get 16 lines of errors
- if start > 0 or not option.get("verbose") then
- if start == 0 then start = 1 end
- errors = table.concat(table.slice(lines, start, start + ifelse(#lines - start > 16, 16, #lines - start)), "\n")
+ -- get 16 lines of errors
+ if start > 0 then
+ if start == 0 then start = 1 end
+ errors = table.concat(table.slice(lines, start, start + ifelse(#lines - start > 16, 16, #lines - start)), "\n")
+ end
end
-- raise compiling errors