Skip to content

Define package body symbol #231

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2019

Conversation

xbauch
Copy link
Contributor

@xbauch xbauch commented May 17, 2019

This is a refactor of #230 with updated golden results. Copy of its description:

In Do_Compilation_Unit the return value Unit_Symbol was not set for a package body

To determine a symbol value for a package body a symbol is determined from
its specification and registered in the symbol table. This required checking for
the package being a child.

Note: The same check may be required for child subprograms!

-- Now compile the body of the subprogram
Unit_Symbol.Value := Do_Subprogram_Or_Block (U);
-- Now compile the body of the subprogram
Unit_Symbol.Value := Do_Subprogram_Or_Block (U);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be the elaboration code for the package?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It just gives a valid symbol. In the code for Do_Compilation_Unit this symbol is inserted into the symbol table. I did not try to rewrite the existing code of Do_Compilation_Unit, just provide a valid symbol to insert.

The elaboration code needs further thought. We need to provide initialisation code which can be called prior to calling the designated main program.

Copy link
Contributor

@NlightNFotis NlightNFotis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hannes-steffenhagen-diffblue
Copy link
Contributor

I still don't quite understand what we need a package symbol in the symbol table for

@chrisr-diffblue
Copy link
Contributor

@xbauch @tjj2017 - Does this PR replace/supeceed/subsume #230, or is it just dependent on #230? If it replaces #230 could you please close the #230 PR - or alternatively, if this PR has now been merged into #230, could this one be closed :-) I'd just like to be clear one which of these two PRs needs to be merged :-)

@chrisr-diffblue chrisr-diffblue changed the title Define package body symbol Define package body symbol [maybe depends on #231 ?] Jun 4, 2019
@chrisr-diffblue chrisr-diffblue changed the title Define package body symbol [maybe depends on #231 ?] Define package body symbol [maybe depends on #230 ?] Jun 4, 2019
@tjj2017
Copy link
Collaborator

tjj2017 commented Jun 4, 2019

This PR supersedes PR #230. I have rebased this branch with the latest diff/blue master.

@chrisr-diffblue chrisr-diffblue changed the title Define package body symbol [maybe depends on #230 ?] Define package body symbol Jun 4, 2019
@xbauch xbauch force-pushed the feature/define-package-body-symbol branch from 65cb551 to bafda79 Compare June 5, 2019 08:18
@xbauch
Copy link
Contributor Author

xbauch commented Jun 5, 2019

@chrisr-diffblue and @tjj2017 Well I rebased (and updated the golden results) but @hannes-steffenhagen-diffblue's question is still open, i.e. why do we need the package symbol in the symbol table?

@xbauch xbauch removed their assignment Jun 5, 2019
xbauch pushed a commit to xbauch/gnat2goto that referenced this pull request Jun 6, 2019
@chrisr-diffblue
Copy link
Contributor

In the interests of reducing the backlog of PRs we have, I think we should merge this and then discuss/resolve the question of why/whether we need the package symbol in the symbol table separately.

tjj2017 and others added 2 commits June 7, 2019 10:38
to Unit_Symbol for a package body.

To determine a symbol value for a package body a symbol is determined from
its specification and registered in the symbol table. This required checking for
the package being a child.

N.b.: The same check may be required for child subprograms!
@xbauch xbauch force-pushed the feature/define-package-body-symbol branch from bafda79 to a6aacc3 Compare June 7, 2019 09:41
@xbauch xbauch merged commit bad10de into diffblue:master Jun 7, 2019
@xbauch xbauch deleted the feature/define-package-body-symbol branch June 10, 2019 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants