summaryrefslogtreecommitdiff
path: root/test-suite
Commit message (Collapse)AuthorAgeFilesLines
* linker: Do not store entire ELF in memory when writing to a file.Ludovic Courtès2023-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | 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.
* linker: Linker object writer takes a single argument.Ludovic Courtès2023-01-171-2/+2
| | | | | | | | | | | | | | * 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.
* linker, assembler: Avoid intermediate bytevectors.Ludovic Courtès2023-01-171-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add test for 'string-ref' with a negative index at -O2.Ludovic Courtès2023-01-171-5/+14
| | | | | | | | | | This test would segfault prior to c0004442b7691f59a0e37869ef288eb26382ad9e. 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.
* Do not expand 'make-vector' primcall with wrong number of arguments.Ludovic Courtès2023-01-161-2/+11
| | | | | | | | | 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.
* Add 'bytevector-slice'.Ludovic Courtès2023-01-141-1/+66
| | | | | | | | | * 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.
* Make 'system*' and 'piped-process' internally use 'spawn'.Josselin Poiret2023-01-131-1/+17
| | | | | | | | | | | | | 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>
* Add 'spawn'.Josselin Poiret2023-01-131-2/+77
| | | | | | | | | | | | | * 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>
* Test for 'frame-local-ref' errors when printing backtrace.Andrew Whatson2023-01-111-1/+22
| | | | | | | | | | | This test reproduces the error from <https://bugs.gnu.org/56493>, and passes with the workaround which was merged in commit c7fa78fc751eb336bcfafbb5ac59c460ee2c5d7a. * test-suite/tests/eval.test ("avoid frame-local-ref out of range"): New test. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Fix peval bug when expand-primitives introduces lexicalsAndy Wingo2022-12-011-1/+9
| | | | | | | | * module/language/tree-il/peval.scm (augment-var-table-with-externally-introduced-lexicals): New helper. * module/language/tree-il/peval.scm (peval): Augment store with any lexicals introduced by expand-primitives. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
* Fix order-of-side-effects bug in (eq? x y z) expansionAndy Wingo2022-12-011-0/+11
| | | | | | | | | * module/language/tree-il/primitives.scm (bind-lexicals): New helper. (expand-eq, expand-chained-comparisons): Ensure all arguments are eagerly evaluated. Previously an intermediate #f result would shortcut the evaluation. * test-suite/tests/compiler.test ("size effects in multi-arg eq / <"): Add test.
* Add tests for warning locations.Andrew Whatson2022-11-291-1/+47
| | | | | | | | These would have caught <https://bugs.gnu.org/56493>. * test-suite/tests/tree-il.test ("warnings")("location")["unused variable", "unbound variable (spaces)", "unbound variable (tabs)"]: New tests.
* Define Scheme bindings to ‘openat’ when available.Maxime Devos2022-10-211-0/+73
| | | | | | | | | | | | | | | | * configure.ac: Detect if ‘openat’ is defined. * libguile/filesys.c (flags_to_mode): Extract from ... (scm_mode): ... here. (scm_open_fdes_at, scm_openat): Define the Scheme bindings. * libguile/filesys.h (scm_open_fdes_at, scm_openat): Make them part of the API. * doc/ref/posix.texi (File System): Document them. * test-suite/tests/filesys.test ("openat"): Test ‘openat’. * libguile/syscalls.h (openat_or_openat64): Decide between ‘openat’ and ‘openat64’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define a Scheme binding to ‘fstatat’ when available.Maxime Devos2022-10-211-0/+80
| | | | | | | | | | | * configure.ac: Detect if ‘fstatat’ is defined. * libguile/filesys.c (scm_statat): Define a Scheme binding to ‘fstatat’. * libguile/filesys.h (scm_statat): Make it part of the C API. * doc/ref/posix.texi (File System): Document it. * libguile/syscalls.h (fstatat_or_fstatat64): Choose between ‘fstatat’ and ‘fstatat64’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define a Scheme binding to ‘unlinkat’ when it exists.Maxime Devos2022-10-211-0/+59
| | | | | | | | | | | | | | | | ‘unlinkat’ is used for both unlinking regular files and removing empty directories. * configure.ac: Detect if ‘unlinkat’ exists. * doc/ref/posix.texi (File System): Document why there is no ‘rmdirat’ procedure, and document the ‘delete-file-at’ procedure. * libguile/filesys.c (scm_rmdir): Adjust the docstring here as well. (scm_delete_file_at): Define a Scheme binding to ‘unlinkat’. * libguile/filesys.h (scm_delete_file_at): Make ‘scm_delete_file_at’ part of the C API. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define a Scheme binding to ‘fchmodat’ when it exists.Maxime Devos2022-10-211-0/+53
| | | | | | | | | * configure.ac: Detect existence of fchmodat. * libguile/filesys.c (scm_chmodat): New procedure. * libguile/filesys.h (scm_chmodat): Make it part of the API. * test-suite/tests/filesys.test ("chmodat"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define a Scheme binding to ‘renameat’ when it exists.Maxime Devos2022-10-211-0/+104
| | | | | | | | | | | * configure.ac: Detect if ‘renameat’ is defined. * libguile/filesys.c (scm_renameat): Define a Scheme binding to the ‘renameat’ system call. * doc/ref/posix.texi (File System): Document it. * libguile/filesys.h (scm_renameat): Make it part of the C API. * test-suite/tests/filesys.test ("rename-file-at"): New tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define bindings to ‘mkdirat’ when the C function exists.Maxime Devos2022-10-211-0/+38
| | | | | | | | * configure.ac: Detect if ‘mkdirat’ exists. * libguile/filesys.c (scm_mkdirat): Define the Scheme binding. * doc/ref/posix.texi (File System): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define ‘symlinkat’ wrapper when supported.Maxime Devos2022-10-211-0/+27
| | | | | | | | | | | * configure.ac: Detect whether ‘symlinkat’ exists. * libguile/filesys.c (scm_symlinkat): Define a Scheme binding when it exists. * libguile/filesys.h: Make the binding part of the public C API. * doc/ref/posix.texi (File System): Document the binding. * test-suite/tests/filesys.test ("symlinkat"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow file ports in ‘utime’.Maxime Devos2022-10-211-1/+70
| | | | | | | | | | | | Ports representing symbolic links are currently unsupported. * configure.ac: Detect 'futimens'. * doc/ref/posix.texi (utime): Update documentation. * libguile/posix.c (scm_utime): Support ports. * libguile/posix.h (scm_utime): Rename argument. * test-suite/tests/posix.test ("utime"): Add more tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow file ports in ‘readlink’.Maxime Devos2022-10-211-0/+61
| | | | | | | | | | | * configure.ac: Detect whether ‘readlinkat’ is defined. * libguile/filesys.c (scm_readlink): Support file ports when ‘readlinkat’ exists. (scm_init_filesys): Provide ‘chdir-ports’ when it exists. * doc/ref/posix.texi (File System): Document it. * test-suite/tests/filesys.test ("readlink"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow file ports in ‘chdir’ when supported.Maxime Devos2022-10-211-0/+41
| | | | | | | | | | | | | * configure.ac: Check for ‘fchdir’. * libguile/filesys.c (scm_chdir): Support file ports. (scm_init_filesys): Report support of file ports. * doc/ref/posix.texi (Processes): Update accordingly. * doc/ref/guile.texi: Add copyright line for new documentation in this patch and later patches. * test-suite/tests/filesys.test ("chdir"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Presume ISO C90 headers are always availableMike Gran2022-10-141-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | This includes <assert.h>, <ctype.h>, <errno.h>, <float.h>, <iso646.h>, <limits.h>, <locale.h>, <math.h>, <setjmp.h>, <signal.h>, <stdarg.h>, <stddef.h>, <stdio.h>, <stdlib.h>, <string.h>, <time.h>, <wchar.h>, and <wctype.h>. * configure.ac: don't check for <limits.h>, <string.h>, <time.h>, <assert.h>. Remove AC_INCLUDES_DEFAULT macro * libguile/bytevectors.c: include <limits.h>, remove HAVE_LIMITS_H * libguile/filesys.c: include <string.h>, remove HAVE_STRING_H * libguile/fports.c: include <string.h>, remove HAVE_STRING_H * libguile/gen-scmconfig.c: remove HAVE_LIMITS_H, HAVE_TIME_H, STDC_HEADERS Remove SCM_HAVE_STDC_HEADERS * libguile/hash.c: include <wchar.h>, remove HAVE_WCHAR_H * libguile/net_db.c: include <string.h>, remove HAVE_STRING_H * libguile/numbers.h: remove SCM_HAVE_STDC_HEADERS * libguile/regex-posix.c: include <wchar.h>, remove HAVE_WCHAR_H (fixup_multibyte_match): always defined (scm_regexp_exec): use fixup_multibyte_match * libguile/scmsigs.c: remove STDC_HEADERS * libguile/socket.c: include <string.h>, remove HAVE_STRING_H * test-suite/standalone/test-unwind.c: include <string.h>, remove HAVE_STRING_H
* Test for out of range depth in fluid-ref*Daniel Llorens2022-10-031-0/+4
| | | | | Test for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58154, which was fixed in c0004442b7691f59a0e37869ef288eb26382ad9e.
* Modifies command line quoting in c-api.testMike Gran2022-10-021-1/+1
| | | | | | | | | On MinGW, 'system' uses a non-posix shell that does not handle apostrophe as a quoting character. For this test, quoting a command-line with double quotes allows it to be run with both /bin/sh and cmd.exe. * test-suite/tests/c-api.test (egrep): use double quotes when quoting command line
* Avoids deprecated egrep in c-api.testMike Gran2022-10-021-2/+2
| | | | | | | The standalone egrep script has been deprecated by GNU grep. 'grep -E' is the suggested replacement. * test-suite/tests/c-api.test (egrep): replace egrep with grep -E
* srfi-35: Fix expansion of 'condition' for compound conditions.Ludovic Courtès2022-10-011-2/+16
| | | | | | | * module/srfi/srfi-35.scm (condition): Use 'make-exception' instead of 'make-compound-condition', which is unbound in this module. * test-suite/tests/srfi-35.test ("syntax")["compound condition, hygienic macro expansion"]: New test.
* Baseline compiler no longer crashes on (not (list 1 2)).Ludovic Courtès2022-10-011-1/+7
| | | | | | | | | | Fixes <https://bugs.gnu.org/58217>. * module/language/tree-il/compile-bytecode.scm (canonicalize) [finish-conditional](predicate?): Do not assume 'lookup-primitive' returns true. * test-suite/tests/compiler.test ("regression tests") ["(not (list 1 2))"]: New test.
* in ftw test, skip EACCESS test on MinGWMike Gran2022-09-201-3/+9
| | | | | | | | MinGW ACL-based permissions don't follow POSIX standard, so 'chmod' has unexpected behavior. * test-suite/tests/ftw.test (mingw?): new define ("file system fold: EACCES"): skip test on MinGW
* in ftw test, don't presume symlink is definedMike Gran2022-09-201-34/+40
| | | | | | * test-suite/tests/ftw.test (dangling symlink and lstat) (dangling symlink and stat, symlink to directory): skip if symlink undefined
* When fork unavailable, skip standalone tests that require itMichael Gran2022-09-202-1/+7
| | | | | | | MinGW is missing fork. * test-suite/standalone/test-close-on-exec: modified * test-suite/standalone/test-signal-fork: modified
* test-suite: Remove obsolete use of 'debug-enable'.Ludovic Courtès2022-09-191-3/+2
| | | | * test-suite/guile-test (enable-debug-mode): Remove 'debug-enable' call.
* 'pipe' now takes an optional 'flags' parameter.Ludovic Courtès2022-09-191-0/+35
| | | | | | | | | | | | | This is the same strategy as used for the 'accept4' bindings introduced in 6e0965104c579431e5a786b60e1a964a112c73b8. * libguile/posix.c (scm_pipe): Rename to... (scm_pipe2): ... this. Add an optional 'flags' parameter and honor it. (scm_pipe): Rewrite as a call to 'scm_pipe2'. * libguile/posix.h (scm_pipe2): New declaration. * test-suite/tests/posix.test ("pipe"): New tests. * configure.ac: Look for 'pipe2'. * NEWS: Update.
* Add support for "e" flag (O_CLOEXEC) to 'open-file'.Ludovic Courtès2022-09-072-1/+42
| | | | | | | | | * libguile/fports.c (scm_i_mode_to_open_flags): Add 'e' case. (scm_open_file_with_encoding): Document it. * test-suite/standalone/test-close-on-exec: New file. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it. * doc/ref/api-io.texi (File Ports): Document it. * NEWS: Update.
* In curried definitions, move docstrings to outermost lambdaJean Abou Samra2022-08-291-2/+50
| | | | | | | This makes the docstring attached to the curried function being defined rather than the result of its application until a function that runs the body is obtained, fixing https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50068
* 'system*' can no longer close file descriptor 2.Ludovic Courtès2022-08-051-2/+14
| | | | | | | | | | Fixes <https://bugs.gnu.org/55596>. Reported by Hugo Nobrega <hugonobrega@ic.ufrj.br> and Jack Hill <jackhill@jackhill.us>. * libguile/posix.c (start_child): Close OUT only if it's greater than 2. * test-suite/tests/posix.test ("system*")["exit code for nonexistent file"] ["https://bugs.gnu.org/55596"]: New tests.
* web: Don't hide missing data in the chunked input port.Christopher Baines2022-07-041-8/+17
| | | | | | | | | | | | | | | | | This port is of limited use if it cannot be used reliably. Rather than behaving as if the input has finished when it ends unexpectedly, instead raise an exception. * module/web/http.scm (make-chunked-input-port): Raise an exception on premature termination. (&chunked-input-ended-prematurely): New exception type. (chunked-input-ended-prematurely-error?): New procedure. * test-suite/tests/web-http.test (pass-if-named-exception): Rename to pass-if-named-exception. (pass-if-named-exception): New syntax. ("Exception on premature chunk end"): New test for this behaviour. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* web: Handle ending CRLF (\r\n) for chunked input and output ports.Christopher Baines2022-07-041-2/+2
| | | | | | | | | | | | | | | | | The chunked transfer encoding specifies the chunked body ends with CRLF. This is in addition to the CRLF at the end of the last chunk, so there should be CRLF twice at the end of the chunked body: https://datatracker.ietf.org/doc/html/rfc2616#section-3.6.1 * module/web/http.scm (make-chunked-input-port): Read two extra bytes at the end of the chunked input. (make-chunked-output-port): Write the missing \r\n when closing the port. * test-suite/tests/web-http.test (chunked encoding): Add missing \r\n to test data. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* web: send capitalized authorization header schemeAleix Conchillo Flaqué2022-07-041-3/+8
| | | | | | | | | | | * module/web/http.scm (write-credentials): capitalize authorization header scheme. The standard allows the scheme to be case-insensitive, however most libraries out there expect the scheme to be capitalized, which is what it is actually used in RFC docs (e.g. https://datatracker.ietf.org/doc/html/rfc7617#section-2). Some libraries even reject lowercase scheme making Guile incompatible. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow null bytes in UNIX sockets.Liliana Marie Prikler2022-06-161-4/+75
| | | | | | | | | | | | | | | | | | | | | | The current socket address constructors all assume, that there are no null bytes in the socket path. This assumption does not hold in Linux, which uses an initial null byte to demarcate abstract sockets and ignores all further null bytes [1]. [1] https://www.man7.org/linux/man-pages/man7/unix.7.html * libguile/sockets.c (scm_fill_sockaddr)[HAVE_UNIX_DOMAIN_SOCKETS]: Use scm_to_locale_stringn to construct c_address. Use memcpy instead of strcpy and calculate size directly instead of using SUN_LEN. (_scm_from_sockaddr): Copy the entire path up to the limits imposed by addr_size. * test-suite/tests/00-socket.test: ("make-socket-address"): Add case for abstract unix sockets. ("AF_UNIX/SOCK_STREAM"): Add abstract socket versions of bind, listen, connect and accept. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow empty vendor string in GNU target triplets.Taylor R Campbell2022-06-161-1/+3
| | | | | | | | | | | | | | | | | NetBSD and pkgsrc have been using an empty vendor string since the mid-'90s, such as x86_64--netbsd. pkgsrc has been carrying around a workaround just the guile build for a long time. (Before that, NetBSD omitted the vendor altogether, so if x86_64 existed then it might have been `x86_64-netbsd', but that caused more problems.) This change makes Guile accept an empty vendor string so workarounds are no longer necessary. * module/system/base/target.scm (validate-target): Allow empty vendor string in GNU target triplets. * test-suite/tests/cross-compilation.test ("cross-compilation"): Add tests for "x86_64--netbsd". Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* Fix "non-revealed port is closed" ports.testRob Browning2022-03-161-3/+4
| | | | | | | | Don't close the test port's file descriptor because the port still has a reference to it, and could still close it at any time when finally garbage collected. This did soemetimes break subsequent tests. Bug: https://debbugs.gnu.org/43521
* tests: web-server: Wait until the server is listening.Ludovic Courtès2022-03-151-1/+24
| | | | | | | | | Fixes synchronization issues observed on slow or loaded machines, where client connection attempts would fail with ECONNREFUSED: https://issues.guix.gnu.org/54348 * test-suite/tests/web-server.test ("server is listening"): New test.
* psyntax: Honor source properties for things other than syntax objects.Ludovic Courtès2022-03-071-2/+24
| | | | | | | | | | | | | | | | | Commit 54bbe0b2846c5b1aa366c91d679ba724869c8cda inadvertently led psyntax to dismiss source location info for data returned by read hash extensions, because read hash extensions return plain data with associated source properties, even when called from 'read-syntax'. This change reverts part of this commit to restore that behavior. Fixes <https://issues.guix.gnu.org/54003>. * module/ice-9/psyntax.scm (datum-sourcev): New procedure. (source-annotation): Fall back to 'datum-sourcev'. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/compiler.test ("psyntax")["syntax-source with read-hash-extend"]: New test.
* tests: Add read-syntax + syntax-source test.Ludovic Courtès2022-03-071-2/+14
| | | | | * test-suite/tests/reader.test ("read-syntax")["syntax-source"]: New test.
* Have log and log10(real nan) return real nan regardless of signDaniel Llorens2022-01-131-1/+10
| | | | | | * libguile/numbers.c (log_of_shifted_double, scm_log10): Avoid complex extension when the argument is a real nan. * test-suite/tests/numbers.test: Tests for nans of either sign.
* New function bitvector-copy (scm_bitvector_copy)Daniel Llorens2022-01-041-2/+21
| | | | | | | | * libguile/bitvectors.h: * libguile/bitvectors.c: As stated. * test-suite/tests/bitvectors.test: Tests. * doc/ref/api-data.texi: Update "Bit vectors" section. * NEWS: Update.
* New function srfi-4-vector-type-size in (srfi srfi-4 gnu)Daniel Llorens2021-12-061-0/+17
| | | | | | | | | | | | | | This patch removes the undocumented function make-srfi-4-vector from (guile). That function is still exported from (srfi srfi-4 gnu). * libguile/srfi-4.h (scm_init_srfi_4): Split into scm_bootstrap_srfi_4() and scm_init_srfi_4(), after the pattern of scm_init_bytevectors() and scm_bootstrap_bytevectors(). * libguile/init.c: Replace scm_init_srfi_4() call by scm_bootstrap_srfi_4(). * module/srfi/srfi-4.scm: Load newly defined srfi-4 extension. This provides undocumented make-srfi-4-vector. * module/srfi/srfi-4/gnu.scm: Export srfi-4-vector-type-size. * doc/ref/srfi-modules.texi: Document srfi-4-vector-type-size.
* Support C99 complex types in (system foreign)Daniel Llorens2021-11-151-1/+8
| | | | | | | | | | * libguile/foreign.h (SCM_FOREIGN_TYPE_COMPLEX_FLOAT, SCM_FOREIGN_TYPE_COMPLEX_DOUBLE): New enums. * module/system/foreign.scm (complex-float, complex-double): Export new types. (make-c-struct, parse-c-struct): Support the new types. * libguile/foreign.c (complex-float, complex-double): Define new types. (alignof, sizeof, pack, unpack): Support the new types. * test-suite/tests/foreign.test: Test.
* Limit the range of ash, round-ash count argument to INT32Daniel Llorens2021-11-051-1/+4
| | | | | | | | | | This avoids gmp aborting e.g. with (ash 1 (expt 2 37)). The new limit is such that (ash 1 (expt 30)) is accepted but (ash 1 (expt 31)) throws. Fixes https://bugs.gnu.org/48150 * libguile/numbers.c (ash, round-ash): As stated. * test-suite/tests/numbers.test: Test a case known to make gmp abort before.