adventuregamestudio / ags

AGS editor and engine source code
Other
707 stars 159 forks source link

New compiler: Error message: Undeclared identifier #2516

Closed fernewelten closed 2 months ago

fernewelten commented 2 months ago

Fixes #1839

When an expression is expected and an undeclared symbol follows or comes instead, then this unknown symbol is most probably an identifier whose declaration has been forgotten. Complain with a hand-crafted error message.

Example:

function game_start()
{
    int i;
    while (i < Holzschuh)
    {}
}

→ Identifier 'Holzschuh' is undeclared

fernewelten commented 2 months ago

Taking out the googletest 'Ternary6'; will reinstate that exact test when I release the ternary patch

Edit: I had hoped that this would make the PR pass the acceptance checks, but no luck with that: There are still some googletests that fail with some compiler runs. But as far as I can see, these googletests have nothing to do with the changes in this PR.

ivan-mogilko commented 2 months ago

Taking out the googletest 'Ternary6'; will reinstate that exact test when I release the ternary patch

Could you please comment it rather than completely erasing the code? Or put under #ifdef DISABLED for example?

EDIT: I removed out only these lines of script that do not work, just to keep them for the reference (as I don't know how much time the fix will take).

Could you please rebase your PR with only the first commit? I apologize for this inconvenience.

ivan-mogilko commented 2 months ago

I had hoped that this would make the PR pass the acceptance checks, but no luck with that: There are still some googletests that fail with some compiler runs. But as far as I can see, these googletests have nothing to do with the changes in this PR.

These tests are all run using gcc, as far as I know, including the one for "Windows".

ericoporto commented 2 months ago

Not all, the Windows 32 one runs on MSVC, you can see it's logs.

ivan-mogilko commented 2 months ago

Not all, the Windows 32 one runs on MSVC, you can see it's logs.

Hmm, I got a wrong impression seeing the mention of "Set up MSYS2", but now I see that it's disabled in the "Windows" run.

I have no such errors in MSVS, so wonder what could be the difference?

From the logs I see it's "Visual Studio 17", and looks like it's 64-bit build?

EDIT: tried building for x64 in MSVS 15, there are still no errors in tests.

ericoporto commented 2 months ago

@fernewelten , the issue was figured in https://github.com/adventuregamestudio/ags/issues/2518 and @ivan-mogilko put a fix in #2519 , after that is merged I think you can just rebase to pickup the fix.

Edit: it has been merged so just a rebase should do it!

ivan-mogilko commented 2 months ago

I cherry picked and pushed the commit from this PR into the ags4 branch: b598d5d7842d3af75afa5e27254521b39dfad24f

Will close this PR without merging now.