Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix return array size specifications being ignored in operator declarations #686

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Daniel-Cortez
Copy link
Contributor

What this PR does / why we need it:

Fixes return array size specifications being silently ignored in new-style operator declarations (see #685) and makes the compiler treat such specifications as errors.

Which issue(s) this PR fixes:

Fixes #685

What kind of pull this is:

  • A Bug Fix
  • A New Feature
  • Some repository meta (documentation, etc)
  • Other

Additional Documentation:

@Daniel-Cortez Daniel-Cortez requested a review from a team as a code owner October 9, 2021 15:14
@YashasSamaga YashasSamaga linked an issue Oct 9, 2021 that may be closed by this pull request
@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the state: stale label Jan 9, 2022
@Y-Less
Copy link
Member

Y-Less commented Feb 2, 2022

@Daniel-Cortez Just to tell you (don't know a better way to contact you), I'm going to go through the backlog this week and try release 3.10.11 on 08/02, since it is exactly 2 years since 3.10.10. Seems appropriate.

@stale stale bot removed the state: stale label Feb 2, 2022
@DEntis-T
Copy link

Did you mean 3.11? 3.10.11 just seems kind of wrong to me...

@Y-Less
Copy link
Member

Y-Less commented Mar 8, 2022

@DEntis-T: No

@Daniel-Cortez:

1>Running gh_685... FAILED
1>Test gh_685 failed for the following reason: Error output didn't match
1>
1>Expected errors:
1>
1>gh_685.pwn(1): error 010: invalid function or declaration
1>gh_685.pwn(2): error 010: invalid function or declaration
1>
1>Actual errors:
1>
1>gh_685.pwn(1): error 010: invalid function or declaration
1>gh_685.pwn(2): error 010: invalid function or declaration
1>Assertion failed: parent_sym->ident==iREFARRAY, file C:\Users\Alex\Documents\SA-MP\pawn\source\compiler\sc2.c, line 3229
1>

Which is:

    case iREFARRAY:
      /* a global iREFARRAY symbol is the return value of a function: delete
       * this only if "globals" must be deleted; other iREFARRAY instances
       * (locals) are also deleted
       */
      mustdelete=(sym->vclass==sGLOBAL) ? delete_functions : TRUE;
      for (parent_sym=sym->parent; parent_sym!=NULL && parent_sym->ident!=iFUNCTN; parent_sym=parent_sym->parent)
        assert(parent_sym->ident==iREFARRAY);
      assert(parent_sym==NULL || (parent_sym->ident==iFUNCTN && parent_sym->parent==NULL));
      if (sym->vclass==sGLOBAL) {
        assert(parent_sym!=NULL && parent_sym->ident==iFUNCTN);
        if ((parent_sym->usage & uNATIVE)!=0) {
          /* native functions aren't preserved (see the comment under the
           * 'iFUNCTN' case below), so the array must be deleted as well */
          mustdelete=TRUE;
        } /* if */
      } /* if */
      break;
        assert(parent_sym->ident==iREFARRAY);

@Daniel-Cortez
Copy link
Contributor Author

Daniel-Cortez commented Jul 31, 2022

@Daniel-Cortez Just to tell you (don't know a better way to contact you), I'm going to go through the backlog this week and try release 3.10.11 on 08/02, since it is exactly 2 years since 3.10.10. Seems appropriate.

@Y-Less
Well, I tried to contact you via Discord, sent you a friend request a few months ago, but you didn't answer.
Anyway, is https://github.com/openmultiplayer/compiler the actual repo for the compiler now? If so, should I move my PRs there?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

native operators overload can return arrays
3 participants