From b4ffb2d9498560557821714e2d4651279dd6817c Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 21 Oct 2026 14:03:31 +0000 Subject: feat(diagnostics): print source diagnostics in gcc file:line: layout Lexer, parser, driver and codegen diagnostics now read ":: error: " instead of "error: at line N in ". The path is always printed as given on the command line. Call sites pass the bare message to cps::sourceError/sourceWarning, which carry printf format checking; reportError routes through the same helper. The suite iii harness parses the new layout and matches the reason against the message only. iii/template-class-pack-field passed only because its reason regex matched the case path, so it is now case-insensitive. Co-Authored-By: Claude Opus 5.5 --- tests/run.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tests/run.pl') diff --git a/tests/run.pl b/tests/run.pl index 86eff4f..2835d5e 100644 --- a/tests/run.pl +++ b/tests/run.pl @@ -113,18 +113,21 @@ sub check_diagnostics { if (length($result->{stdout})) { push @errors, 'unexpected stdout: ' . show_bytes(substr($result->{stdout}, 0, 1000)); } - # ASCII markers (error:, line N) are matched on raw bytes; the compiler - # emits UTF-8 and ASCII patterns are unaffected by decoding. + # Diagnostics use the gcc layout ":: error: " and are + # matched on raw bytes; the compiler emits UTF-8 and ASCII patterns are + # unaffected by decoding. The non-greedy path keeps Windows "D:/" intact. my @lines = split_records(normalized($result->{stderr})); for my $expectation (@{$expectations}) { my $reason = $expectation->{reason}; my $line_no = $expectation->{line}; + my $file = $expectation->{file}; my @matching = grep { /error:/ && /$reason/ } @lines; my $found = 0; for my $line (@matching) { - my $file = $expectation->{file}; - if ($line =~ /\bline $line_no\b/ && - (!defined($file) || $line =~ /\bline $line_no in \Q$file\E(?:\s|$)/)) { + next unless $line =~ /^(.+?):(\d+): error: (.*)$/; + my ($path, $number, $message) = ($1, $2, $3); + if ($number == $line_no && $message =~ /$reason/ && + (!defined($file) || $path eq $file)) { $found = 1; last; } -- cgit v1.3.1-4-g156e