diff options
author | Bob Duff <duff@adacore.com> | 2025-07-21 09:43:24 -0400 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2025-08-04 15:04:08 +0200 |
commit | 3c3192bcfeecd6f9fdb2a7bd1a044bd9f0a31729 (patch) | |
tree | 89c7d623cd6c0a10b7501743f826538c6da82d38 /libcpp/include | |
parent | 446aac86a4bbdf38868c64410cb0e7823299f98a (diff) | |
download | gcc-3c3192bcfeecd6f9fdb2a7bd1a044bd9f0a31729.zip gcc-3c3192bcfeecd6f9fdb2a7bd1a044bd9f0a31729.tar.gz gcc-3c3192bcfeecd6f9fdb2a7bd1a044bd9f0a31729.tar.bz2 |
ada: Misc parser cleanup
...which might make it easier to deal with incorrectly shared
subtrees created during parsing.
There were several Idents arrays, with duplicated code and commentary.
And the related code had somewhat diverged -- different comments,
different index subtypes (Pos vs. Int), etc.
DRY: Move at least some of the code into Par.Util. Raise
Program_Error if the array overflows; there is really no
reason not to check, along with several comments saying
we don't check. In the unlikely event that the array
overflows, the compiler will now crash, which seems better
than erroneous execution (which could conceivably cause
bad code to be generated).
Move the block comments titled
"Handling Semicolon Used in Place of IS" and
"Handling IS Used in Place of Semicolon" so they
are together, which seems obviously desirable.
Rewrite the latter comment.
No need to denigrate other parsers.
gcc/ada/ChangeLog:
* par.adb: Move and rewrite some comments.
(Util): Shared code and comments for dealing with
defining_identifier_lists.
* par-util.adb (Append): Shared code for appending
one identifier onto Defining_Identifiers.
(P_Def_Ids): Shared code for parsing a defining_identifier_list.
Unfortunately, this is not used in all cases, because some of
them mix in sophisticated error recovery, which we do not
modify here.
* par-ch12.adb (P_Formal_Object_Declarations):
Use Defining_Identifiers and related code.
* par-ch3.adb (P_Identifier_Declarations): Likewise.
(P_Known_Discriminant_Part_Opt): Likewise.
(P_Component_Items): Likewise.
* par-ch6.adb (P_Formal_Part): Likewise.
Diffstat (limited to 'libcpp/include')
0 files changed, 0 insertions, 0 deletions