aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2018-01-11 08:54:26 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-01-11 08:54:26 +0000
commited27b86ba18a1ffed8ae002412250f0765ab3e72 (patch)
tree9b8d4fcb251784a5801cf49533fcb736cd9f87fe /gcc/ada
parent715a5d519184ef4251d590ef874e2ef493e92ffe (diff)
downloadgcc-ed27b86ba18a1ffed8ae002412250f0765ab3e72.zip
gcc-ed27b86ba18a1ffed8ae002412250f0765ab3e72.tar.gz
gcc-ed27b86ba18a1ffed8ae002412250f0765ab3e72.tar.bz2
[Ada] Missing diagnostic of categorization dependency
This patch modifies the analysis of subprogram bodies to catch a case where a pure subprogram body unit depends on non-pure units. 2018-01-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Check the categorization of a subprogram body which does not complete a previous declaration. gcc/testsuite/ * gnat.dg/pure_subp_body.adb, gnat.dg/pure_subp_body_pkg.ads: New testcase. From-SVN: r256516
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_ch6.adb8
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2bc53d7..fd0a8d3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,11 @@
2018-01-11 Hristian Kirtchev <kirtchev@adacore.com>
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Check the
+ categorization of a subprogram body which does not complete a previous
+ declaration.
+
+2018-01-11 Hristian Kirtchev <kirtchev@adacore.com>
+
* sem_ch10.adb (Check_Private_Child_Unit): Ensure that the enclosing
scope of package Ada is Standard.
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 1c0495f..186467d 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2017, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -4463,6 +4463,12 @@ package body Sem_Ch6 is
Set_First_Entity (Spec_Id, Empty);
Set_Last_Entity (Spec_Id, Empty);
end if;
+
+ -- Otherwise the body does not complete a previous declaration. Check
+ -- the categorization of the body against the units it withs.
+
+ else
+ Validate_Categorization_Dependency (N, Body_Id);
end if;
Check_Missing_Return;