1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

20890 commits

Author SHA1 Message Date
Ludovic Courtès
634f5f2d3d maint: Add variants of the default package for Guix.
* build-aux/guix/guile-package.scm (package-with-configure-flags): New
procedure.
(guile-without-threads, guile-without-networking)
(guile-debug, guile-strict-typing): New variables.
* build-aux/manifest.scm: Use (guile-package) module instead of 'load'.
(native-builds): Add the variants above + "guile-clang".
2023-01-29 17:53:11 +01:00
Ludovic Courtès
20938f2a9d maint: Masquerade as a Guix channel.
By pretending to be a Guix channel, this repository can be consumed
seamlessly by tools such as Cuirass.

* .guix-channel: New file.
* guix.scm: Turn into a symlink to...
* build-aux/guix/guile-package.scm: ... this.  New file.
* Makefile.am (EXTRA_DIST): Add them, except '.guix-channel'.
2023-01-29 17:53:09 +01:00
Ludovic Courtès
6f9962ab25 maint: Add Guix build files.
* guix.scm, build-aux/manifest.scm: New files.
* Makefile.am (EXTRA_DIST): Add them.
2023-01-29 17:20:13 +01:00
Ludovic Courtès
5b42f8c154 'spawn' ensures it is passed open file ports.
Fixes <https://bugs.gnu.org/61073>.

* libguile/posix.c (FDES_FROM_PORT_OR_INTEGER): When OBJ is not an
integer, use 'SCM_VALIDATE_OPFPORT' before using 'SCM_FPORT_FDES'.
* test-suite/tests/posix.test ("spawn")["non-file port argument"]: New
test.
2023-01-26 09:42:46 +01:00
Daniel Llorens
35566ea585 Document multiple-value returns in forms taking a let-expression body
* doc/ref/api-binding.texi (Local Bindings): Document multiple-value
  returns for let.
* doc/ref/api-control.texi (begin): Document multiple-value returns for
  begin.
  (Conditionals): Document multiple-value returns and use 'body' in the
  syntax description of when, unless, cond, case.
  (Multiple values): Document multiple-value returns and use 'body' in
  the syntax description of SRFI-8 receive.
  (Fluids and Dynamic States): Use 'body' in the syntax description of
  'with-fluids'.
2023-01-25 12:52:29 +01:00
Linus
764e3614b8 Add internal definitions to derived forms
This commit adds internal definitions to the following derived
forms: when, unless, cond, case, with-fluids, and and-let*.

 * doc/ref/api-control.texi (Conditionals): Update the syntax and docs
   of when, unless, cond, and case.
 * module/ice-9/and-let-star.scm (and-let*): Changed begins to let.
 * module/ice-9/boot-9.scm (cond, case, when, unless, with-fluids):
   Changed begins to let.
2023-01-24 17:11:38 +01:00
Ludovic Courtès
9b20ca275d Verify 'W_EXITCODE' only when we provide our own definition.
Fixes <https://bugs.gnu.org/60971>.
Reported by lloda <lloda@sarc.name> and Greg Troxel <gdt@lexort.com>.

On macOS and NetBSD, 'WEXITSTATUS' expects an lvalue so the expression
passed to 'verify' would be invalid.

* libguile/posix.c: Move 'verify' assertion within #ifdef.
2023-01-23 22:52:47 +01:00
Ludovic Courtès
2e1ba78c30 maint: Abort 'make dist' when Readline support is missing.
Reported by Greg Troxel <gdt@lexort.com>.

* Makefile.am (ensure-guile-readline): New target.
(dist-hook): Depend on it.
2023-01-23 12:00:40 +01:00
Ludovic Courtès
181f7ee4a7 Update NEWS. 2023-01-23 11:56:12 +01:00
Ludovic Courtès
80bf3f48b4 Remove 'extern' from 'scm_i_current_thread' definition, except on macOS.
This is a followup to f859e0f58b, which
led to warnings on GNU/Linux:

  threads.c:358:43: warning: 'scm_i_current_thread' initialized and declared 'extern'

* libguile/threads.c (scm_i_current_thread): Make 'SCM_INTERNAL'
conditional.
2023-01-20 10:04:48 +01:00
Ludovic Courtès
f57f931e6a build: Use '--enable-mini-gmp' for "make distcheck".
* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Add '--enable-mini-gmp'.
2023-01-20 09:46:07 +01:00
Ludovic Courtès
479b7388e9 GNU Guile 3.0.9.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_CURRENT): Increment, to account for the new
'scm_*at' procedures, 'scm_bytevector_slice', etc.
(LIBGUILE_INTERFACE_AGE): Increment.
2023-01-19 22:16:15 +01:00
Ludovic Courtès
2ace7a5312 doc: Mention URL of Guile-GnuTLS.
* doc/ref/web.texi (Web Client): Mention new URL of Guile-GnuTLS.
2023-01-19 15:48:47 +01:00
Ludovic Courtès
616c217409 Add Gnulib 'sys_select' module, needed for MinGW.
This is again from Gnulib v0.1-5703-g356a414e8c.

* m4/gnulib-cache.m4: Add 'sys_select'.
* libguile/threads.c: Include <sys/select.h>.
2023-01-19 15:48:41 +01:00
Ludovic Courtès
a43a8fd8ba Add Gnulib 'gethostname' module, needed for MinGW.
This is again from Gnulib v0.1-5703-g356a414e8c.

* m4/gnulib-cache.m4: Add 'gethostname'.
2023-01-19 09:58:01 +01:00
Ludovic Courtès
3bb08542d2 Add Gnulib modules for 'posix_spawn' file operations.
This is again from Gnulib v0.1-5703-g356a414e8c.

* m4/gnulib-cache.m4: Add 'posix_spawn_file_actions_addclose',
'posix_spawn_file_actions_adddup2',
'posix_spawn_file_actions_addopen', and
'posix_spawn_file_actions_init'.
2023-01-19 00:32:12 +01:00
Ludovic Courtès
d98888290b Remove more Gnulib generated files. 2023-01-18 22:50:23 +01:00
Ludovic Courtès
aeb22f4861 Update Gnulib to v0.1-5703-g356a414e8c and add 'posix_spawn' module.
This is a followup to edfca3b7e5, which
added the 'posix_spawnp' module but not 'posix_spawn'.

* m4/gnulib-cache.m4: Add 'posix_spawn' module.
* gnulib-local/m4/clock_time.m4.diff: Adjust.
* configure.ac: Move 'gl_EARLY' use right after 'AC_PROG_CC'.
2023-01-18 22:50:18 +01:00
Ludovic Courtès
4404b553a5 Adjust 'W_EXITCODE' for Windows.
* libguile/posix.c (W_EXITCODE) [_WIN32]: New specialized definition.
2023-01-18 18:24:11 +01:00
Ludovic Courtès
cd7475541a Fix argument number in 'spawn' type check.
* libguile/posix.c (scm_spawn_process): Fix argument number in
'SCM_VALIDATE_NONEMPTYLIST'.
2023-01-18 12:13:55 +01:00
Ludovic Courtès
9a004606e0 Update NEWS.
* NEWS: Update.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
3cd64feb2e linker: Do not store entire ELF in memory when writing to a file.
This reduces the amount of memory that needs to be allocated while
writing the ELF file to disk.

Note: We're abusing #:page-aligned? in 'link-elf' to choose whether to
return a bytevector or a procedure.

* module/system/vm/linker.scm (process-reloc): Subtract SECTION-OFFSET
when writing to BV.
(write-linker-object): Pass BV directly to the linker object writer.
(link-elf): When PAGE-ALIGNED? is false, call 'bytevector-slice' from
here.  When it is true, return a procedure that takes a port and writes
to it, without having to allocate a bytevector for the whole ELF
container.
* module/language/bytecode/spec.scm (bytecode->value): Handle X being a
procedure instead of a bytevector.
(bytecode) <#:printer>: Likewise.
* test-suite/tests/linker.test (link-elf-with-one-main-section): Pass
 #:page-aligned? #f.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
4ab71e1f0d linker: Linker object writer takes a single argument.
* module/system/vm/linker.scm (write-linker-object): Pass the
'linker-object-writer' a single argument.
(string-table-writer, add-elf-objects): Adjust writers accordingly.
(string-table-writer):
(add-elf-objects):
* module/system/vm/assembler.scm (link-data, link-text-object)
(link-frame-maps, link-dynamic-section)
(link-symtab, link-arities, link-docstrs)
(link-procprops, link-debug): Likewise.
* test-suite/tests/linker.test (link-elf-with-one-main-section):
Likewise.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
041f11b353 linker, assembler: Avoid intermediate bytevectors.
This reduces the amount of memory used during linking and reduces the
number of copies to be done between bytevectors.

* module/system/vm/linker.scm (<linker-object>): Remove 'bv' field and
add 'size' and 'writer'.
(make-linker-object): Adjust accordingly.
(string-table-size): New procedure.
(link-string-table!): Remove.
(string-table-writer): New procedure.
(allocate-segment): Adjust 'make-linker-object' call.
(find-shstrndx): Call the 'linker-object-writer' of O.
(add-elf-objects): Adjust 'make-linker-object' call.  Remove
'make-bytevector' allocations and move serialization to lazy 'writer'
procedures.  Define 'segments' and 'add-header-segment!'.  Return the
latter as the first value.
* module/system/vm/assembler.scm (make-object): Remove 'bv' parameter
and add 'size' and 'writer'.
(link-data): Remove 'make-bytevector' call and move serialization to
a lazy 'writer' procedure.
(link-text-object): Likewise.
(link-frame-maps): Likewise.
(link-dynamic-section): Likewise.
(link-shstrtab): Likewise.
(link-symtab): Likewise.
(link-arities): Likewise, and remove 'bytevector-append'.
(link-docstrs): Likewise.
(link-procprops): Likewise.
(link-debug): Likewise, and define 'copy-writer'.
* test-suite/tests/linker.test (link-elf-with-one-main-section): Adjust
accordingly.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
d0d9743607 linker: Separate effectful part of 'add-elf-objects'.
* module/system/vm/linker.scm (add-elf-objects)[write-and-reloc]: Split
into...
[compute-reloc, write-object-elf-header!]: ... this.
Adjust accordingly.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
d439a3f671 assembler: Separate effectful part of 'link-docstrs'.
* module/system/vm/assembler.scm (link-docstrs): Define
'write-docstrings!' and use it.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
13e2d5b66b assembler: Separate effectful part of 'link-frame-maps'.
* module/system/vm/assembler.scm (link-frame-maps)[make-frame-maps]:
Define 'write!' and use it.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
dc0c4ccb1f assembler: Separate effectful part of 'link-procprops'.
* module/system/vm/assembler.scm (link-procprops): Define
'write-procprops!' and use it.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
c7f1522c6d assembler: Separate effectful part of 'link-dynamic-section'.
* module/system/vm/assembler.scm (link-dynamic-section): Define 'relocs'
once for all.  Define 'write!' and use it.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
fc5eae5d01 assembler: Separate effectful part of 'link-symtab'.
* module/system/vm/assembler.scm (link-symtab): Define 'names' and
'write-symbols!'.  Use it.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
15c4c4ceb3 assembler: Separate 'process-relocs' from 'patch-relocs!'.
* module/system/vm/assembler.scm (process-relocs): Remove 'buf'
parameter and turn into a pure function.
(patch-relocs!): New procedure.  Perform the side effects previously
done in 'process-relocs'.
(link-text-object): Adjust accordingly.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
cd9fc16ba0 Add test for 'string-ref' with a negative index at -O2.
This test would segfault prior to
c0004442b7.

See <https://bugs.gnu.org/60488>.

* test-suite/tests/strings.test ("string-ref"): Use 'with-test-prefix/c&e'.
["negative index"]: Check the reported bounds.
2023-01-17 17:49:05 +01:00
Daniel Llorens
e903b76795 Document R7RS functions related to bytevectors
* doc/ref/api-data.texi (Bytevectors): Fix typo in (r6:bytevector-copy),
  index need not be positive.
  Fix typos in bytevector-length, bytevector=, bytevector-fill!.
  New node 'Bytevector Procedures in R7RS'.
  (Bytevector Procedures in R7RS): Document R7RS bytevector,
  bytevector-copy, bytevector-copy!, bytevector-append.
* doc/ref/api-io.texi (Binary I/O): Document R7RS
  open-output-bytevector, write-u8, read-u8, peek-u8,
  get-output-bytevector, open-input-bytevector, read-bytevector!,
  read-bytevector, write-bytevector.
* doc/ref/r7rs.texi (R7RS support): Link to R7RS standard.
2023-01-17 16:07:48 +01:00
Jean Abou Samra
ff165ec904 Doc: clarification on regexes and encodings
* doc/ref/api-regex.texi: make it more obviously clear that regexp
  matching supports only characters supported by the locale encoding.
2023-01-17 07:20:10 +01:00
Jean Abou Samra
7d5ab8fa40 doc: Fix eval-when example
* doc/ref/api-macros.texi: make the macro expand to the literal
  date, not to a call to the date function.  The example previously
  did not actually need eval-when and did not show the intended
  effect.
2023-01-17 07:06:55 +01:00
Ludovic Courtès
f8938f517e build: Avoid implicit 'int' return type in configure tests.
Fixes <https://bugs.gnu.org/60022>.
Reported by Florian Weimer <fweimer@redhat.com>.

* configure.ac: Add missing implicit 'int' return type in tests.
2023-01-16 23:17:41 +01:00
Ludovic Courtès
51152392ef Do not expand 'make-vector' primcall with wrong number of arguments.
Fixes <https://bugs.gnu.org/60522>.
Reported by Sascha Ziemann <ceving@gmail.com>.

* module/language/tree-il/primitives.scm (make-vector): Return #f when
passed an incorrect number of arguments.
* test-suite/tests/peval.test ("partial evaluation"): Add tests.
2023-01-16 15:33:18 +01:00
Ludovic Courtès
e441c34f16 Add 'bytevector-slice'.
* module/rnrs/bytevectors/gnu.scm: New file.
* am/bootstrap.am (SOURCES): Add it.
* libguile/bytevectors.c (scm_bytevector_slice): New function.
* libguile/bytevectors.h (scm_bytevector_slice): New declaration.
* test-suite/tests/bytevectors.test ("bytevector-slice"): New tests.
* doc/ref/api-data.texi (Bytevector Slices): New node.
2023-01-14 16:14:17 +01:00
Ludovic Courtès
54ee636e57 Remove Gnulib generated file.
This was inadvertently committed in edfca3b7e5.

* lib/stdbool.h: Delete.
2023-01-14 15:44:37 +01:00
Ludovic Courtès
45af53f65f Bump user-visible copyright years to 2023.
* module/ice-9/command-line.scm (version-etc):
* module/scripts/compile.scm (show-version):
* module/system/repl/common.scm (*version*): Bump to 2023.
2023-01-13 16:15:07 +01:00
Andrew Whatson
9332b63240 Reduce redundant 'close' calls when forking on some systems.
Fixes <https://bugs.gnu.org/59321>.
Reported by <hylophile@posteo.de>.

Some systems provide "/proc/self/fd" which is a directory containing an
entry for each open file descriptor in the current process.  We use this
to limit the number of close() calls needed to ensure file descriptors
aren't leaked to the child process when forking.

* libguile/posix.c (close_inherited_fds_slow):
(close_inherited_fds): New static helper functions.
(scm_spawn_process): Attempt to close inherited file descriptors
efficiently using 'close_inherited_fds', falling back to the brute-force
approach in 'close_inherited_fds_slow'.
* NEWS: Update.
2023-01-13 16:07:42 +01:00
Josselin Poiret
527c257d6e Make 'system*' and 'piped-process' internally use 'spawn'.
Fixes <https://bugs.gnu.org/52835>.

* libguile/posix.c (scm_system_star, scm_piped_process): Use do_spawn.
(start_child): Remove function.
* test-suite/tests/posix.test ("system*")["https://bugs.gnu.org/52835"]:
New test.
* NEWS: Update.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-13 16:05:56 +01:00
Josselin Poiret
551929e4fb Add 'spawn'.
* libguile/posix.c: Include spawn.h from Gnulib.
(do_spawn, scm_spawn_process): New functions.
(kw_environment, hw_input, kw_output, kw_error, kw_search_path): New
variables.
* doc/ref/posix.texi (Processes): Document it.
* test-suite/tests/posix.test ("spawn"): New test prefix.
* NEWS: Update.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-13 16:05:30 +01:00
Josselin Poiret
edfca3b7e5 Update gnulib to 0.1.5414-8204d and add posix_spawn, posix_spawnp.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-12 16:41:29 +01:00
Andrew Whatson
fe2a0c54ac Test for 'frame-local-ref' errors when printing backtrace.
This test reproduces the error from <https://bugs.gnu.org/56493>, and
passes with the workaround which was merged in commit
c7fa78fc75.

* test-suite/tests/eval.test ("avoid frame-local-ref out of range"): New
test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-11 23:09:07 +01:00
Zhang Ning
f3ea8f7fa1 Recognize LoongArch compilation targets.
* module/system/base/target.scm (cpu-endianness): Add case for "Loongarch" variants

Signed-off-by: Zhang Ning <zhangn1985@outlook.com>
2022-12-21 08:49:08 +01:00
Vijay Marupudi
8cb2d5c953 doc: fix documented keyword argument default to match code default 2022-12-21 08:29:42 +01:00
Daniel Llorens
f859e0f58b Patch for bug #60234
See https://debbugs.gnu.org/60234.

gcc warns about the extra extern, but we get rid of the tls model mismatch
error.
2022-12-21 07:58:37 +01:00
Aleix Conchillo Flaqué
3bdcc3668f fix Apple Silicon JIT compilation
* configure.ac: check for pthread_jit_write_protect_np.

* libguile/jit.c: add support for Apple Silicon JIT compilation.

Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44505
2022-12-20 20:27:42 +01:00
Jean Abou Samra
b54263dc98 Doc: document that eq?, eqv? and equal? take any number of arguments 2022-12-11 02:19:19 +01:00