aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-05-18 06:00:31 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-08 10:55:52 -0400
commitcf6bd6a3ef104abb96095c5d78bffed1a95896f5 (patch)
tree3bdf5eb2cd769745323888eae2338d1f32197bde
parent4b5838e086b0e38f3398268b001b936b600f2e5b (diff)
downloadgcc-cf6bd6a3ef104abb96095c5d78bffed1a95896f5.zip
gcc-cf6bd6a3ef104abb96095c5d78bffed1a95896f5.tar.gz
gcc-cf6bd6a3ef104abb96095c5d78bffed1a95896f5.tar.bz2
[Ada] ACATS 4.1R - BD10001 - Error missed
gcc/ada/ * sem_prag.adb (Process_Inline): Check for duplicate pragma+aspect Inline. Minor code cleanup. (Check_Duplicate_Pragma): Add warning for duplicate pragma [No_]Inline under -gnatwr. * sinfo.ads, sinfo.adb (Next_Rep_Item): Allow N_Null_Statement which can appear when a pragma is rewritten. * sem_util.ads, sem_util.adb, bindo-writers.adb: Fix bad copy/paste now flagged. * libgnat/s-mmap.ads: Remove redundant pragma Inline.
-rw-r--r--gcc/ada/bindo-writers.adb2
-rw-r--r--gcc/ada/libgnat/s-mmap.ads2
-rw-r--r--gcc/ada/sem_prag.adb27
-rw-r--r--gcc/ada/sem_util.adb2
-rw-r--r--gcc/ada/sem_util.ads2
-rw-r--r--gcc/ada/sinfo.adb2
-rw-r--r--gcc/ada/sinfo.ads7
7 files changed, 34 insertions, 10 deletions
diff --git a/gcc/ada/bindo-writers.adb b/gcc/ada/bindo-writers.adb
index 298118e..88c8b25 100644
--- a/gcc/ada/bindo-writers.adb
+++ b/gcc/ada/bindo-writers.adb
@@ -1037,7 +1037,7 @@ package body Bindo.Writers is
-- output.
procedure Write_Components (G : Library_Graph);
- pragma Inline (Write_Component);
+ pragma Inline (Write_Components);
-- Write all components of library graph G to standard output
procedure Write_Edges_To_Successors
diff --git a/gcc/ada/libgnat/s-mmap.ads b/gcc/ada/libgnat/s-mmap.ads
index a9e776f..305d1f8 100644
--- a/gcc/ada/libgnat/s-mmap.ads
+++ b/gcc/ada/libgnat/s-mmap.ads
@@ -223,13 +223,11 @@ package System.Mmap is
-- (File); such accesses may cause Storage_Error to be raised.
function Data (Region : Mapped_Region) return Str_Access;
- pragma Inline (Data);
-- The data mapped in Region as requested. The result is an unconstrained
-- string, so you cannot use the usual 'First and 'Last attributes.
-- Instead, these are respectively 1 and Size.
function Data (File : Mapped_File) return Str_Access;
- pragma Inline (Data);
-- Likewise for the region contained in File
function Is_Mutable (Region : Mapped_Region) return Boolean;
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 95a1173..db9c611 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -5905,7 +5905,18 @@ package body Sem_Prag is
then
Error_Msg_NE ("aspect% for & previously given#", N, Id);
else
- Error_Msg_NE ("pragma% for & duplicates pragma#", N, Id);
+ -- If -gnatwr is set, warn in case of a duplicate pragma
+ -- [No_]Inline which is suspicious but not an error, generate
+ -- an error for other pragmas.
+
+ if Nam_In (Pragma_Name (N), Name_Inline, Name_No_Inline) then
+ if Warn_On_Redundant_Constructs then
+ Error_Msg_NE
+ ("?r?pragma% for & duplicates pragma#", N, Id);
+ end if;
+ else
+ Error_Msg_NE ("pragma% for & duplicates pragma#", N, Id);
+ end if;
end if;
raise Pragma_Exit;
@@ -10127,6 +10138,18 @@ package body Sem_Prag is
Applies := True;
else
+ -- Check for RM 13.1(9.2/4): If a [...] aspect_specification
+ -- is given that directly specifies an aspect of an entity,
+ -- then it is illegal to give another [...]
+ -- aspect_specification that directly specifies the same
+ -- aspect of the entity.
+ -- We only check Subp directly as per "directly specifies"
+ -- above and because the case of pragma Inline is really
+ -- special given its pre aspect usage.
+
+ Check_Duplicate_Pragma (Subp);
+ Record_Rep_Item (Subp, N);
+
Make_Inline (Subp);
-- For the pragma case, climb homonym chain. This is
@@ -10138,8 +10161,8 @@ package body Sem_Prag is
while Present (Homonym (Subp))
and then Scope (Homonym (Subp)) = Current_Scope
loop
- Make_Inline (Homonym (Subp));
Subp := Homonym (Subp);
+ Make_Inline (Subp);
end loop;
end if;
end if;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 89b6452..7ec52b3 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -21407,7 +21407,7 @@ package body Sem_Util is
-- New_Id is the corresponding new entity generated during Phase 1.
procedure Add_Pending_Itype (Assoc_Nod : Node_Id; Itype : Entity_Id);
- pragma Inline (Add_New_Entity);
+ pragma Inline (Add_Pending_Itype);
-- Add an entry in the NCT_Pending_Itypes which maps key Assoc_Nod to
-- value Itype. Assoc_Nod is the associated node of an itype. Itype is
-- an itype.
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index b467e26..99ceec0 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -2512,7 +2512,7 @@ package Sem_Util is
-- with the same mode.
procedure Next_Global (Node : in out Node_Id);
- pragma Inline (Next_Actual);
+ pragma Inline (Next_Global);
-- Next_Global (N) is equivalent to N := Next_Global (N). Note that we
-- inline this procedural form, but not the functional form above.
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index 7284a06..9199af4 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -2547,6 +2547,7 @@ package body Sinfo is
or else NT (N).Nkind = N_Aspect_Specification
or else NT (N).Nkind = N_Attribute_Definition_Clause
or else NT (N).Nkind = N_Enumeration_Representation_Clause
+ or else NT (N).Nkind = N_Null_Statement
or else NT (N).Nkind = N_Pragma
or else NT (N).Nkind = N_Record_Representation_Clause);
return Node5 (N);
@@ -6034,6 +6035,7 @@ package body Sinfo is
or else NT (N).Nkind = N_Aspect_Specification
or else NT (N).Nkind = N_Attribute_Definition_Clause
or else NT (N).Nkind = N_Enumeration_Representation_Clause
+ or else NT (N).Nkind = N_Null_Statement
or else NT (N).Nkind = N_Pragma
or else NT (N).Nkind = N_Record_Representation_Clause);
Set_Node5 (N, Val); -- semantic field, no parent set
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 1dd31b0..9ae8ce7 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -2081,9 +2081,9 @@ package Sinfo is
-- Next_Rep_Item (Node5-Sem)
-- Present in pragma nodes, attribute definition nodes, enumeration rep
- -- clauses, record rep clauses, aspect specification nodes. Used to link
- -- representation items that apply to an entity. See full description of
- -- First_Rep_Item field in Einfo for further details.
+ -- clauses, record rep clauses, aspect specification and null statement
+ -- nodes. Used to link representation items that apply to an entity. See
+ -- full description of First_Rep_Item field in Einfo for further details.
-- Next_Use_Clause (Node3-Sem)
-- While use clauses are active during semantic processing, they are
@@ -4848,6 +4848,7 @@ package Sinfo is
-- N_Null_Statement
-- Sloc points to NULL
+ -- Next_Rep_Item (Node5-Sem)
----------------
-- 5.1 Label --