aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2009-04-09 10:45:44 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-09 12:45:44 +0200
commitd7ba4df490028a6cec281e104faaba40822f55c1 (patch)
treefb21360fbb3e4a11c474ee56e7825883679abbcc /gcc/ada
parent923e6ff331d3e4c0109529937c5ee589dfbe93b8 (diff)
downloadgcc-d7ba4df490028a6cec281e104faaba40822f55c1.zip
gcc-d7ba4df490028a6cec281e104faaba40822f55c1.tar.gz
gcc-d7ba4df490028a6cec281e104faaba40822f55c1.tar.bz2
sem_ch7.adb, [...]: Code clean up...
2009-04-09 Robert Dewar <dewar@adacore.com> * sem_ch7.adb, sem_ch10.adb, sem_prag.adb, sem_ch12.adb, sem_util.adb, exp_ch13.adb, sem_ch6.adb, exp_disp.adb, sem_ch8.adb, sem_warn.adb, sem_cat.adb: Code clean up: use Is_Package_Or_Generic_Package where possible to replace an OR of two separate tests. From-SVN: r145823
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_ch8.adb3
-rw-r--r--gcc/ada/sem_prag.adb65
-rw-r--r--gcc/ada/sem_warn.adb2
4 files changed, 34 insertions, 43 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index fe58ae8..7db0fd4 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,12 @@
2009-04-09 Robert Dewar <dewar@adacore.com>
+ * sem_ch7.adb, sem_ch10.adb, sem_prag.adb, sem_ch12.adb, sem_util.adb,
+ exp_ch13.adb, sem_ch6.adb, exp_disp.adb, sem_ch8.adb, sem_warn.adb,
+ sem_cat.adb: Code clean up: use Is_Package_Or_Generic_Package where
+ possible to replace an OR of two separate tests.
+
+2009-04-09 Robert Dewar <dewar@adacore.com>
+
* binderr.adb, errout.adb, errutil.adb: New circuitry for handling
Maximum_Messages.
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index c34b073..fa70844 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -6757,8 +6757,7 @@ package body Sem_Ch8 is
Full_Vis := True;
elsif Is_Package_Or_Generic_Package (S)
- and then (In_Private_Part (S)
- or else In_Package_Body (S))
+ and then (In_Private_Part (S) or else In_Package_Body (S))
then
Full_Vis := True;
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index c9500f8..af25b14 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -1269,10 +1269,9 @@ package body Sem_Prag is
elsif Nkind (P) = N_Handled_Sequence_Of_Statements then
exit;
- elsif Nkind (P) = N_Package_Specification then
- return;
-
- elsif Nkind (P) = N_Block_Statement then
+ elsif Nkind_In (P, N_Package_Specification,
+ N_Block_Statement)
+ then
return;
-- Note: the following tests seem a little peculiar, because
@@ -3540,8 +3539,8 @@ package body Sem_Prag is
elsif (C = Convention_Java or else C = Convention_CIL)
and then
(Is_Package_Or_Generic_Package (Def_Id)
- or else Ekind (Def_Id) = E_Exception
- or else Nkind (Parent (Def_Id)) = N_Component_Declaration)
+ or else Ekind (Def_Id) = E_Exception
+ or else Nkind (Parent (Def_Id)) = N_Component_Declaration)
then
Set_Imported (Def_Id);
Set_Is_Public (Def_Id);
@@ -6580,9 +6579,8 @@ package body Sem_Prag is
Cunit_Node := Cunit (Current_Sem_Unit);
Cunit_Ent := Cunit_Entity (Current_Sem_Unit);
- if Nkind (Unit (Cunit_Node)) = N_Package_Body
- or else
- Nkind (Unit (Cunit_Node)) = N_Subprogram_Body
+ if Nkind_In (Unit (Cunit_Node), N_Package_Body,
+ N_Subprogram_Body)
then
Error_Pragma ("pragma% must refer to a spec, not a body");
else
@@ -7417,9 +7415,8 @@ package body Sem_Prag is
begin
GP := Parent (Parent (N));
- if Nkind (GP) = N_Package_Declaration
- or else
- Nkind (GP) = N_Generic_Package_Declaration
+ if Nkind_In (GP, N_Package_Declaration,
+ N_Generic_Package_Declaration)
then
GP := Parent (GP);
end if;
@@ -8082,9 +8079,7 @@ package body Sem_Prag is
Preanalyze_Spec_Expression (Arg, RTE (RE_Interrupt_Priority));
end if;
- if Nkind (P) /= N_Task_Definition
- and then Nkind (P) /= N_Protected_Definition
- then
+ if not Nkind_In (P, N_Task_Definition, N_Protected_Definition) then
Pragma_Misplaced;
return;
@@ -9261,8 +9256,8 @@ package body Sem_Prag is
and then Nkind (Decl) not in N_Generic_Declaration
then
Error_Pragma
- ("pragma% misplaced, " &
- "must immediately follow a declaration");
+ ("pragma% misplaced, "
+ & "must immediately follow a declaration");
else
Set_Obsolescent (Defining_Entity (Decl));
@@ -9797,10 +9792,7 @@ package body Sem_Prag is
-- Task or Protected, must be of type Integer
- elsif Nkind (P) = N_Protected_Definition
- or else
- Nkind (P) = N_Task_Definition
- then
+ elsif Nkind_In (P, N_Protected_Definition, N_Task_Definition) then
Arg := Expression (Arg1);
-- The expression must be analyzed in the special manner
@@ -9824,10 +9816,7 @@ package body Sem_Prag is
else
Set_Has_Priority_Pragma (P, True);
- if Nkind (P) = N_Protected_Definition
- or else
- Nkind (P) = N_Task_Definition
- then
+ if Nkind_In (P, N_Protected_Definition, N_Task_Definition) then
Record_Rep_Item (Defining_Identifier (Parent (P)), N);
-- exp_ch9 should use this ???
end if;
@@ -10073,10 +10062,7 @@ package body Sem_Prag is
X : constant Node_Id := Original_Node (Arg);
begin
- if Nkind (X) /= N_String_Literal
- and then
- Nkind (X) /= N_Identifier
- then
+ if not Nkind_In (X, N_String_Literal, N_Identifier) then
Error_Pragma_Arg
("inappropriate argument for pragma %", Arg);
end if;
@@ -10223,6 +10209,7 @@ package body Sem_Prag is
if not GNAT_Mode then
Error_Pragma ("pragma% only available in GNAT mode");
end if;
+
if Nkind (N) = N_Null_Statement then
return;
end if;
@@ -10444,12 +10431,11 @@ package body Sem_Prag is
Cunit_Node := Cunit (Current_Sem_Unit);
Cunit_Ent := Cunit_Entity (Current_Sem_Unit);
- if Nkind (Unit (Cunit_Node)) /= N_Package_Declaration
- and then
- Nkind (Unit (Cunit_Node)) /= N_Generic_Package_Declaration
+ if not Nkind_In (Unit (Cunit_Node), N_Package_Declaration,
+ N_Generic_Package_Declaration)
then
- Error_Pragma (
- "pragma% can only apply to a package declaration");
+ Error_Pragma
+ ("pragma% can only apply to a package declaration");
end if;
Set_Is_Remote_Types (Cunit_Ent);
@@ -10576,12 +10562,11 @@ package body Sem_Prag is
Cunit_Node := Cunit (Current_Sem_Unit);
Cunit_Ent := Cunit_Entity (Current_Sem_Unit);
- if Nkind (Unit (Cunit_Node)) /= N_Package_Declaration
- and then
- Nkind (Unit (Cunit_Node)) /= N_Generic_Package_Declaration
+ if not Nkind_In (Unit (Cunit_Node), N_Package_Declaration,
+ N_Generic_Package_Declaration)
then
- Error_Pragma (
- "pragma% can only apply to a package declaration");
+ Error_Pragma
+ ("pragma% can only apply to a package declaration");
end if;
Set_Is_Shared_Passive (Cunit_Ent);
@@ -12154,7 +12139,7 @@ package body Sem_Prag is
and then
(Is_Generic_Instance (Result)
or else Nkind (Parent (Declaration_Node (Result))) =
- N_Subprogram_Renaming_Declaration)
+ N_Subprogram_Renaming_Declaration)
and then Present (Alias (Result))
loop
Result := Alias (Result);
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 31f931e..1061174 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -1301,7 +1301,7 @@ package body Sem_Warn is
(Ekind (E1) = E_Package
and then
not Is_Package_Or_Generic_Package
- (Cunit_Entity (Current_Sem_Unit))))
+ (Cunit_Entity (Current_Sem_Unit))))
-- Exclude instantiations, since there is no reason why every
-- entity in an instantiation should be referenced.