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 --- include/cps/Diagnostics.h | 66 ++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 32 deletions(-) (limited to 'include/cps/Diagnostics.h') diff --git a/include/cps/Diagnostics.h b/include/cps/Diagnostics.h index 6f26292..3492f46 100644 --- a/include/cps/Diagnostics.h +++ b/include/cps/Diagnostics.h @@ -2,43 +2,45 @@ #include #include #include -#include namespace cps { -// Empty for single-source builds to preserve existing diagnostic text. +enum class Severity { Error, Warning, Note, Fatal }; + +// Path of the unit being diagnosed, as given on the command line. inline std::string DiagnosticSource; -inline std::string lineSuffix(int Line) { - return " at line " + std::to_string(Line) + - (DiagnosticSource.empty() ? "" : " in " + DiagnosticSource); + +// gcc layout: ":