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

2086 commits

Author SHA1 Message Date
Robin Templeton
e38f6377e3
temporarily disable elisp exception tests
(Best-ability ChangeLog annotation added by Christine Lemmer-Webber.)

* test-suite/tests/elisp-compiler.test ("catch without exception" test)
  ("catch and throw" test, "unwind-protect" test): Switch from pass-if
  to expect-fail.
2021-10-19 18:10:05 -04:00
Robin Templeton
d5246bebe7
ignore 'expect-fail' forms in elisp tests
(Best-ability ChangeLog annotation added by Christine Lemmer-Webber.)

* test-suite/tests/elisp-compiler.test (compile-test): Update to support
  expect-fail.
2021-10-19 18:10:05 -04:00
Robin Templeton
8ce962192f
update cross-compilation test
(Best-ability ChangeLog annotation added by Christine Lemmer-Webber.)

* test-suite/tests/cross-compilation.test (test-target): Update it.
2021-10-19 18:10:05 -04:00
Andy Wingo
d4d4336ede Hotfix to unify (x ...) patterns in match
* module/ice-9/match.upstream.scm (match-gen-ellipsis): Instead of just
binding the identifier when matching (x ...), go through match-one so
that if the id is already bound, we unify instead.
* test-suite/tests/match.test ("unify in list patterns"): Add test.
* test-suite/tests/match.test.upstream: Add additional tests from
upstream.

See commit 05c546e38 in Chibi Scheme.  Thanks to Alex Shinn for help
here!
2021-09-30 15:47:41 +02:00
Ludovic Courtès
74abae04aa Baseline compiler no longer swaps rsh/lsh when transforming ash calls.
Reported by Marius Bakke <marius@gnu.org>
at <https://issues.guix.gnu.org/50696>.

Previously, the baseline compiler would incorrectly emit a right shift
when for, say, (ash x 2), and a left shift for (ash x -2).

* module/language/tree-il/compile-bytecode.scm (canonicalize): When Y is
negative, emit 'rsh', not 'lsh'.
* test-suite/tests/numbers.test ("ash at -O1"): New test.
2021-09-20 23:27:39 +02:00
Daniel Llorens
9a62f7caca Extend bytevector-fill! to handle a partial fill
* libguile/bytevectors.c (bytevector-fill!): As stated.
  (scm_bytevector_fill_x): Stub to avoid changing the C API.
* doc/ref/api-data.texi: Documentation.
* libguile/vectors.c (vector-fill!): Less confusing variable names.
* test-suite/tests/bytevectors.test: Test partial fill cases for
  bytevector-fill!.
2021-08-17 16:47:04 +02:00
Daniel Llorens
c2cf685b65 Remove the 'simple vector' concept
* Deprecate scm_is_simple_vector.
* libguile/vectors.c (scm_vector_elements,
  scm_vector_writable_elements): These functions take an array; reword
  to make this clear.
* libguile/print.h: Remove reference to 'simple vector'.
* doc/ref/api-data.texi: Remove documentation for scm_is_simple_vector.
  Remove references to 'simple vector'.
  Fix documentation for scm_vector_elements,
  scm_vector_writable_elements.
* test-suite/tests/arrays.test:
* test-suite/tests/vectors.test: Remove references to 'simple vector'.
2021-08-16 15:39:21 +02:00
Daniel Llorens
a34c762de0 Extend core vector-copy to r7rs vector-copy
* libguile/vectors.h: Declare scm_vector_copy_partial.
* libguile/vectors.c (scm_vector_copy_partial): As stated.
  (scm_vector_copy): Reuse scm_vector_copy_partial.
* module/scheme/base.scm: Reuse core vector-copy.
* module/srfi/srfi-43: Reuse core vector-copy.
* test-suite/tests/vectors.test: Test vector-copy.
2021-08-06 13:06:51 +02:00
Maxime Devos
c78c130b1d ice-9/read: Parse #{}}# properly.
This is a regression since Guile 3.0.2 and breaks compilation
of a Guile library.

* module/ice-9/read.scm
  (%read)[read-parenthesized]: When SAW-BRACE? is #t but CH isn't
  #\#, don't eat CH.
* test-suite/tests/reader.test
  ("#{}#): Add four test cases.
2021-08-02 12:15:59 +02:00
Rob Browning
d79a226359 Fix crash on #nil in syntaxes
In 3.0.7 (after 0cc7991855 "Ensure
that (syntax ()) results in ("), the use of #nil in syntax-rules
expansions like this:

  (define-syntax foo
    (syntax-rules ()
      ((_ x) (eq? #nil x))))

  (foo #t)

could cause a crash that looks like this:

  ice-9/psyntax.scm:2795:12: In procedure syntax-violation:
  Syntax error:
  unknown location: unexpected syntax in form ()

To fix it, add another special case (the commit mentioned above
special-cased the empty list) to preserve #nil

* module/ice-9/psyntax.scm (gen-syntax): Preserve #nil.
* test-suite/tests/syntax.test: Test #nil in syntax expansions.

Closes: 49305
2021-07-11 15:00:33 -05:00
Andy Wingo
17aab66e75 Fix bug in eq-constant? propagation in CSE if kf == kt
* module/language/cps/cse.scm (compute-out-edges): Only propagate
constant to successor if successor not kf.
* test-suite/tests/compiler.test ("cse auxiliary definitions"):
("closure conversion"): Refactor.
("constant propagation"): New test.

Fixes #48368.
2021-05-24 11:09:24 +02:00
Leo Prikler
5c6a944173 bug#45131: [PATCH] Compile directly to target language if no joint is found.
This enables the compilation from "manually" written Tree-IL to
bytecode.  See also <https://bugs.gnu.org/45131>.

* system/base/compile.scm (read-and-compile)[(joint #f)]<? eof-object?>:
Join exps using the default joiner for to.
<exp>: Compute compiler for to.
* test-suite/test/compiler.test ("read-and-compile tree-il"): New test.
2021-05-10 10:16:10 +02:00
Ludovic Courtès
5969490f55 analyze: 'unbound-variable' warning handles re-exported bindings.
Fixes <https://bugs.gnu.org/47031>.

* module/language/tree-il/analyze.scm (make-use-before-definition-analysis)
[resolve]: Add case for when NAME is re-exported by MOD.
* test-suite/tests/tree-il.test ("warnings")["re-exported binding"]: New test.
2021-05-02 01:20:19 +02:00
Andy Wingo
44a6a21dcc Fix tree-il effects analysis for prompts
* module/language/tree-il/effects.scm (make-effects-analyzer): The body
of a prompt is an expression only for escape-only prompts, and the
handler is always a lambda.  Fix bug where a prompt could be incorrectly
marked effect-free.
* test-suite/tests/tree-il.test ("optimize"): Add test for bug 48098.

Fixes bug 48098.
2021-05-01 22:16:20 +02:00
Andy Wingo
3383a2cb10 Fix bug for read-syntax on ( . args)
* module/ice-9/boot-9.scm: Capture syntax?.
* module/ice-9/read.scm (read-syntax): Avoid re-annotating objects.
* test-suite/tests/reader.test ("read-syntax"): Add test.
2021-05-01 20:43:07 +02:00
Andy Wingo
3bce507407 Fix syntax test
* test-suite/tests/syntax.test ("expressions"): The source location
alist is unordered.
2021-04-29 22:04:10 +02:00
Ludovic Courtès
8847aaec41 bug#48096: [3.0.6] ‘syntax-error’ exceptions include vectors instead of source location properties
Hi!

In 3.0.6, a slight incompatibility crept in: ‘syntax-error’ exceptions
include vectors like #("example.scm" 1 2) instead of good’ol source
property alists.

Here is a test case that reproduces the problem:
2021-04-29 21:50:12 +02:00
Ludovic Courtès
8c1a26f4d4 bug#48089: Guile 3.0.6 returns zero-indexed locations for ‘read-error’
Ludovic Courtès <ludo@gnu.org> skribis:

> Guile 3.0.6 returns zero-indexed (instead of one-indexed) source code
> locations for ‘read-error’.  Here’s a 3.0.6/3.0.5 comparison:
>
> $ /gnu/store/r2nr74rwhpqg16y1lyi6l0jn3lwx4yyz-guile-3.0.6/bin/guile  <(echo '(')
> ice-9/read.scm:126:4: In procedure lp:
> /dev/fd/63:1:0: unexpected end of input while searching for: )
> $ guile  <(echo '(')
> ERROR: In procedure primitive-load:
> In procedure scm_i_lreadparen: /dev/fd/63:2:1: end of file

Here’s a test case waiting to succeed!  :-)
2021-04-29 21:36:21 +02:00
Andy Wingo
12fa7d115d Fix closure-conversion bug for SCC with all free vars pruned
* module/language/cps/closure-conversion.scm (convert-one): Fix bug when
getting value of SCC whose free variables have been elided.  Thanks to
abcdw for the report!
* test-suite/tests/compiler.test ("cse auxiliary definitions"): Remove
spurious newline.
("closure conversion"): New test.
2021-04-27 14:51:38 +02:00
David Thompson
498564e3e3 goops: Preserve all slot options in redefinable classes.
* module/goops.scm (compute-slots): Fix <redefinable-class> slot
transformation.
* test-suite/tests/goops.test ("slot options on redefinable classes"):
Add a test.
2021-03-19 21:45:53 +01:00
Andy Wingo
9e32c5729e Fix recent i18n tests
* test-suite/tests/i18n.test ("text collation (French)"): Fix to
actually pass locale arg.
2021-03-16 21:55:22 +01:00
Andy Wingo
72bf9d93ca Fix buffer overread in string-locale<?
* libguile/i18n.c (compare_strings): In all cases, convert to a
null-terminated string.  While we're doing that, might as well use
utf-8.
* test-suite/tests/i18n.test ("text collation (French)"): Add test.

Thanks again to Rob Browning for the report.
2021-03-15 22:02:12 +01:00
Andy Wingo
8a8727db5c Adapt test for string-locale-ci=?
* test-suite/tests/i18n.test ("text collation (French)"): Punt on
collating if utf8 locale unavailable.
2021-03-15 21:59:15 +01:00
Andy Wingo
d87b57a00b Fix buffer overread in string-locale-ci=? and related functions
* libguile/i18n.c (u32_locale_casecoll): Take lengths of incoming
strings as parameters rather than assuming "nul" termination.
(compare_u32_strings_ci): Pass string lengths as computed from the
Scheme strings.
* test-suite/tests/i18n.test ("text collation (English)"): Add a test
case.

Thanks a million to Rob Browning for the report.
2021-03-15 21:23:43 +01:00
Mike Gran
5a1e78a278 On Cygwin, 'lib' DLLs use 'cyg' prefix
When using automake and libtool to build DLLs on Cygwin, libtool
will rename libXXX to cygXXX. 'load-foreign-library' should
emulate libltdl behavior and search for DLLs using that convention.

* module/system/foreign-library.scm (lib->cyg): new helper function
  (load-foreign-library): add rename-on-cygwin? option to rename
    libraries using Cygwin semantics
* test-suite/tests/foreign.test: new test section 'lib->cyg'
* doc/ref/api-foreign.text: document new rename-on-cygwin? option
    for load-foreign-library
2021-03-13 09:09:30 -08:00
Andrew Whatson
bc50aff6f8 Add tests for get-bytevector-some!
* test-suite/tests/r6rs-ports.test (get-bytevector-n! [short]): add
  (get-bytevector-n! [long]): add
2021-03-12 22:11:51 +01:00
Andy Wingo
e30ee90478 Revert "Handle CRLF and Unicode line endings in read-line"
This reverts commit 0f983e3db0.

After discussing with Mike we are going to punt the read-line changes
for now.  Open the port in O_TEXT mode if you want to chomp the CR in
CFLF sequences.
2021-03-12 22:08:16 +01:00
Mike Gran
0f983e3db0 Handle CRLF and Unicode line endings in read-line
* libguile/rdelim.c (scm_read_line): handle CRLF, LS and PS
* module/ice-9/suspendable-ports.scm (read-line): handle CRLF, LS, and PS
* module/web/http.scm (read-header-line): take advantage of CRLF in read-line
   (read-header): don't need to test for \return
* test-suite/tests/rdelim.test: new tests for read-line CRLF, LS and PS
* doc/ref/api-io.texi: update doc for read-line
2021-03-11 19:42:33 -08:00
Michael Gran
a744f98dcc ice-9 ftw: handle non-working inodes
* module/ice-9/ftw.scm (visited?-proc): accept filename for string hash
  (file-system-fold): use string hash if ino = 0
  (ftw): use new visited?-proc
* test-suite/tests/ftw.test (visited?-proc valid inodes): add filenames to visited?-proc calls
  (visited?-proc broken inodes): new tests
  (%top-srcdir): canonicalize-path
2021-03-11 10:46:35 -08:00
Michael Gran
c150044640 ice-9 ftw: handle missing getuid and getgid
* module/ice-9/ftw.scm (getuid-or-false, getgid-or-false): new macros
  (stat-dir-readable?-proc): don't overwrite arguments
  (ftw, nftw): use new macros
* test-suite/tests/ftw.test (test-EACCES): don't presume getuid exists
2021-03-11 10:46:24 -08:00
Andy Wingo
85433fc2b1 Add mkstemp; undocument mkstemp!
* doc/ref/posix.texi (File System): Update to document mkstemp only.
* libguile/filesys.c: Make a mkstemp that doesn't modify the input
template.  Instead the caller has to get the file name from
port-filename.
(scm_mkstemp): Use the new mkstemp to implement mkstemp!.  Can't
deprecate yet though as the replacement hasn't been there for long
enough.
* libguile/posix.c (scm_tempnam): Update to mention mkstemp instead.
* module/system/base/compile.scm (call-with-output-file/atomic): Use
mkstemp.
* test-suite/tests/posix.test:
* test-suite/tests/r6rs-files.test: Use mkstemp.
* NEWS: Update.
2021-03-10 20:40:10 +01:00
Michael Gran
653cc0bf95 disable popen 'no duplicates' test for MinGW
This test, which seems quite complicated to fix, causes the MinGW build
to hang. Disable it for now, but, come back to it later.

* test-suite/tests/popen.test (mingw?): new constant
  (no duplicate): disable for mingw, for now
2021-03-10 01:59:59 -08:00
Andy Wingo
cad6094cbc Fix reading #!!#
* module/ice-9/read.scm (%read): Fix reading #!!#.
* test-suite/tests/reader.test ("reading"): Add some test cases.
2021-03-07 20:17:58 +01:00
Andy Wingo
9fb550b945 Fix reading "#;", "'", and similar premature-EOF situations
* module/ice-9/read.scm (%read): Adjust how subexpressions are read to
error on EOF.  Improve the error message.
* test-suite/tests/reader.test ("#;"): Adapt expectation.
2021-03-05 21:06:04 +01:00
Daniel Llorens
9516a10ab3 Fix bug in new array reader
* module/ice-9/read.scm (read-array): Return pair for dimension when len
  is given; single number is lbnd for list->typed-array.
* test-suite/tests/arrays.test: More test cases for the reader.
2021-03-03 18:40:39 +01:00
Andy Wingo
8edf1dc623 Read-in-scheme replaces boot "read" definition
Instead of defining a separate module, given that "read" calls are quite
all over the place, we're just going to replace the boot "read" binding
with read.scm.  This way, we'll be able to remove support for reader
options in the boot reader, as it will only ever be used for a finite
set of files.

* NEWS: Update.
* module/Makefile.am (ice-9/boot-9.go): Depend on read.scm.
(SOURCES):
* am/bootstrap.am (SOURCES): Don't build a ice-9/read.go, as we include
it.
* module/ice-9/boot-9.scm (read-syntax): Define here, as "include" now
uses it.
(read-hash-procedures, read-hash-procedure, read-hash-extend): New
procedures.  Will replace C variants.
(read, read-syntax): Include read.scm to define these.
* module/ice-9/psyntax-pp.scm (include): Regenerate.
* module/ice-9/psyntax.scm (include): Use read-syntax, so we get better
source information.
* module/ice-9/read.scm (let*-values): New local definition, to avoid
loading srfi-11.
(%read): Use list->typed-array instead of u8-list->bytevector.
* module/language/scheme/spec.scm: Remove (ice-9 read) import;
read-syntax is there in the boot environment
2021-03-03 17:08:55 +01:00
Andy Wingo
118f0c23c4 Relax srfi-105 source expectations
* test-suite/tests/srfi-105.test ("curly-infix"): For { EXPR }, allow
the source to be at the { rather than at EXPR.
2021-03-03 17:08:55 +01:00
Andy Wingo
5ea8c69e91 Invalid charset at EOF does not cause decoding error
* libguile/ports.c (peek_iconv_codepoint): If the input has no bytes,
there's little point in raising a decoding error here.  Therefore remove
the needless iconv acquisition, harmonising with suspendable-ports.
* test-suite/tests/ports.test ("port-encoding"): Update test to include
some input so that the exception gets raised.
2021-03-03 16:22:56 +01:00
Daniel Llorens
a4a5fbced3 Fix another typo in routine reading arrays
* module/ice-9/read.scm: As stated.
* test-suite/tests/arrays.test: Test a fixed case.
2021-03-02 15:12:20 +01:00
Andy Wingo
03448b289d Read Scheme via read-syntax
* module/language/scheme/spec.scm: Use read-syntax.
* test-suite/tests/dwarf.test: Adapt expected source locations.
* am/bootstrap.am (SOURCES): Add ice-9/read.
2021-02-25 16:07:47 +01:00
Michael Gran
56e3adefc9 the mkdtemp tests don't clean up the directories created
The tests erroneously try to rmdir the template names, not the
names of the directories created.

* test-suite/tests/filesys.test ("mkdtemp"): clean up temp directories,
    and not their templates
2021-02-04 02:48:35 -08:00
Andy Wingo
2e26538d6a Replace libltdl with raw dlopen, dlsym
* NEWS: Update.
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Add system/foreign-library.scm.
* configure.ac: Replace ltdl check with -ldl check.
* libguile/dynl.c: Rewrite to just expose core dlopen / dlsym / etc to a
  helper Scheme module.
  (scm_dynamic_link, scm_dynamic_pointer, scm_dynamic_function)
  (scm_dynamic_object_p, scm_dynamic_call): Rewrite in terms of (system
  foreign-library).
* libguile/extensions.c (load_extension): Avoid scm_dynamic_call.
* module/system/foreign-library.scm: New file.
* module/oop/goops.scm (<dynamic-object>): Hackily export
  <foreign-library> instead of a class here.
* doc/ref/api-foreign.texi (Foreign Function Interface): Rewrite to only
  document the new interfaces.  Eventually we will deprecate
  dynamic-link and friends.
* doc/ref/guile.texi (API Reference): Move Foreign Objects after Foreign
  Function Interface.  Seems there should be some closer relationship
  but this will do for now.
* doc/ref/tour.texi (Putting Extensions into Modules):
* doc/ref/libguile-parallel.texi (Parallel Installations): Update for
  rename of Modules and Extensions to Foreign Extensions.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_dynamic_unlink): Deprecate.
* libguile/guile.c: Remove ltdl include.
* test-suite/tests/foreign.test: Update tests to use new API, and update
  error expectations.
2021-02-03 23:02:21 +01:00
Mike Gran
480d86df68 strptime test shouldn't presume that initial whitespace is ignored
As far as I can tell, ignoring initial whitespace is not required by POSIX.

* test-suite/tests/time.test (strptime tests):
2021-01-23 12:35:01 -08:00
Mike Gran
d6afb41192 don't test crypt if not present
* test-suite/tests/posix.test (crypt):  throw unsupported if crypt not presetnt
2021-01-23 12:10:22 -08:00
Mike Gran
cdcdd29e8e socket test should not throw unresolved outside of a test
* test-suite/tests/00-socket.test: don't throw at top level
2021-01-23 10:00:07 -08:00
Michael Gran
54fe8e83d9 add test for setsockopt
* test-suite/tests/00-socket.test (setsockopt AF_INET): new test
2021-01-23 09:54:59 -08:00
Michael Gran
91d4d31184 socket test should not throw unresolved outside of a test
* test-suite/tests/00-socket.test: don't throw unresolved outside of a
    test
2021-01-21 15:35:53 -08:00
Michael Gran
c65154ac69 avoid a ports test when fcntl is not provided
* test-suite/tests/ports.test (non blocking I/O): disable test when fcntl
    is not provided
2021-01-21 15:35:43 -08:00
Michael Gran
efecac1c7d skip version test if git-version-gen can't compute version from git
This might occur due to a shallow git clone.

* test-suite/tests/version.test: throw unsupported if version is unknown
2021-01-21 15:35:09 -08:00
Michael Gran
50da05835a for socket test, don't presume TMP is usable
* test-suite/tests/00-socket.test: don't abort when unable to change
    into tmpdir
2021-01-21 15:30:09 -08:00