-
Notifications
You must be signed in to change notification settings - Fork 12
Do cu specs #113
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
Do cu specs #113
Conversation
gnat2goto/driver/tree_walk.adb
Outdated
Unit_Name = "system%s" | ||
then | ||
null; | ||
-- At the moment Standard or System are not processed - to be done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some Put_Line warning about this?
In the message not sure if 'package' or 'unit' might be more appropriate
Put_Line (Standard_Error,
"At the moment Standard or System library units are not processed. ");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take it back: not processing standard/system libraries is not a problem unless you rely on something in them (and then you would get the appropriate error message).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xbauch Nitpick:
Okay. The "if then else" construct begs the question.
To prevent another reader wondering why the null branch of the "if then else" rather than just just "if not" maybe add a clarifying line?
I'll assume the if else then construct is in case in the future we want to consider doing something with standard/system libraries.
case Nkind (N) is | ||
when N_Subprogram_Body => | ||
if Acts_As_Spec (N) then | ||
-- The unit is a withed library unit which subprogram body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest add summary line at top (similar to this)
-- withed library unit that has no separate declaration
(this gives the reader what is common among the scenario discussed below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
6184ba2
to
a8b77a2
Compare
@sonodtt and @hannes-steffenhagen-diffblue I've addressed the comments made here and on xbauch#2. I have added commit messages summarising their content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy if you change the "-- Withed library ..." comment and we can delay the renaming of procedures until my next PR
gnat2goto/driver/tree_walk.adb
Outdated
else | ||
|
||
-- Withed library unit that has no separate declaration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand this comment. These withed library units do have library-level declarations. Any user defined library-level unit must have an explicit declaration whether it is a package, subprogram declaration or just a subprogram body. This is what I tried to explain in the comments under each case.
A more general comment preceding the case statement might be
"-- Handle all other withed library unit declarations"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, changed.
@@ -204,6 +207,12 @@ package body Tree_Walk is | |||
function Do_Op_Not (N : Node_Id) return Irep | |||
with Pre => Nkind (N) in N_Op; | |||
|
|||
procedure Do_Package_Declaration (N : Node_Id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seemed to have introduced a number of procedures starting with Do_* which is not in accordance with the naming convention according to xbauch#2 (comment).
I don't think its worth changing now because it should mean re-ordering the declarations again to keep them in alphabetical order. If it is ok with everyone merge with these names now and I will sort out the naming conventions when I do the next PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tjj2017 I have a small number of queries that are also just minor nitpicks / request for clarification (often just due to my poor knowledge of ADA) that I think should not get in the way of merging what is a great body of work.
I'll ask about these separately - if additional comments are helpful then they can be in a separate minor PR.
89c994a
to
34cd22b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the change of comment. I am happy for you to merge.
@@ -226,6 +226,17 @@ package body Driver is | |||
end; | |||
|
|||
if not Add_Start then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default mode "don't add comments" to this thing I had to figure out what it is doing by looking at the the out parameter in another function.
Status: "on".
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, and noted for the next time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If everyone is happy; let's do this.
Introduces Register_Subprogram_Specification procedure that creates a new symbol table entry with the subprogram name.
Process_Declaration(s) mirror the behaviour of Process_Statement(s), i.e. a case analysis on the kind of declaration stored in the node being processed. This commit also extends the cases in Process_Statement.
Introduces: 1) Do_Package_Declaration 2) Do_Package_Specification -- processes private and visible declarations as a new code block 3) Do_Withed_Unit_Spec -- case analysis for registering program specification/processing subprogram declarations/package declarations 4) Do_Withed_Units_Specs
Also includes cprover_start even when there is no function to call in a CU. Plus one more failing test (package function bodies are not processed).
Mostly Trevor's work, the last commit addresses some issues from xbauch#2 and adds a test for packages.