https://gcc.gnu.org/g:c08e4e239000b97f0bf6186126c825b5fe33c994

commit r16-6176-gc08e4e239000b97f0bf6186126c825b5fe33c994
Author: Jose E. Marchesi <[email protected]>
Date:   Tue Dec 16 18:17:37 2025 +0100

    a68: support only one definition module per prelude packet
    
    At this point we only support having a single definition module in
    each prelude packet.  It is planned to change this, and also to
    support local not-toplevel modules, but not in the next GCC release.
    So until that gets fully implemented, it is pointless to support
    parsing multiple contracted module definitions.
    
    This commit removes this support from the parser and adjusts several
    tests that were making use of it.
    
    Signed-off-by: Jose E. Marchesi <[email protected]>
    
    gcc/algol68/ChangeLog
    
            * a68-parser-bottom-up.cc (reduce_prelude_packet): Do not support
            multiple module definitions per packet.
    
    gcc/testsuite/ChangeLog
    
            * algol68/compile/error-compile-unknown-tag-1.a68: Use a single
            module per packet.
            * algol68/compile/error-module-coercions-1.a68: Likewise.
            * algol68/compile/error-module-ranges-1.a68: Likewise.
            * algol68/compile/module-2.a68: Likewise.
            * algol68/compile/module-pub-mangling-1.a68: Likewise.
            * algol68/compile/module-pub-mangling-2.a68: Likewise.
            * algol68/compile/module-pub-mangling-3.a68: Likewise.
            * algol68/compile/module-pub-mangling-4.a68: Likewise.
            * algol68/compile/module-pub-mangling-5.a68: Likewise.
            * algol68/compile/module-pub-mangling-6.a68: Likewise.
            * algol68/compile/warning-module-hidding-1.a68: Likewise.

Diff:
---
 gcc/algol68/a68-parser-bottom-up.cc                           | 2 ++
 gcc/testsuite/algol68/compile/error-compile-unknown-tag-1.a68 | 6 +-----
 gcc/testsuite/algol68/compile/error-module-coercions-1.a68    | 9 +--------
 gcc/testsuite/algol68/compile/error-module-ranges-1.a68       | 5 -----
 gcc/testsuite/algol68/compile/module-2.a68                    | 8 --------
 gcc/testsuite/algol68/compile/module-pub-mangling-1.a68       | 6 ------
 gcc/testsuite/algol68/compile/module-pub-mangling-2.a68       | 6 ------
 gcc/testsuite/algol68/compile/module-pub-mangling-3.a68       | 6 ------
 gcc/testsuite/algol68/compile/module-pub-mangling-4.a68       | 6 ------
 gcc/testsuite/algol68/compile/module-pub-mangling-5.a68       | 6 ------
 gcc/testsuite/algol68/compile/module-pub-mangling-6.a68       | 8 --------
 gcc/testsuite/algol68/compile/warning-module-hidding-1.a68    | 8 ++++----
 12 files changed, 8 insertions(+), 68 deletions(-)

diff --git a/gcc/algol68/a68-parser-bottom-up.cc 
b/gcc/algol68/a68-parser-bottom-up.cc
index 703574377ec9..2bbdbaec30ec 100644
--- a/gcc/algol68/a68-parser-bottom-up.cc
+++ b/gcc/algol68/a68-parser-bottom-up.cc
@@ -456,6 +456,7 @@ reduce_prelude_packet (NODE_T *p)
   reduce (p, strange_tokens, NO_TICK,
          MODULE_DECLARATION, MODULE_SYMBOL, DEFINING_MODULE_INDICANT, 
EQUALS_SYMBOL, -MODULE_TEXT, STOP);
 
+#if 0
   /* Joined module declarations.  */
   for (NODE_T *q = p; q != NO_NODE; FORWARD (q))
     {
@@ -469,6 +470,7 @@ reduce_prelude_packet (NODE_T *p)
        }
       while (siga);
     }
+#endif
 
   /* Try reducing a prelude packet.  */
   reduce (p, NO_NOTE, NO_TICK, PRELUDE_PACKET, MODULE_DECLARATION, STOP);
diff --git a/gcc/testsuite/algol68/compile/error-compile-unknown-tag-1.a68 
b/gcc/testsuite/algol68/compile/error-compile-unknown-tag-1.a68
index cd69d1a21b44..7bd3a58656e4 100644
--- a/gcc/testsuite/algol68/compile/error-compile-unknown-tag-1.a68
+++ b/gcc/testsuite/algol68/compile/error-compile-unknown-tag-1.a68
@@ -1,8 +1,4 @@
-module Foo = def pub int idpublic = 10;
-                 int idprivate = 20;
-                 skip
-             fed,
-       Bar = def pub int idpublic = 30;
+module Bar = def pub int idpublic = 30;
                  int idprivate = 40;
                  xxx { dg-error "" }
              fed
diff --git a/gcc/testsuite/algol68/compile/error-module-coercions-1.a68 
b/gcc/testsuite/algol68/compile/error-module-coercions-1.a68
index 460c381299e4..8eb5247df233 100644
--- a/gcc/testsuite/algol68/compile/error-module-coercions-1.a68
+++ b/gcc/testsuite/algol68/compile/error-module-coercions-1.a68
@@ -5,11 +5,4 @@ module Foo = def
              postlude
                 int i = "foo"; { dg-error "coerced" }
                 skip
-             fed,
-       Bar = def
-                int i = 3.14; { dg-error "coerced" }
-                skip
-             postlude
-                skip
-             fed,
-       Baz = def skip fed
+             fed
diff --git a/gcc/testsuite/algol68/compile/error-module-ranges-1.a68 
b/gcc/testsuite/algol68/compile/error-module-ranges-1.a68
index b377ffba7361..8538bc81337e 100644
--- a/gcc/testsuite/algol68/compile/error-module-ranges-1.a68
+++ b/gcc/testsuite/algol68/compile/error-module-ranges-1.a68
@@ -5,9 +5,4 @@ module Foo = def int i;
                  x := 20 { dg-error "" }
              postlude
                  i := 10 { this is ok }
-             fed,
-       Bar = def int x;
-                 skip
-             postlude
-                 x := 20 { this is ok }
              fed
diff --git a/gcc/testsuite/algol68/compile/module-2.a68 
b/gcc/testsuite/algol68/compile/module-2.a68
index 74bd23690220..3c12c8591bcb 100644
--- a/gcc/testsuite/algol68/compile/module-2.a68
+++ b/gcc/testsuite/algol68/compile/module-2.a68
@@ -5,12 +5,4 @@ module Foo = def pub int idpublic = 10;
                  pub proc lala = (int a, b) int: a + b;
                  pub proc lele := (int a, b) int: a - b;
                  skip
-             fed,
-       Bar = def pub int idpublic = 30;
-                 int idprivate = 40;
-                 pub int varpublic := 100;
-                 real varprivate := 3.14;
-                 pub proc lala = (int a, b) int: a + b;
-                 pub proc lele := (int a, b) int: a - b;
-                 skip
              fed
diff --git a/gcc/testsuite/algol68/compile/module-pub-mangling-1.a68 
b/gcc/testsuite/algol68/compile/module-pub-mangling-1.a68
index 3451f46a8ffa..39c623b185e7 100644
--- a/gcc/testsuite/algol68/compile/module-pub-mangling-1.a68
+++ b/gcc/testsuite/algol68/compile/module-pub-mangling-1.a68
@@ -3,13 +3,7 @@
 module Foo = def pub int foo;    { dg-final { scan-assembler "FOO_foo" } }
                  int bar;        { dg-final { scan-assembler "FOO_bar" } }
                  skip
-             fed,
-       Bar = def pub int foo;    { dg-final { scan-assembler "BAR_foo" } }
-                 int bar;        { dg-final { scan-assembler "BAR_bar" } }
-                 skip
              fed
 
 { dg-final { scan-assembler "FOO__prelude" } }
 { dg-final { scan-assembler "FOO__postlude" } }
-{ dg-final { scan-assembler "BAR__prelude" } }
-{ dg-final { scan-assembler "BAR__postlude" } }
diff --git a/gcc/testsuite/algol68/compile/module-pub-mangling-2.a68 
b/gcc/testsuite/algol68/compile/module-pub-mangling-2.a68
index 79fe3d84cd7d..457ae71239e8 100644
--- a/gcc/testsuite/algol68/compile/module-pub-mangling-2.a68
+++ b/gcc/testsuite/algol68/compile/module-pub-mangling-2.a68
@@ -3,13 +3,7 @@
 module Foo = def pub struct (int i, real r) foo;{ dg-final { scan-assembler 
"FOO_foo" } }
                  struct (int i, real r) bar;    { dg-final { scan-assembler 
"FOO_bar" } }
                  skip
-             fed,
-       Bar = def pub struct (int i, real r) foo;{ dg-final { scan-assembler 
"BAR_foo" } }
-                 struct (int i, real r) bar;    { dg-final { scan-assembler 
"BAR_bar" } }
-                 skip
              fed
 
 { dg-final { scan-assembler "FOO__prelude" } }
 { dg-final { scan-assembler "FOO__postlude" } }
-{ dg-final { scan-assembler "BAR__prelude" } }
-{ dg-final { scan-assembler "BAR__postlude" } }
diff --git a/gcc/testsuite/algol68/compile/module-pub-mangling-3.a68 
b/gcc/testsuite/algol68/compile/module-pub-mangling-3.a68
index 579cb84eac0e..966b2345fbbf 100644
--- a/gcc/testsuite/algol68/compile/module-pub-mangling-3.a68
+++ b/gcc/testsuite/algol68/compile/module-pub-mangling-3.a68
@@ -3,13 +3,7 @@
 module Foo = def pub int foo = 10; { dg-final { scan-assembler "FOO_foo" } }
                  int bar = 20;     { dg-final { scan-assembler "FOO_bar" } }
                  skip
-             fed,
-       Bar = def pub int foo = 30; { dg-final { scan-assembler "BAR_foo" } }
-                 int bar = 40;     { dg-final { scan-assembler "BAR_bar" } }
-                 skip
              fed
 
 { dg-final { scan-assembler "FOO__prelude" } }
 { dg-final { scan-assembler "FOO__postlude" } }
-{ dg-final { scan-assembler "BAR__prelude" } }
-{ dg-final { scan-assembler "BAR__postlude" } }
diff --git a/gcc/testsuite/algol68/compile/module-pub-mangling-4.a68 
b/gcc/testsuite/algol68/compile/module-pub-mangling-4.a68
index 4bb53949ba3e..750aaa0c660a 100644
--- a/gcc/testsuite/algol68/compile/module-pub-mangling-4.a68
+++ b/gcc/testsuite/algol68/compile/module-pub-mangling-4.a68
@@ -5,13 +5,7 @@
 module Foo = def pub proc int foo;          { dg-final { scan-assembler 
"FOO_foo" } }
                  proc int bar := int: skip; { dg-final { scan-assembler 
"FOO_bar" } }
                  skip
-             fed,
-       Bar = def pub proc int foo;    { dg-final { scan-assembler "BAR_foo" } }
-                 proc int bar := foo; { dg-final { scan-assembler "BAR_bar" } }
-                 skip
              fed
 
 { dg-final { scan-assembler "FOO__prelude" } }
 { dg-final { scan-assembler "FOO__postlude" } }
-{ dg-final { scan-assembler "BAR__prelude" } }
-{ dg-final { scan-assembler "BAR__postlude" } }
diff --git a/gcc/testsuite/algol68/compile/module-pub-mangling-5.a68 
b/gcc/testsuite/algol68/compile/module-pub-mangling-5.a68
index be29ee190950..fb50de4995cd 100644
--- a/gcc/testsuite/algol68/compile/module-pub-mangling-5.a68
+++ b/gcc/testsuite/algol68/compile/module-pub-mangling-5.a68
@@ -5,13 +5,7 @@
 module Foo = def pub proc foo = int: skip; { dg-final { scan-assembler 
"FOO_foo" } }
                  proc bar = int: skip;     { dg-final { scan-assembler 
"FOO_bar" } }
                  skip
-             fed,
-       Bar = def pub proc foo = int: skip; { dg-final { scan-assembler 
"BAR_foo" } }
-                 proc bar = int: skip;     { dg-final { scan-assembler 
"BAR_bar" } }
-                 skip
              fed
 
 { dg-final { scan-assembler "FOO__prelude" } }
 { dg-final { scan-assembler "FOO__postlude" } }
-{ dg-final { scan-assembler "BAR__prelude" } }
-{ dg-final { scan-assembler "BAR__postlude" } }
diff --git a/gcc/testsuite/algol68/compile/module-pub-mangling-6.a68 
b/gcc/testsuite/algol68/compile/module-pub-mangling-6.a68
index 8ba5333ea845..97825eda0206 100644
--- a/gcc/testsuite/algol68/compile/module-pub-mangling-6.a68
+++ b/gcc/testsuite/algol68/compile/module-pub-mangling-6.a68
@@ -7,15 +7,7 @@ module Foo = def pub op + = (int a, b) int: a + b;
                  op - = (int a, b) int: a - b;
                  { dg-final { scan-assembler "FOO_m_" } }
                  skip
-             fed,
-       Bar = def pub op + = (int a, b) int: a + b;
-                 { dg-final { scan-assembler "BAR_u_" } }
-                 op - = (int a, b) int: a - b;
-                 { dg-final { scan-assembler "BAR_m_" } }
-                 skip
              fed
 
 { dg-final { scan-assembler "FOO__prelude" } }
 { dg-final { scan-assembler "FOO__postlude" } }
-{ dg-final { scan-assembler "BAR__prelude" } }
-{ dg-final { scan-assembler "BAR__postlude" } }
diff --git a/gcc/testsuite/algol68/compile/warning-module-hidding-1.a68 
b/gcc/testsuite/algol68/compile/warning-module-hidding-1.a68
index 84b4b0e25b28..461cd4681140 100644
--- a/gcc/testsuite/algol68/compile/warning-module-hidding-1.a68
+++ b/gcc/testsuite/algol68/compile/warning-module-hidding-1.a68
@@ -1,6 +1,6 @@
 { dg-options "-Whidden-declarations=all" }
 
-module Foo = def int i; i := 10 postlude puts ("bye foo'n") fed,
-       Bar = def int j; j := 20
-             postlude int j; puts ("bye bar'n") fed, { dg-warning "hidden" }
-       Baz = def skip fed
+module Bar =
+def int j; j := 20
+postlude int j; puts ("bye bar'n")  { dg-warning "hidden" }
+fed

Reply via email to