From 71c4a2b35600a1177542b293cf075d6cf6d4dae4 Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Mon, 2 Mar 2020 12:41:52 +0100 Subject: [PATCH] [Ada] Reject illegal bodies for null procedures 2020-06-10 Ghjuvan Lacambre gcc/ada/ * par-ch6.adb (P_Subprogram): Reject duplicate subprogram declarations. --- 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; -- 2.30.2