diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2024-03-19 11:22:40 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-10 11:03:58 +0200 |
commit | 025fd3eabc12a5b5ee63b607a2fa26aafb3a39b4 (patch) | |
tree | a215ce1f8bde2962e5bfee517916c0a1c9488fe0 /gcc | |
parent | b849df9a981065fd119d0e4c4d0b6ec1d67bea73 (diff) | |
download | gcc-025fd3eabc12a5b5ee63b607a2fa26aafb3a39b4.zip gcc-025fd3eabc12a5b5ee63b607a2fa26aafb3a39b4.tar.gz gcc-025fd3eabc12a5b5ee63b607a2fa26aafb3a39b4.tar.bz2 |
ada: Simplify check for type without stream operations
Recursive routine Type_Without_Stream_Operation was checking restriction
No_Default_Stream_Attributes at every call, which was confusing and
inefficient.
This routine is only called from the places: Check_Stream_Attribute,
which already checks if this restriction is active, and
Stream_Operation_OK, where we add such a check.
Cleanup related to extending the use of No_Streams restriction.
gcc/ada/
* exp_ch3.adb (Stream_Operation_OK): Check restriction
No_Default_Stream_Attributes before call to
Type_Without_Stream_Operation.
* sem_util.adb (Type_Without_Stream_Operation): Remove static
condition from recursive routine
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch3.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 8ddae1e..f9dd091 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -12912,7 +12912,9 @@ package body Exp_Ch3 is and then No (No_Tagged_Streams_Pragma (Typ)) and then not No_Run_Time_Mode and then RTE_Available (RE_Tag) - and then No (Type_Without_Stream_Operation (Typ)) + and then + (not Restriction_Active (No_Default_Stream_Attributes) + or else No (Type_Without_Stream_Operation (Typ))) and then RTE_Available (RE_Root_Stream_Type); end Stream_Operation_OK; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 15994b4..241be3d 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -28557,10 +28557,6 @@ package body Sem_Util is Op_Missing : Boolean; begin - if not Restriction_Active (No_Default_Stream_Attributes) then - return Empty; - end if; - if Is_Elementary_Type (T) then if Op = TSS_Null then Op_Missing := |