Tidy up to declarations allowing files to be built by gm2
authorGaius Mulley <gaiusmod2@gmail.com>
Fri, 27 Jan 2023 16:38:29 +0000 (16:38 +0000)
committerGaius Mulley <gaiusmod2@gmail.com>
Fri, 27 Jan 2023 16:38:29 +0000 (16:38 +0000)
This patch adds missing declarations in export qualified lists
and fixes comparisons of an address type against NIL.
These changes allow make m2/stage2/cc1gm2 to succeed when in
maintainer mode.

gcc/m2/ChangeLog:

* gm2-compiler/M2Options.def: Export GetMQ, SetMQ.
* gm2-compiler/M2Preprocess.mod: (MakeSaveTempsFileName):
Test NewDir against NIL.  Test Dumpdir against NIL.
Test GetMD () against NIL.  Test GetMMD () against NIL.
Test GetMQ () against NIL.  Test GetObj () against NIL.
Test tempfile against NIL.
* gm2-compiler/P2SymBuild.def: Export
BuildNoReturnAttribute.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-compiler/M2Options.def
gcc/m2/gm2-compiler/M2Preprocess.mod
gcc/m2/gm2-compiler/P2SymBuild.def

index df42a4a..dd26984 100644 (file)
@@ -93,7 +93,8 @@ EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck,
                  SetScaffoldMain, ScaffoldMain,
                  SetRuntimeModuleOverride, GetRuntimeModuleOverride,
                  SetGenModuleList, GetGenModuleFilename, SharedFlag,
-                 SetB, GetB, SetMD, GetMD, SetMMD, GetMMD, SetObj, GetObj ;
+                 SetB, GetB, SetMD, GetMD, SetMMD, GetMMD, SetObj, GetObj,
+                 GetMQ, SetMQ ;
 
 
 VAR
index ebd9cb9..d63db35 100644 (file)
@@ -134,7 +134,7 @@ PROCEDURE MakeSaveTempsFileName (filename: String) : String ;
 VAR
    NewName,
    DumpDir,
-   NewDir: String ;
+   NewDir : String ;
 BEGIN
    NewName := ConCat (GetFileName (filename), InitString ('.m2i')) ;
    NewDir := GetSaveTempsDir () ;
@@ -146,7 +146,7 @@ BEGIN
       fprintf1 (StdOut, " DumpDir: %s\n", DumpDir)
    END ;
 *)
-   IF (NewDir AND EqualArray (NewDir, 'obj')) AND DumpDir
+   IF (NewDir#NIL) AND EqualArray (NewDir, 'obj') AND (DumpDir#NIL)
    THEN
       RETURN Dup (ConCat (DumpDir, NewName))
    ELSE
@@ -181,20 +181,20 @@ BEGIN
       (* We support MD and MMD for the main file only, at present.  *)
       IF isMain OR PPonly
       THEN
-         IF GetMD ()
+         IF GetMD () # NIL
          THEN
             tempfile := ConCat( Mark (InitString(' -MD ')),
                                 InitStringCharStar (GetMD ()))
-         ELSIF GetMMD ()
+         ELSIF GetMMD () # NIL
          THEN
             tempfile := ConCat( Mark (InitString(' -MMD ')),
                                 InitStringCharStar (GetMMD ()))
          END ;
-         IF tempfile
+         IF tempfile#NIL
          THEN
             commandLine := ConCat (Dup (commandLine), Dup (tempfile)) ;
             (* We can only add MQ if we already have an MD/MMD.  *)
-            IF GetMQ ()
+            IF GetMQ () # NIL
             THEN
                tempfile := ConCat( Mark (InitString(' -MQ ')),
                                  InitStringCharStar (GetMQ ())) ;
@@ -207,7 +207,7 @@ BEGIN
       tempfile := NIL ;
       IF PPonly
       THEN
-         IF GetObj()
+         IF GetObj () # NIL
          THEN
            tempfile := InitStringCharStar (GetObj ())
          END ;
@@ -218,7 +218,7 @@ BEGIN
          tempfile := InitStringCharStar (make_temp_file (KeyToCharStar (MakeKey('.m2i'))))
       END ;
       commandLine := ConCat (ConCatChar (Dup (commandLine), ' '), filename) ;
-      IF tempfile
+      IF tempfile # NIL
       THEN
          commandLine := ConCat (ConCat (Dup (commandLine),
                                         Mark (InitString(' -o '))), tempfile) ;
index b377011..d5dd9fe 100644 (file)
@@ -61,6 +61,7 @@ EXPORT QUALIFIED P2StartBuildDefModule,
                  BuildOptArg,
                  StartBuildProcedure,
                  EndBuildProcedure,
+                 BuildNoReturnAttribute,
                  BuildFunction,
                  BuildOptFunction,
                  BuildPointerType,