PR-108135 Remove PACKAGE_* definitions from gm2config.h
authorGaius Mulley <gaiusmod2@gmail.com>
Thu, 26 Jan 2023 00:55:56 +0000 (00:55 +0000)
committerGaius Mulley <gaiusmod2@gmail.com>
Thu, 26 Jan 2023 00:55:56 +0000 (00:55 +0000)
PR-108135 gcc/m2/configure generates gm2config.h and
automatically adds PACKAGE defines.  gcc/m2/Make-lang.in
now removes these PACKAGE definitions.  The patch also
contains fixes to remove an unused variable Dim from
BuildConstHighFromSym and also uses withTok in StartBuildWith.
StartBuildWith will generate a nop (for improved debugging)
if requested.

gcc/m2/ChangeLog:

* Make-lang.in (m2/gm2config.h): Rewrite rule to be
dependent upon m2/gm2config.aci.
(m2/gm2config.aci): Newrule.
* configure.ac (AC_CONFIG_HEADERS): Change destination
to gm2config.aci.
* configure: Regenerate.
* gm2-libs/config-host: Regenerate.
* gm2-compiler/M2GCCDeclare.mod (AddSymToWatch): Comment
out.
* gm2-compiler/M2Quads.mod (BuildConstHighFromSym): Remove
Dim.
(StartBuildWith): Call BuildStmtNoteTok.
(BuildStmtNoteTok): New procedure.
(BuildStmtNote): Re-implement re-factor into two
procedures and call BuildStmtNoteTok.
* gm2config.h.in: Remove.
* gm2config.aci.in: New file.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/Make-lang.in
gcc/m2/configure
gcc/m2/configure.ac
gcc/m2/gm2-compiler/M2GCCDeclare.mod
gcc/m2/gm2-compiler/M2Quads.mod
gcc/m2/gm2-libs/config-host
gcc/m2/gm2config.aci.in [moved from gcc/m2/gm2config.h.in with 96% similarity]

index 0d3ff23..122a35c 100644 (file)
@@ -1503,7 +1503,10 @@ m2/gm2-libs/gm2-libs-host.h:
 # Autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a
 # cross compiler and the ../Makefile.in above appends this to INTERNAL_CFLAGS.
 
-m2/gm2config.h:
+m2/gm2config.h: m2/gm2config.aci
+       grep -v define\ PACKAGE_ $< > $@
+
+m2/gm2config.aci:
        NEW_SRCDIR=`${srcdir}/m2/tools-src/calcpath ../ ${srcdir} m2` ; \
         export NEW_SRCDIR ; \
        cd m2 ; \
index 91768ab..de78fdd 100755 (executable)
@@ -3645,7 +3645,7 @@ $as_echo "#define HAVE_OPENDIR 1" >>confdefs.h
 
 fi
 
-ac_config_headers="$ac_config_headers gm2config.h"
+ac_config_headers="$ac_config_headers gm2config.aci"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -4319,7 +4319,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "gm2config.h") CONFIG_HEADERS="$CONFIG_HEADERS gm2config.h" ;;
+    "gm2config.aci") CONFIG_HEADERS="$CONFIG_HEADERS gm2config.aci" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -4630,7 +4630,7 @@ $as_echo "$as_me: $ac_file is unchanged" >&6;}
 
 
   case $ac_file$ac_mode in
-    "gm2config.h":H) echo timestamp > stamp-h ;;
+    "gm2config.aci":H) echo timestamp > stamp-h ;;
 
   esac
 done # for ac_tag
index a9c952a..0a77cae 100644 (file)
@@ -1,4 +1,4 @@
-# configure.ac provides gm2spec.c with access to config values.
+# configure.ac provides gm2spec.cc with access to config values.
 
 # Copyright (C) 2001-2023 Free Software Foundation, Inc.
 # Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
@@ -29,5 +29,5 @@ AC_CHECK_FUNCS([stpcpy])
 AC_CHECK_HEADERS(sys/types.h)
 AC_HEADER_DIRENT
 AC_CHECK_LIB([c],[opendir],[AC_DEFINE([HAVE_OPENDIR],[1],[found opendir])])
-AC_CONFIG_HEADERS(gm2config.h, [echo timestamp > stamp-h])
+AC_CONFIG_HEADERS(gm2config.aci, [echo timestamp > stamp-h])
 AC_OUTPUT
index fa27cb4..2774598 100644 (file)
@@ -347,6 +347,7 @@ END DebugSetNumbers ;
                    lists.
 *)
 
+(*
 PROCEDURE AddSymToWatch (sym: WORD) ;
 BEGIN
    IF (sym#NulSym) AND (NOT IsElementInSet(WatchList, sym))
@@ -357,6 +358,7 @@ BEGIN
       FIO.FlushBuffer(FIO.StdOut)
    END
 END AddSymToWatch ;
+*)
 
 
 (*
index a58de93..939758f 100644 (file)
@@ -8101,14 +8101,11 @@ END BuildHighFunction ;
 
 PROCEDURE BuildConstHighFromSym (tok: CARDINAL) ;
 VAR
-   Dim,
    NoOfParam,
    ReturnVar: CARDINAL ;
 BEGIN
    PopT (NoOfParam) ;
    ReturnVar := MakeTemporary (tok, ImmediateValue) ;
-   Dim := OperandD (1) ;
-   INC (Dim) ;
    GenHigh (tok, ReturnVar, 1, OperandT (1)) ;
    PopN (NoOfParam+1) ;
    PushTtok (ReturnVar, tok)
@@ -11445,6 +11442,7 @@ VAR
    Sym, Type,
    Ref      : CARDINAL ;
 BEGIN
+   BuildStmtNoteTok (withTok) ;
    DisplayStack ;
    PopTFtok (Sym, Type, tok) ;
    Type := SkipType (Type) ;
@@ -14107,26 +14105,37 @@ END PushLineNo ;
 
 PROCEDURE BuildStmtNote (offset: INTEGER) ;
 VAR
-   filename: Name ;
-   f       : QuadFrame ;
-   i       : INTEGER ;
+   tokenno: INTEGER ;
 BEGIN
    IF NextQuad#Head
    THEN
-      f := GetQF (NextQuad-1) ;
-      i := offset ;
-      INC (i, GetTokenNo ()) ;
-      (* no need to have multiple notes at the same position.  *)
-      IF (f^.Operator # StatementNoteOp) OR (f^.Operand3 # VAL (CARDINAL, i))
-      THEN
-         filename := makekey (string (GetFileName ())) ;
-         GenQuad (StatementNoteOp, WORD (filename), NulSym, i)
-      END
+      tokenno := offset ;
+      INC (tokenno, GetTokenNo ()) ;
+      BuildStmtNoteTok (VAL(CARDINAL, tokenno))
    END
 END BuildStmtNote ;
 
 
 (*
+   BuildStmtNoteTok - adds a nop (with an assigned tokenno location) to the code.
+*)
+
+PROCEDURE BuildStmtNoteTok (tokenno: CARDINAL) ;
+VAR
+   filename: Name ;
+   f       : QuadFrame ;
+BEGIN
+   f := GetQF (NextQuad-1) ;
+   (* no need to have multiple notes at the same position.  *)
+   IF (f^.Operator # StatementNoteOp) OR (f^.Operand3 # tokenno)
+   THEN
+      filename := makekey (string (GetFileName ())) ;
+      GenQuad (StatementNoteOp, WORD (filename), NulSym, tokenno)
+   END
+END BuildStmtNoteTok ;
+
+
+(*
    AddRecordToList - adds the record held on the top of stack to the
                      list of records and varient fields.
 *)
index 184c363..5d6d33d 100755 (executable)
@@ -5,7 +5,7 @@
 # Report bugs to <gm2@nongnu.org>.
 #
 #
-# Copyright (C) 1992-2023 Free Software Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -1369,7 +1369,7 @@ if $ac_init_version; then
 ASCII.def configure 1.9.5
 generated by GNU Autoconf 2.69
 
-Copyright (C) 2012-2023 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -5298,7 +5298,7 @@ ASCII.def config.status 1.9.5
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2012-2023 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
similarity index 96%
rename from gcc/m2/gm2config.h.in
rename to gcc/m2/gm2config.aci.in
index fe2f814..cb9f505 100644 (file)
@@ -1,4 +1,4 @@
-/* gm2config.h.in.  Generated from configure.ac by autoheader.  */
+/* gm2config.aci.in.  Generated from configure.ac by autoheader.  */
 
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */