[gcc r11-5284] [Ada] Use high-level Present instead of low-level equality test
Pierre-Marie de Rodat
pmderodat@gcc.gnu.org
Tue Nov 24 10:17:17 GMT 2020
https://gcc.gnu.org/g:3ac0642304f83feda52d9285083a4e637e33e3d6
commit r11-5284-g3ac0642304f83feda52d9285083a4e637e33e3d6
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Tue Sep 29 11:09:06 2020 +0200
[Ada] Use high-level Present instead of low-level equality test
gcc/ada/
* lib-load.adb, lib-writ.adb, lib.adb, par-load.adb,
rtsfind.adb, sem_ch10.adb: Use Present where possible.
Diff:
---
gcc/ada/lib-load.adb | 2 +-
gcc/ada/lib-writ.adb | 2 +-
gcc/ada/lib.adb | 2 +-
gcc/ada/par-load.adb | 2 +-
gcc/ada/rtsfind.adb | 2 +-
gcc/ada/sem_ch10.adb | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb
index 2598285e198..75226d35ffb 100644
--- a/gcc/ada/lib-load.adb
+++ b/gcc/ada/lib-load.adb
@@ -551,7 +551,7 @@ package body Lib.Load is
-- Note: Unit_Name (Main_Unit) is not set if we are parsing gnat.adc.
if Present (Error_Node)
- and then Unit_Name (Main_Unit) /= No_Unit_Name
+ and then Present (Unit_Name (Main_Unit))
then
-- It seems like In_Extended_Main_Source_Unit (Error_Node) would
-- do the trick here, but that's wrong, it is much too early to
diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb
index 6a63b8fb2b5..f17b46a8ba0 100644
--- a/gcc/ada/lib-writ.adb
+++ b/gcc/ada/lib-writ.adb
@@ -837,7 +837,7 @@ package body Lib.Writ is
-- preprocessing data and definition files, there is no Unit_Name,
-- check for that first.
- if Unit_Name (J) /= No_Unit_Name
+ if Present (Unit_Name (J))
and then (With_Flags (J) or else Unit_Name (J) = Pname)
then
Num_Withs := Num_Withs + 1;
diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb
index 49a352a4e62..d298267e875 100644
--- a/gcc/ada/lib.adb
+++ b/gcc/ada/lib.adb
@@ -275,7 +275,7 @@ package body Lib is
begin
-- First unregister the old name, if any
- if Old_N /= No_Unit_Name and then Unit_Names.Get (Old_N) = U then
+ if Present (Old_N) and then Unit_Names.Get (Old_N) = U then
Unit_Names.Set (Old_N, No_Unit);
end if;
diff --git a/gcc/ada/par-load.adb b/gcc/ada/par-load.adb
index a1857dc5b57..ecd54045e58 100644
--- a/gcc/ada/par-load.adb
+++ b/gcc/ada/par-load.adb
@@ -318,7 +318,7 @@ begin
Spec_Name := Get_Parent_Spec_Name (Unit_Name (Cur_Unum));
- if Spec_Name /= No_Unit_Name then
+ if Present (Spec_Name) then
Unum :=
Load_Unit
(Load_Name => Spec_Name,
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 872ce0165b9..6a0631fc337 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -423,7 +423,7 @@ package body Rtsfind is
(Unit_Name (Current_Sem_Unit));
begin
- if Parent_Name /= No_Unit_Name then
+ if Present (Parent_Name) then
Get_Name_String (Parent_Name);
declare
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 0bad136d3f2..aab186c7665 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -768,7 +768,7 @@ package body Sem_Ch10 is
Unum := Get_Cunit_Unit_Number (N);
Par_Spec_Name := Get_Parent_Spec_Name (Unit_Name (Unum));
- if Par_Spec_Name /= No_Unit_Name then
+ if Present (Par_Spec_Name) then
Unum :=
Load_Unit
(Load_Name => Par_Spec_Name,
More information about the Gcc-cvs
mailing list