[gcc(refs/users/guojiufu/heads/guojiufu-branch)] [Ada] Reject illegal bodies for null procedures

Jiu Fu Guo guojiufu@gcc.gnu.org
Sat Jun 13 02:50:12 GMT 2020


https://gcc.gnu.org/g:71c4a2b35600a1177542b293cf075d6cf6d4dae4

commit 71c4a2b35600a1177542b293cf075d6cf6d4dae4
Author: Ghjuvan Lacambre <lacambre@adacore.com>
Date:   Mon Mar 2 12:41:52 2020 +0100

    [Ada] Reject illegal bodies for null procedures
    
    2020-06-10  Ghjuvan Lacambre  <lacambre@adacore.com>
    
    gcc/ada/
    
            * par-ch6.adb (P_Subprogram): Reject duplicate subprogram
            declarations.

Diff:
---
 gcc/ada/par-ch6.adb | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index 2cc3f08f94a..a43d6735668 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -959,6 +959,13 @@ package body Ch6 is
          --  the collected aspects, if any, to the body.
 
          if Token = Tok_Is then
+
+            --  If the subprogram declaration already has a specification, we
+            --  can't define another.
+            if Null_Present (Specification (Decl_Node)) then
+               Error_Msg_AP ("null procedure cannot have a body");
+            end if;
+
             Scan;
             goto Subprogram_Body;


More information about the Gcc-cvs mailing list