Errors inside macro redefinitions are reported with wrong source locations.

Try uncommenting only {$error 1}, then only {$error 2}, then only {$error 3} in the code below.

{$mode objfpc} {$macro on}

begin
{$define write_something :=
	write('A');
	{2} write('B');
// {$error 1}
	write('C');}
	write_something

// {$undef write_something} // does not help

{$define write_something :=
	write('D');
	write('E');
// {$error 2}
	write('F');}
	write_something

{$define write_something_else :=
	write('G');
	write('H');
// {$error 3}
	write('I');}
	write_something_else
end.

{$error 2} is reported with the wrong location (marked as {2}), as if it was counted from the start of the first write_something definition instead of the actual. {$undef write_something} does not help. Renaming the macro does, but is usually not an option.

Edited by Rika
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information