Skip to content

Commit

Permalink
Merge branch 'main' into dev/snehara/update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
snehara99 authored Mar 10, 2025
2 parents 9977aed + 7bbf261 commit 981552d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Bug Fixes:

- Fix bug that makes `Configure Task` lists only first folder in workspace. [#3232](https//github.com/microsoft/vscode-cmake-tools/issues/3232)
- Fix displaying "Go to Test" in the Test Explorer when the DEF_SOURCE_LINE property is set, but there is no backtrace information present. [4321](https://github.com/microsoft/vscode-cmake-tools/pull/4321) [@rjaegers](https://github.com/rjaegers)
- Fix gnuld error parsing false positive on make errors, false negative due to trailing \r, and false parsing of new "multiple definitions" error [#2864](https://github.com/microsoft/vscode-cmake-tools/issues/2864) [@0xemgy](https://github.com/0xemgy)

## 1.20.53

Expand Down
10 changes: 7 additions & 3 deletions src/diagnostics/gnu-ld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const regexPatterns: RegexPattern[] = [
regexPattern: /^(?:.*ld(?:\.exe)?:)(?:\s*)?(.+):(\d+):\s+(?:fatal )?(\w+):\s+(.+)/,
matchTypes: [MatchType.Full, MatchType.File, MatchType.Line, MatchType.Severity, MatchType.Message]
},
{ // path/to/ld[.exe]:[ ]path/to/file.obj:path/to/file:line: message
regexPattern: /^(?:.*ld(?:\.exe)?\:)(?:\s*)(?:.+?\.obj:)(.+?):(\d+):\s+(.+)/,
matchTypes: [MatchType.Full, MatchType.File, MatchType.Line, MatchType.Message]
},
{ // path/to/ld[.exe]:[ ]path/to/file:line: message
regexPattern: /^(?:.*ld(?:\.exe)?\:)(?:\s*)?(.+):(\d+):\s+(.+)/,
matchTypes: [MatchType.Full, MatchType.File, MatchType.Line, MatchType.Message]
Expand All @@ -21,11 +25,11 @@ const regexPatterns: RegexPattern[] = [
matchTypes: [MatchType.Full, MatchType.File, MatchType.Severity, MatchType.Message]
},
{ // path/to/ld[.exe]: message (without trailing colon)
regexPattern: /^(.*ld(?:\.exe)?):\s+(.+)(?<!:)$/,
regexPattern: /^(.*ld(?:\.exe)?):\s+(.+)(?<!:)\s*$/,
matchTypes: [MatchType.Full, MatchType.File, MatchType.Message]
},
{ // /path/to/file:line: message (without "[fatal] severity:" or trailing colon)
regexPattern: /^(.+?):(\d+):\s+(?!fatal\s+\w+:)(?!\w+:)(.+)(?<!:)$/,
{ // path/to/file:line: message (with neither "[fatal] severity:" nor trailing colon nor leading "make: *** [" nor leading "make[line]: *** [")
regexPattern: /^(?!\s*make.*:\s\*\*\*\s\[)(.+?):(\d+):\s+(?!fatal\s+\w+:)(?!\w+:)(.+)(?<!:)\s*$/,
matchTypes: [MatchType.Full, MatchType.File, MatchType.Line, MatchType.Message]
}
];
Expand Down
29 changes: 29 additions & 0 deletions test/unit-tests/diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,34 @@ suite('Diagnostics', () => {
expect(path.posix.normalize(diag.file)).to.eq(diag.file);
expect(path.posix.isAbsolute(diag.file)).to.be.false;
});
test('Parsing linker error of type "/path/to/ld: path/to/file.obj:path/to/file:line: message"', () => {
const lines = ['/path/to/ld: path/to/file.obj:path/to/file:42: message'];
feedLines(build_consumer, [], lines);
expect(build_consumer.compilers.gnuld.diagnostics).to.have.length(1);
const diag = build_consumer.compilers.gnuld.diagnostics[0];

expect(diag.location.start.line).to.eq(41);
expect(diag.location.start.character).to.eq(0);
expect(diag.message).to.eq('message');
expect(diag.file).to.eq('path/to/file');
expect(diag.severity).to.eq('error');
expect(path.posix.normalize(diag.file)).to.eq(diag.file);
expect(path.posix.isAbsolute(diag.file)).to.be.false;
});
test('Parsing linker error of type "/path/to/ld.exe: path/to/file.obj:path/to/file:line: message"', () => {
const lines = ['/path/to/ld.exe: path/to/file.obj:path/to/file:42: message'];
feedLines(build_consumer, [], lines);
expect(build_consumer.compilers.gnuld.diagnostics).to.have.length(1);
const diag = build_consumer.compilers.gnuld.diagnostics[0];

expect(diag.location.start.line).to.eq(41);
expect(diag.location.start.character).to.eq(0);
expect(diag.message).to.eq('message');
expect(diag.file).to.eq('path/to/file');
expect(diag.severity).to.eq('error');
expect(path.posix.normalize(diag.file)).to.eq(diag.file);
expect(path.posix.isAbsolute(diag.file)).to.be.false;
});
test('Parsing linker error of type "/path/to/ld: path/to/file:line: message"', () => {
const lines = ['/path/to/ld: path/to/file:42: message'];
feedLines(build_consumer, [], lines);
Expand Down Expand Up @@ -663,6 +691,7 @@ suite('Diagnostics', () => {
];
feedLines(build_consumer, [], lines);
expect(build_consumer.compilers.gcc.diagnostics).to.have.length(0);
expect(build_consumer.compilers.gnuld.diagnostics).to.have.length(0);
});

test('Parse MSVC single proc error', () => {
Expand Down

0 comments on commit 981552d

Please sign in to comment.