diff options
| author | ruki <[email protected]> | 2017-08-04 10:21:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-08-04 10:21:50 +0800 |
| commit | 9e1b8493ee65cd59d524c95fd2e7f6af8265e60e (patch) | |
| tree | b1c87a57d47421e1e98e1d7562d7b244ea7b7b56 /xmake/modules | |
| parent | a4304caad7f2609865d5127951642426cbd0453d (diff) | |
improve gcc error tips
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 0c8b96226..d07201362 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -400,23 +400,20 @@ function _compile1(self, sourcefile, objectfile, depinfo, flags) -- try removing the old object file for forcing to rebuild this source file os.tryrm(objectfile) - -- attempt to find first error - if not option.get("verbose") then - - -- find the start line of error - local lines = errors:split("\n") - local start = 1 - for index, line in ipairs(lines) do - if line:find("error:", 1, true) then - start = index - break - end + -- 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 - -- get 16 lines of errors - if #lines - start > 16 then - errors = table.concat(table.slice(lines, start, start + 16), "\n") - 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") end -- raise compiling errors |
