diff options
| author | ruki <[email protected]> | 2017-08-03 22:45:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-08-03 22:45:18 +0800 |
| commit | a4304caad7f2609865d5127951642426cbd0453d (patch) | |
| tree | 250696f0b5aecdae8f72f332c232b8ee89f1e09e | |
| parent | 6d71de0f76dc5a4971bce3836dd5021f9752bebc (diff) | |
improve gcc errors info
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 4d63e4837..0c8b96226 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -400,11 +400,22 @@ function _compile1(self, sourcefile, objectfile, depinfo, flags) -- try removing the old object file for forcing to rebuild this source file os.tryrm(objectfile) - -- get last 16 lines + -- attempt to find first error if not option.get("verbose") then + + -- find the start line of error local lines = errors:split("\n") - if #lines > 32 then - errors = table.concat(table.slice(lines, #lines - 16), "\n") + local start = 1 + for index, line in ipairs(lines) do + if line:find("error:", 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 end |
