]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Get rid of Sy/Sm mixing (Expression)
authorBob Duff <duff@adacore.com>
Wed, 15 Oct 2025 10:43:32 +0000 (06:43 -0400)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 3 Nov 2025 14:15:17 +0000 (15:15 +0100)
commit39ba3bb91312eaa37fbcfb94e5cb7689df7e690f
tree612a63a2ebe577b69fcf354a68b31fb09881312b
parentd5c0cf67b5d34661d461b39cc1683b97bb49e64e
ada: Get rid of Sy/Sm mixing (Expression)

We should not mix "syntactic" and "semantic" for the same field
in different node kinds.

The Expression field was both syntactic (in N_Exception_Declaration) and
semantic (in all other node kinds). This patch makes it always
syntactic.

Expression is the last such field, so we remove all code and comments
that allowed for such mixing.

The Expression field in N_Exception_Declaration was never properly
documented; fix that.

No change in overall compiler behavior.

An alternative would be to change the name of this Expression
field to be something else (Exception_Declaration_Expression?),
and keep it as "semantic". That would cause an earthquake in gigi,
because gigi wants to treat exception declarations more-or-less
like normal object declarations, with the Expression field being
the initialization expression. So we don't do that.

gcc/ada/ChangeLog:

* gen_il-gen-gen_nodes.adb (N_Exception_Declaration):
Change Expression from Sm to Sy, to match other Expression fields.
* gen_il-gen.adb (Setter_Needs_Parent):
Expression no longer needs to be a special case.
(Check_For_Syntactic_Field_Mismatch):
Do not exempt Expression from the Sy/Sm mixing rule.
This was the last such case, so remove all the exemption code.
* gen_il-gen.ads: Update comments to match new code.
* sinfo.ads (N_Exception_Declaration):
Document the meaning of the Expression field, because it
doesn't follow from the RM syntax of exception_declaration.
* exp_ch11.adb: Minor comment fixes.
gcc/ada/exp_ch11.adb
gcc/ada/gen_il-gen-gen_nodes.adb
gcc/ada/gen_il-gen.adb
gcc/ada/gen_il-gen.ads
gcc/ada/sinfo.ads