From: Ghjuvan Lacambre Date: Mon, 2 Mar 2020 11:41:52 +0000 (+0100) Subject: [Ada] Reject illegal bodies for null procedures X-Git-Tag: basepoints/gcc-12~7107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71c4a2b35600a1177542b293cf075d6cf6d4dae4;p=thirdparty%2Fgcc.git [Ada] Reject illegal bodies for null procedures 2020-06-10 Ghjuvan Lacambre gcc/ada/ * par-ch6.adb (P_Subprogram): Reject duplicate subprogram declarations. --- diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 2cc3f08f94a2..a43d6735668e 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;