]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Remove exception handler in Check_Vanishing_Fields
authorBob Duff <duff@adacore.com>
Tue, 7 Oct 2025 14:45:20 +0000 (10:45 -0400)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 3 Nov 2025 14:15:15 +0000 (15:15 +0100)
commit966d132b0a59d2285e5546243907f4eec81e2dce
treeadfb5676e314636a9c7e9e04ca6b34130d322f79
parent3e7ea99b431504dec539a63ec1e9b4ec1ecf4434
ada: Remove exception handler in Check_Vanishing_Fields

Check_Vanishing_Fields calls Same_Node_To_Fetch_From, which was calling
Node_To_Fetch_From, which will raise an exception (as it should) on
..._Type_Only fields if called early (when the Base_Type,
Implementation_Base_Type, or Root_Type has not yet been set).
Other exceptions can also be raised when Check_Vanishing_Fields
is called early.

An exception handler was used to ignore any such exceptions. That was
correct, but it is annoying in gdb with "catch exception". (Note that
efficiency doesn't matter much, because Check_Vanishing_Fields is not
done in production mode.)

We now call Node_To_Fetch_From_If_Set, remove other potential raises,
and remove the now-unnecessary exception handler.

Note that other calls to Node_To_Fetch_From will still raise an
exception (as they should) for such "early" calls.

gcc/ada/ChangeLog:

* atree.adb (Same_Node_To_Fetch_From):
Use Node_To_Fetch_From_If_Set, and remove handler.
* einfo-utils.adb (Root_Type_If_Set):
Return Empty if Base_Type_If_Set returns Empty.
Return Empty if we find Etype (T) = Empty.
(Underlying_Type): Use "Has_Non_Limited_View..." instead
of "Present (Non_Limited_View...)", because the latter raises
an exception when given the wrong Ekind.
gcc/ada/atree.adb
gcc/ada/einfo-utils.adb