From 5dbcc40a0370c24b524a6a0ced54def9fe015e67 Mon Sep 17 00:00:00 2001
From: Gaius Mulley <gaiusmod2@gmail.com>
Date: Tue, 24 Oct 2023 23:59:35 +0100
Subject: [PATCH] modula2: tidyup M2Dependent.mod

This patch tidies up M2Dependent.mod by introducing a new procedure
to initialize all fields of DependencyList.

gcc/m2/ChangeLog:

	* gm2-libs/M2Dependent.mod (InitDependencyList): New
	procedure.
	(CreateModule): Call InitDependencyList to initialize
	all fields of DependencyList.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
---
 gcc/m2/gm2-libs/M2Dependent.mod | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/gcc/m2/gm2-libs/M2Dependent.mod b/gcc/m2/gm2-libs/M2Dependent.mod
index 911113fc00bc..19bdab1bc508 100644
--- a/gcc/m2/gm2-libs/M2Dependent.mod
+++ b/gcc/m2/gm2-libs/M2Dependent.mod
@@ -74,6 +74,21 @@ VAR
    ForceTrace           : BOOLEAN ;
 
 
+(*
+   InitDependencyList - initialize all fields of DependencyList.
+*)
+
+PROCEDURE InitDependencyList (VAR depList: DependencyList;
+                              proc: PROC; state: DependencyState) ;
+BEGIN
+   depList.proc := proc ;
+   depList.forced := FALSE ;
+   depList.forc := FALSE ;
+   depList.appl := FALSE ;
+   depList.state := state
+END InitDependencyList ;
+
+
 (*
    CreateModule - creates a new module entry and returns the
                   ModuleChain.
@@ -90,11 +105,7 @@ BEGIN
    mptr^.libname := libname ;
    mptr^.init := init ;
    mptr^.fini := fini ;
-   mptr^.dependency.proc := dependencies ;
-   mptr^.dependency.forced := FALSE ;
-   mptr^.dependency.forc := FALSE ;
-   mptr^.dependency.appl := FALSE ;
-   mptr^.dependency.state := unregistered ;
+   InitDependencyList (mptr^.dependency, dependencies, unregistered) ;
    mptr^.prev := NIL ;
    mptr^.next := NIL ;
    IF HexTrace
-- 
GitLab