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 --- lib/CodeGen/ArithmeticHandler.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/CodeGen/ArithmeticHandler.cc') diff --git a/lib/CodeGen/ArithmeticHandler.cc b/lib/CodeGen/ArithmeticHandler.cc index 255da57..480c963 100644 --- a/lib/CodeGen/ArithmeticHandler.cc +++ b/lib/CodeGen/ArithmeticHandler.cc @@ -29,7 +29,7 @@ Value *ArithmeticHandler::emitBinaryOp(int Op, Value *LHS, Value *RHS, int Line) if (LVal->getType()->isIntegerTy(64)) LVal = Builder.CreateSIToFP(LVal, Type::getDoubleTy(Context)); if (RVal->getType()->isIntegerTy(64)) RVal = Builder.CreateSIToFP(RVal, Type::getDoubleTy(Context)); if (!LVal->getType()->isDoubleTy() || !RVal->getType()->isDoubleTy()) { - cps::sourceDiagnostic(Line, "error: '/' requires numeric operands (line %d).\n", Line); + cps::sourceError(Line, "'/' requires numeric operands"); HadError = true; return nullptr; } @@ -40,7 +40,7 @@ Value *ArithmeticHandler::emitBinaryOp(int Op, Value *LHS, Value *RHS, int Line) if (Op == tok_div || Op == tok_mod) { if (!LIsInt || !RIsInt) { - cps::sourceDiagnostic(Line, "error: DIV and MOD operators require INTEGER operands (line %d).\n", Line); + cps::sourceError(Line, "DIV and MOD operators require INTEGER operands"); HadError = true; return nullptr; } @@ -97,7 +97,7 @@ Value *ArithmeticHandler::emitBinaryOp(int Op, Value *LHS, Value *RHS, int Line) R = widenSmallInt(Builder, Context, R); } if (L->getType() != R->getType()) { - cps::sourceDiagnostic(Line, "error: Mismatched operand types for binary operator (line %d).\n", Line); + cps::sourceError(Line, "Mismatched operand types for binary operator"); HadError = true; return nullptr; } @@ -115,7 +115,7 @@ Value *ArithmeticHandler::emitBinaryOp(int Op, Value *LHS, Value *RHS, int Line) } } - cps::sourceDiagnostic(Line, "error: Unsupported operand types for binary operator (line %d).\n", Line); + cps::sourceError(Line, "Unsupported operand types for binary operator"); HadError = true; return nullptr; } -- cgit v1.3.1-4-g156e