]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
a68: support only one definition module per prelude packet
authorJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 16 Dec 2025 17:17:37 +0000 (18:17 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 16 Dec 2025 19:08:27 +0000 (20:08 +0100)
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 <jemarch@gnu.org>
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.

12 files changed:
gcc/algol68/a68-parser-bottom-up.cc
gcc/testsuite/algol68/compile/error-compile-unknown-tag-1.a68
gcc/testsuite/algol68/compile/error-module-coercions-1.a68
gcc/testsuite/algol68/compile/error-module-ranges-1.a68
gcc/testsuite/algol68/compile/module-2.a68
gcc/testsuite/algol68/compile/module-pub-mangling-1.a68
gcc/testsuite/algol68/compile/module-pub-mangling-2.a68
gcc/testsuite/algol68/compile/module-pub-mangling-3.a68
gcc/testsuite/algol68/compile/module-pub-mangling-4.a68
gcc/testsuite/algol68/compile/module-pub-mangling-5.a68
gcc/testsuite/algol68/compile/module-pub-mangling-6.a68
gcc/testsuite/algol68/compile/warning-module-hidding-1.a68

index 703574377ec943551ff5905b6146856c0cd220d8..2bbdbaec30ec6634c576fdd0ad3854ba9e7d1545 100644 (file)
@@ -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);
index cd69d1a21b440493f4b6ca89e19847d2bba77d15..7bd3a58656e45c58445c63d6856afbbbbc32eb4f 100644 (file)
@@ -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
index 460c381299e48d15f1a692ba34406f0f38e2a947..8eb5247df233c116585212187d3e09d594fd720e 100644 (file)
@@ -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
index b377ffba73618092bd75d96bd7c68b591e0abbd9..8538bc81337e0873d732bde243a276f227dafc73 100644 (file)
@@ -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
index 74bd236902200b5129461892a27af0c8300c19f7..3c12c8591bcb3be8ba0f6eff24b65c7a4e98d8b0 100644 (file)
@@ -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
index 3451f46a8ffab52f7bb270c2d50677e9a7d90451..39c623b185e7fcc0503c8cbc89c9d32eb7e10996 100644 (file)
@@ -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" } }
index 79fe3d84cd7daca990858dcc1dbaacb24840a010..457ae71239e8985088682e9271a7eb596a756420 100644 (file)
@@ -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" } }
index 579cb84eac0eb1d1fbf37d75509e31f8830bbba3..966b2345fbbf2d1319f43be847e81cb7c57c6c30 100644 (file)
@@ -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" } }
index 4bb53949ba3e0afc84df90996f8e02bc2ed4a4f5..750aaa0c660aff8a64f762f2440a9f674f7e3a7c 100644 (file)
@@ -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" } }
index be29ee190950b3f4f1f51ae8e21288643b3294be..fb50de4995cd91d0c5573066c07b123a892879ad 100644 (file)
@@ -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" } }
index 8ba5333ea8459f32b2c924e4ebfc08be9ded850b..97825eda0206e274c13f5cef2aed69a794f48bb0 100644 (file)
@@ -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" } }
index 84b4b0e25b28066750c71660e5d91bdc9ed870da..461cd468114055d9010c32cb59ef82dc9d074893 100644 (file)
@@ -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