]> git.ipfire.org Git - thirdparty/gcc.git/commit
a68: more work on formal holes
authorJose E. Marchesi <jemarch@gnu.org>
Fri, 6 Feb 2026 10:20:31 +0000 (11:20 +0100)
committerJose E. Marchesi <jemarch@gnu.org>
Fri, 6 Feb 2026 21:04:26 +0000 (22:04 +0100)
commita8df3d91a9ce8aae936d9486b9806149bf57a0a0
tree5f9836bd331be7eccb0e7170d6c97a2ca13191d5
parentfdd1d058f289eda39b6eb1386a0dabef3478d298
a68: more work on formal holes

This commit implements several improvements:

1. The optimization for avoiding indirect calls while using
   declarations like:

    proc(string)int puts = nest C "_libga68_posixputs";

   has been completed.

2. Algol 68 procedures getting strings as arguments can now
   wrap corresponding C functions.  Note this does not include
   procedures yielding strings as for now.

3. Wrappers are now built for all formal holes having proc mode.  This
   allows for a more robust implementation.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* Make-lang.in (ALGOL68_OBJS): Add algol68/a68-low-holes.o.
* a68.h: Update prototypes.
* a68-types.h (struct TAG_T): New field nest_proc.
(NEST_PROC): Define.
* a68-parser.cc (a68_new_tag): Initialize NEST_PROC.
* a68-parser-extract.cc (extract_identities): Use NEST_PROC
instead of IN_PROC for taxes for defining-identifiers in identity
declarations of proc modes with formal holes as actual parameters.
* a68-moids-misc.cc (a68_is_c_mode): Modified to allow strings as
direct parameters.
* a68-low.cc (a68_make_proc_formal_hole_decl): Remove.
* a68-low-units.cc (a68_lower_identifier): Improve commentary.
(a68_lower_formal_hole): Factorize.
* a68-low-holes.cc: New file.
* a68-low-decls.cc (a68_lower_identity_declaration): Optimize
identity declarations of proc mode with formal holes as actual
parameters.
* a68-exports.cc (a68_add_identifier_to_moif): Honor NEST_PROC.
* ga68.texi (Communicating with C): Strings can now be passed as
parameters in formal holes.

gcc/testsuite/ChangeLog

* algol68/compile/error-nest-4.a68: Strings can now be passed as
arguments in formal holes.
13 files changed:
gcc/algol68/Make-lang.in
gcc/algol68/a68-exports.cc
gcc/algol68/a68-low-decls.cc
gcc/algol68/a68-low-holes.cc [new file with mode: 0644]
gcc/algol68/a68-low-units.cc
gcc/algol68/a68-low.cc
gcc/algol68/a68-moids-misc.cc
gcc/algol68/a68-parser-extract.cc
gcc/algol68/a68-parser.cc
gcc/algol68/a68-types.h
gcc/algol68/a68.h
gcc/algol68/ga68.texi
gcc/testsuite/algol68/compile/error-nest-4.a68