summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-12-02Provide a hook for the exception printerwip-exception-truncateDaniel Llorens1-6/+9
2024-10-26Fix build failure with GCC 14 and musl on 32-bit systems.Natanael Copa2-1/+3
Fixes <https://bugs.gnu.org/73835>. This fixes this error when compiling with GCC 14 and musl libc on 32-bit Alpine Linux: filesys.c: In function 'scm_sendfile': filesys.c:1405:16: error: assignment to 'off_t *' {aka 'long long int *'} from incompatible pointer type 'scm_t_off *' {aka 'long int *'} [-Wincompatible-pointer-types] 1405 | offset_ptr = SCM_UNBNDP (offset) ? NULL : &c_offset; | ^ * libguile/filesys.c (scm_sendfile): Change type of ‘c_offset’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-26doc: Recommend alist-copy instead of list-copy.Tomas Volf1-1/+1
The current recommendation of `list-copy' is not right and does not lead to preserving the original list: scheme@(guile-user)> (define x (list (cons 'a 1) (cons 'b 2))) scheme@(guile-user)> (define y (list-copy x)) scheme@(guile-user)> (assq-set! y 'b 3) $1 = ((a . 1) (b . 3)) scheme@(guile-user)> x $2 = ((a . 1) (b . 3)) Correct approach seems to be use `alist-copy' from SRFI-1 leading to the expected behavior of: scheme@(guile-user)> ,use (srfi srfi-1) scheme@(guile-user)> (define x (list (cons 'a 1) (cons 'b 2))) scheme@(guile-user)> (define y (alist-copy x)) scheme@(guile-user)> (assq-set! y 'b 3) $1 = ((a . 1) (b . 3)) scheme@(guile-user)> x $2 = ((a . 1) (b . 2)) * doc/ref/api-data.texi (Adding or Setting Alist Entries): Recommend `alist-copy'. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-26doc: Fix typo in FFI documentation.Nikolaos Chatzikonstantinou1-1/+1
The incorrect procedure is mentioned; see the example that immediately follows. * doc/ref/api-foreign.texi (Foreign Functions): fix typo to pointer->procedure. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-26doc: Document the peek and pk procedures.Juliana Sims1-11/+109
* doc/ref/api-debug.texi: Document the peek and pk procedures. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-26doc: Fix implication of omitting optional arguments.Tomas Volf1-4/+4
According to the previous wording, omitting all optional arguments led to empty interface. That however was not the case and was only a documentation bug (as confirmed by wingo on IRC). So let us fix that. * doc/ref/api-modules.texi (Using Guile Modules): Fix implication of omitting optional arguments. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-26doc: Document #:hide.Tomas Volf1-13/+20
* doc/ref/api-modules.texi (Using Guile Modules): Document #:hide. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-26srfi-64: Accept symbols as test group names.Tomas Volf1-2/+13
The specification mandates a string, but with rationale suggesting symbols would be a more natural fit. > In some ways using symbols would be preferable. However, we want > human-readable names, and standard Scheme does not provide a way to include > spaces or mixed-case text in literal symbols. Add support for symbols as an implementation extension and for backwards compatibility with the reference implementation. * module/srfi/srfi-64.scm (%cmp-group-name): New procedure. (test-end): Use it. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Reported-by: Daniel Llorens <lloda@sarc.name>
2024-10-25Better REPL behavior on syntax errors in meta commands.Taylan Kammer3-9/+12
Fixes <https://bugs.gnu.org/30600>. * module/system/repl/command.scm (define-meta-command): Flush all remaining input after handling a read error. * module/system/repl/common.scm (flush-all-input): New public procedure. * module/system/repl/repl.scm: Remove local flush-all-input definition.
2024-10-22doc: Fix use of literals in alist exampleDaniel Llorens2-76/+101
Fixes https://bugs.gnu.org/32841. * doc/ref/srfi-modules.texi (alist-copy): Add anchor. * doc/ref/api-data.texi (Alist Example): Fix use of literals.
2024-10-20Update NEWS.Ludovic Courtès1-3/+16
2024-10-20posix.c: Set errno when pipe2 is not available and flags provided.Tomas Volf1-1/+1
If pipe2 is not available (e.g. on MacOS) and flags are set, SCM_SYSERROR was correctly signaled, however errno was not set, so it reported as: Undefined error: 0 That sucks both in tests (the test is not skipped) and in actual usage (user has no idea what went wrong). So set errno to ENOSYS as well. * libguile/posix.c (scm_pipe2) [!HAVE_PIPE2] <c_flags>: Set errno to ENOSYS. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20Do not depend on tmpnam in posix.test.Tomas Volf1-2/+4
`tmpnam' is a deprecated procedure that can be excluded during a configure (`--disable-tmpnam'). There currently was a single test relying on it, and therefore failing is such configuration. This commit switches to mkstemp instead. * test-suite/tests/posix.test ("system*"): Use mkstemp instead of tmpnam. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20tests: Fix spawn if file not found with Gnulib.Tomas Volf1-0/+8
On Darwin posix_spawnp is not considered secured and therefore we fallback to Gnulib's version. That one however does not return ENOENT when the file does not exist, but PID of the child process. This seems to be allowed by the standard. * test-suite/tests/posix.test (skip-on-darwin): New procedure. ("spawn")["file not file"]: Skip on Darwin. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20tests: Fix spawn with #:environment on MacOS.Tomas Volf1-6/+17
MacOS adds __CF_USER_TEXT_ENCODING to every program, in similar way GNU Hurd prepends LD_ORIGIN_PATH (based on the comment). So extend the logic to do similar stripping on MacOS. * test-suite/tests/posix.test ("spawn") ["env with #:environment and #:output"]: Strip trailing __CF_USER_TEXT_ENCODING environment variable when on Darwin. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20tests: Skip mkdtemp test for invalid template on Darwin.Tomas Volf1-0/+5
Darwin accepts any template, as demonstrated here: #include <stdio.h> #include <unistd.h> int main(void) { char template[] = {'T', '-', 'A', 'A', 'A', 'A', 'A', 'A', '\0'}; char *res = mkdtemp(template); puts(res ? res : "(null)"); perror("mkdtemp"); } Outputs: T-AAAAAA mkdtemp: Undefined error: 0 This does not match prescribed POSIX behavior, but it is what it is. * test-suite/tests/filesys.test (skip-on-darwin): New procedure. ("mkdtemp")["invalid template"]: Skip on Darwin. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20filesys.c: Fix readlink for ports on Darwin.Tomas Volf2-3/+12
When passed a port, `readlink' relies on the Linux specific behavior of empty c_path meaning "the fd itself". That does not work on Darwin. Since there is no branch that would yield both fd and c_path, fallback to freadlink when __APPLE__ is defined. * libguile/filesys.c (do_readlink): Call freadlink for !__APPLE__. * configure.ac (AC_CHECK_FUNCS): Add freadlink. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20tests: Skip hole-related port tests on Darwin.Tomas Volf1-0/+12
Hole are itself a file-system specific feature and they are not mandated. While APFS does support sparse files, they do not behave like on Linux. I did not discover exact rules, but the file needs to be large (100s of kB at least) and the holes are not aligned as the test code expects. So just disable them. * test-suite/tests/ports.test (skip-on-darwin): New procedure. ("size of sparse file", "SEEK_DATA while on data") ("SEEK_DATA while in hole", "SEEK_HOLE while in hole"): Skip on Darwin. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20tests: Skip tests of abstract Unix sockets on Darwin.Tomas Volf1-0/+8
Darwin does not support abstract Unix sockets, so mark the tests as skipped. * test-suite/tests/00-socket.test (skip-on-darwin): New procedure. ("bind abstract", "listen abstract", "connect abstract") ("accept abstract"): Skip on Darwin. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20tests: Check TCP_NODELAY for non-zero instead of 1.Tomas Volf1-1/+1
POSIX does not explicitly say that stored value using setsockopt will be returned by getsockopt. At least for TCP_NODELAY on Darwin they do differ. Darwin returns internal define TF_NODELAY (4) instead of 1 the test expected. Since for boolean flags "non-zero is true", rewrite the test to check just that. * test-suite/tests/00-socket.test ("setsockopt AF_INET") ["IPPROTO_TCP TCP_NODELAY"]: Check for non-zero value from getsockopt. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20Fix typo in dynamic wind documentation.Andrew McNulty1-1/+1
* doc/ref/api-control.texi: Fix typo in dynamic wind documentation. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20Fix gbt command in gdbinitBrennan Vincent1-1/+1
In 2009 when this was written, SCM_UNDEFINED was 0x704. Now it's 0x904. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20Replace SRFI-64 with a new implementation.Tomas Volf4-1083/+978
The bundled (reference) implementation was of somewhat mixed quality and it failed to follow standard in multiple places. This commit replaces it with a new one, written from scratch to follow the standard as close as possible. * module/srfi/srfi-64/testing.scm: Delete file. * module/srfi/srfi-64.scm: Replace with new implementation. * am/bootstrap.am (srfi/srfi-64.go): Remove extra dependencies. (NOCOMP_SOURCES): Remove srfi/srfi-64/testing.scm. * test-suite/tests/srfi-64-test.scm ("8.6.1. Simple (form 1) test-apply") ("8.6.2. Simple (form 2) test-apply"): Adjust tests to follow the specification. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20Fix setjmp/longjmp-related crashes on WindowsMichael Käppler7-0/+40
* libguile/Makefile.am: add new header file setjump-win.h * libguile/continuations.h, libguile/dynstack.c, libguile/dynstack.h, libguile/intrinsics.h, libguile/vm.h: supply custom `setjmp` macro on Windows Mingw implements `setjmp (env)` as a macro that expands to _setjmp (env, faddr) where `faddr` is set to the current frame address. This address is then stored as first element in the jump buffer `env`. When `longjmp` is called, it tries to unwind the stack up to the saved address by calling `RtlUnwindEx` from MSVCRT, which will fail, if the stack frames are interwoven with JIT-generated code, that violate the Windows x64 calling conventions. Thus implement the macro ourselves as _setjmp (env, NULL) which will toggle a code path in `longjmp` that does no unwinding. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-12fix typo in commentArne Babenhauserheide1-1/+1
module/ice-9/command-line.scm (compile-shell-switches): fix typo
2024-10-12Create procedure to enable silencing the Guile welcome message. * ↵Matthew Wette1-2/+8
module/system/repl/repl.scm: add parameter `%inhibit-welcome-message' * module/system/repl/repl.scm(run-repl*): add condition for calling procedure repl-welcome: if (%inhibit-welcome-message) is `#t', don't
2024-10-12Redirect diagnostice output messages (e.g., auto-compiling code) to a newly ↵Matthew Wette8-27/+88
defined current-info-port, and add a command line argument `-I' to set the current-info-port to a void-port. * libguile/ports.c: add cur_infoport_fluid, scm_current_info_port, scm_set_current_info_port; define default current-info-port to stderr * libguile/load.c(compiled_is_fresh,load_thunk_from_path, do_try_auto_compile,scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path): direct output messages to current_info_port; was current_warning_port * libguile/init.c(scm_init_standard_ports): set default current_info_port * module/ice-9/ports.scm: define current-info-port and set-current-info-port * module/ice-9/command-line.scm(*usage*,compile-shell-switches): add argument `-I' to silence diagnostics (or current-info-port to void-port) * doc/ref/guile-invoke.texi: add description for `-I' command argument
2024-10-12Fix typo in naming function set-current-output-port * ↵Matthew Wette1-1/+1
libguile/ports.c(scm_set_current_output_port): scheme name is set-current-output-port
2024-10-05Compile with -fexcess-precision=standard for i[3456]86 when we canRob Browning2-0/+26
* configure.ac: when -fexcess-precision=standard is available and we're building for i[3456]86, use it. This fixes floating point precision problems caused by x87 (80-bit) floating point, and detected by numbers.test. Closes: 43262
2024-09-27Ensure tests have guile-procedures.txtRob Browning2-18/+17
The tests depend on libguile/guile-procedures.txt, for example via documented? in bit-operations.test. Previously "make check -j..." in a clean tree would fail because libguile/guile-procedures.txt is built by ./Makefile.am (rather than libguile/Makefile.am) so that it will have a built module/ available, but when "." is not listed in SUBDIRS, it builds last, and so the test-suite runs before guile-procedures.txt is built. To fix the problem add "." to SUBDIRS before the test-suite so that the tests will be able depend on everything else, and move the existing guile-procedures.txt target into libguile/ next to its guile-procedures.texi dependency. That gives a better overview and simplifies the recipe a bit. It also allows us to drop the explict "all-local:" dependency, and to let the existing libguile/ code handle the cleanup. * Makefile.am (SUBDIRS): add . just before the test-suite. (libguile/guile-procedures.txt): rely on libguile/Makefile.am. (CLEANFILES): Drop libguile/procedures.txt. * libguile/Makefile.am: (all-local): drop. (libguile/guile-procedures.txt): move Makefile.am recipe here.
2024-09-27Update NEWS.Ludovic Courtès1-0/+4
2024-09-26Run sigbits fixpoint based on use/def graph, not cfgAndy Wingo1-66/+54
* module/language/cps/specialize-numbers.scm (sigbits-ref): New helper. (invert-graph*): New helper. (compute-significant-bits): When visiting a term changes computed needed-bits for one of its definitions, we need to revisit the variables that contributed to its result (the uses), because they might need more bits as well. Previously we were doing this by enqueueing predecessors to the term, which worked if the uses were defined in predecessors, or if all defining terms were already in the worklist, which is the case without loops. But with loops, when revisiting a term, you could see that it causes sigbits to change, enqueue its predecessors, but then the predecessors don't change anything and the fixpoint stops before reaching the definitions of the variables we need. So instead we compute the use-def graph and enqueue defs directly.
2024-09-25Tighten up range inference for scm->u64/truncateAndy Wingo1-3/+5
* module/language/cps/types.scm (scm->u64/truncate): Better range analysis.
2024-09-25Fix boxing of non-fixnum negative u64 valuesAndy Wingo1-1/+20
* module/language/cps/specialize-numbers.scm (u64->fixnum/truncate): New helper. (specialize-operations): Fix specialized boxing of u64 values to truncate possibly-negative values, to avoid confusing CSE. Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71891.
2024-09-25Fix fixpoint needed-bits computation in specialize-numbersAndy Wingo1-17/+10
* module/language/cps/specialize-numbers.scm (next-power-of-two): Use integer-length. No change. (compute-significant-bits): Fix the fixpoint computation, which was failing to complete in some cases with loops.
2024-09-24Partially revert d579848cb5d65440af5afd9c8968628665554c22Andy Wingo1-2/+2
* module/language/cps/specialize-numbers.scm (specialize-operations): Accept any operand to logand/immediate, provided the result is a u64 in the right range.
2024-09-23Narrow parameter of logand/immediate if no bits usedAndy Wingo1-3/+5
* module/language/cps/specialize-numbers.scm (specialize-operations): Narrow ulogand/immediate param according to used bits.
2024-09-23Remove needless constraints in type/range analysisAndy Wingo1-10/+1
* module/language/cps/types.scm (ulogand, ulogand/immediate, ulogsub, ulogior, ulogxor): Where we have u64 inputs, there's no need to `restrict!`; the range will come from the definition.
2024-09-23Add a workaround for pre-3.0.10 incorrect inlinable exportsAndy Wingo1-2/+18
* module/language/tree-il/peval.scm (peval) (inlinable-kwargs-bug-fixup): Before 3.0.10, the inlinable exports pass was incorrectly serializing functions with keyword arguments. This was fixed in 2c645571b351a0044911847025b666551a8e4fb5, but that meant that 3.0.10 compiling against 3.0.9 binaries could raise an exception at compile-time; whoops. Add a workaround so that 3.0.9 binaries still work. Fixes https://issues.guix.gnu.org/72936.
2024-08-26Update psyntax copyright noticeAndy Wingo1-83/+15
* module/ice-9/psyntax.scm: Use the newer LGPLv3 header. Add FSF copyright lines for each year the file was modified. Remove inline changelogs. Remove some comments describing psyntax in other Scheme implementations.
2024-08-15Fix intset-fold-right on transient intsetsAndy Wingo1-8/+9
* module/language/cps/intset.scm (make-intset-folder): intset-fold-right on a transient intset would dispatch to left fold after making the persistent set. Sadness!
2024-08-13More thorough lowering of lognot to CPSAndy Wingo1-2/+6
* module/language/tree-il/compile-cps.scm (canonicalize): Lower to a logxor with -1.
2024-08-13Fix compilation with C23Andy Wingo1-3/+3
* libguile/jit.c (is_unreachable): Rename from "unreachable", which is apparently a new reserved word in C23.
2024-08-12Better error messages in array functionsDaniel Llorens2-70/+77
* doc/ref/api-data.texi (Arrays as arrays of arrays): Clarify ambiguities, fix examples. * libguile/arrays.c (make-shared-array): Make error messages specific to each error case, report relevant arguments. (array_from_pos): Return NULL on error instead of reporting error ourselves. (array_from_get_o): Handle the trivial case. (scm_array_slice, scm_array_cell_ref, scm_array_cell_set_x): Don't build error arguments before error happens. Let array_from_get_o handle the trivial case.
2024-08-03basename: check suffix against basename, not full argumentRob Browning3-13/+34
* libguile/filesys: check suffix against basename, not full argument. Closes: 69437
2024-08-03basename: drop last_component null checkRob Browning1-8/+3
Prepare for fixes to the suffix pruning. Since last_component doesn't document a possible null result in lib/basename-lgpl.h, and the current code also doesn't appear capable of producing one, drop the check. libguile/filesys.c (basename): drop check for last_component null result.
2024-08-03api-data.texi: fix typo in "Real and Rational Numbers" sectionYuval Langer1-2/+2
* doc/ref/api-data.texi: fix typo in "Real and Rational Numbers" section [rlb@defaultvalue.org: adjust commit message] Closes: 59572
2024-08-03NEWS: add some missing 3.0.11 entriesRob Browning1-0/+15
2024-07-30Merge conversion of srfi-1.c to srfi-1.scmRob Browning6-1028/+476
Rewrite the srfi-1 C functions in Scheme and remove srfi-1.c as planned (see the comments at the top of srfi-1.c). The previous C code mutated intermediate results in some cases, even for non-! functions (e.g. set-cdr! to build the result without stack growth or a reverse!); some of the conversions preserve that approach for now. Simple testing via https://github.com/ecraven/r7rs-benchmarks/ didn't reveal any substantial performance regressions. Thanks to David Thompson for reviewing the changes and suggesting improvements.
2024-07-30Drop libguile srfi-1Rob Browning5-112/+0
...now that all of the C code has been migrated to Scheme. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): remove srfi-1.c. (DOC_X_FILES): Remove srfi-1.x. (DOT_DOC_FILES): Remove srfi-1.doc. (modinclude_HEADERS): Remove srfi-1.h. * libguile/init.c (scm_i_init_guile): Don't call scm_register_srfi_1. * libguile/srfi-1.c: Remove. * libguile/srfi-1.h: Remove. * module/srfi/srfi-1.scm: Don't load srfi-1 from libguile.