Skip to content

Commit e589945

Browse files
committed
[optimize] iar compiler problem matcher
1 parent f2c6e9e commit e589945

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

src/ProblemMatcher.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,22 @@ export function parseKeilc51CompilerLog(projApi: ProjectBaseApi, logfile: File):
276276
return result;
277277
}
278278

279+
//
280+
// example:
281+
// "c:\Users\xxx\plates\iar\startup_stm32f4xx.s",190 Warning[25]: Label 'BusFault_Handler' is defined pubweak in a section implicitly declared root
282+
// "c:\Users\xxxxaster\src\User\main.c",65 Error[Pe065]:
283+
// expected a ";"
284+
// "c:\UsersxxxxAR-master\src\User\main.c",107 Warning[Pe223]:
285+
// function "LCD_2004_Init" declared implicitly
279286
export function parseIarCompilerLog(projApi: ProjectBaseApi, logfile: File): CompilerDiagnostics {
280287

281288
const pattern = {
282-
"regexp": "^\\s*\"([^\"]+)\",(\\d+)\\s+([a-z\\s]+)\\[(\\w+)\\]:",
289+
"regexp": "^\\s*\"([^\"]+)\",(\\d+)\\s+([a-z\\s]+)\\[(\\w+)\\]:(.+)?",
283290
"file": 1,
284291
"line": 2,
285292
"severity": 3,
286-
"code": 4
293+
"code": 4,
294+
"message": 5
287295
};
288296

289297
const matcher = new RegExp(pattern.regexp, 'i');
@@ -295,11 +303,15 @@ export function parseIarCompilerLog(projApi: ProjectBaseApi, logfile: File): Com
295303
const m = matcher.exec(line);
296304
if (m && m.length > 4) {
297305

298-
const fspath = projApi.toAbsolutePath(m[pattern.file]);
299-
const message = ccLogLines[++idx].trim();
300-
const line = parseInt(m[pattern.line]);
306+
const fspath = projApi.toAbsolutePath(m[pattern.file]);
307+
let message = m[pattern.message]?.trim();
308+
const line = parseInt(m[pattern.line]);
301309
const severity = m[pattern.severity].trim();
302-
const errCode = m[pattern.code].trim();
310+
const errCode = m[pattern.code].trim();
311+
312+
if (!message) {
313+
message = ccLogLines[++idx].trim();
314+
}
303315

304316
const diags = result[fspath] || [];
305317
if (result[fspath] == undefined) result[fspath] = diags;

0 commit comments

Comments
 (0)