* libguile/weak-table.h:
* libguile/weak-table.c (scm_weak_table_putq_x)
(scm_weak_table_remq_x, scm_weak_table_clear_x)
(scm_weak_table_for_each): Declare these as returning void instead of
SCM.
* libguile/hashtab.c (scm_hashq_set_x, scm_hashq_remove_x)
(scm_hashv_set_x, scm_hashv_remove_x)
(scm_hash_set_x, scm_hash_remove_x)
(scm_hashx_set_x, scm_hashx_remove_x):
(scm_hash_for_each): For weak tables, have the set! functions return
the values, as they used to do. Have remove! functions return #f,
indicating the lack of a handle. Shim around for-each to return
unspecified, even though that wasn't yet a problem.
* test-suite/tests/weaks.test: Add a test.
* module/language/tree-il/analyze.scm (proc-ref?): Change to use less
false-if-exception and more variable-bound?. If a variable is present
in the local module but not bound, assume that it is gettext if it has
the right name. This is to allow for (define _ gettext).
* test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example.
There are a some failures currently:
FAIL: tree-il.test: warnings: format: non-literal format string with forward declaration
ERROR: srfi-18.test: current-exception-handler: current handler returned at top level - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
ERROR: srfi-18.test: current-exception-handler: multiple levels of handler nesting - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
ERROR: srfi-18.test: current-exception-handler: exception handler installation is thread-safe - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>)))
Conflicts:
module/language/tree-il/peval.scm
module/language/tree-il/primitives.scm
test-suite/tests/tree-il.test
* module/language/tree-il/peval.scm (peval): Add optimization to
hoist the inner procedure out of e.g.
(lambda args (apply (lambda ...) args))
This commit restores the ability to detect escape-only prompts at
compile-time.
* test-suite/tests/tree-il.test: Update test for prompt with a lambda,
and add a specific test for lambda application.
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
Don't limit the call-with-prompt to <prompt> transition to lambda
expressions. Instead we can lexically bind the handler, and rely on
peval to propagate a lambda expression.
* module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm
(define-bytevector-type): Fix definition of <TAG>vector-length when
applied to uniform vectors of different element sizes. Thanks to
Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug.
* test-suite/tests/srfi-4.test: Add tests.
* module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref'
in `false-if-exception'.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string with forward declaration"): New test.
* test-suite/tests/srfi-18.test: Enclose the tests in a begin instead of
an and. Before, they were not being run, for some reason I don't
fully understand.
* libguile/posix.c (scm_fork): Signal an error if a `fork' is attempted
after threads have been spawned.
* test-suite/tests/00-socket.test: Moved here, from socket.test, so as
to run before any threads are created.
* test-suite/Makefile.am: Adapt.
* module/language/tree-il/primitives.scm: add equality-primitive?,
which is true for eq?, eqv?, and equal?
* module/language/tree-il/peval.scm: if an equality primitive is
applied to the same variable twice, fold it to #t
* test-suite/tests/tree-il.test: add tests for pevaling equality
primitives
* module/language/tree-il/analyze.scm (gettext?): Rename to...
(proc-ref?): ... this. Add `proc' and `special-name' parameters.
(gettext?): Define in terms of `proc-ref?'.
(ngettext?): New procedure.
(const-fmt): Recognize `ngettext' calls.
(format-analysis)[<down>](check-format-args]: Check
constant-but-non-string 2nd argument in the (not (const-fmt ...))
case.
[check-simple-format-args]: Use `const-fmt'.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string using ngettext", "non-literal format string using
ngettext as N_"): New tests.
("simple-format")["unsupported, ngettext"]: New test.
Fixes <http://bugs.gnu.org/10846>.
Reported by Bruno Haible <bruno@clisp.org>.
* module/language/tree-il/analyze.scm (gettext?): New procedure.
(const-fmt): Add `env' parameter; update callers. Use `gettext?'.
(format-analysis)[check-simple-format-args]: Actually support
gettextized format strings.
* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
format string using gettext"): Use `gettext' as the procedure name.
("non-literal format string using gettext as _"): New test.
["simple-format"]("unsupported, gettext"): New test.
Fixes <http://bugs.gnu.org/10742>.
Reported by Alírio Eyng <alirioeyng@ig.com.br>.
* gnulib-local/lib/localcharset.c.diff (environ_locale_charset): Change
to set CODESET to "" when LOCALE lacks a dot. Return "ISO-8859-1"
when CODESET is the empty string.
* lib/localcharset.c: Update.
* test-suite/standalone/Makefile.am (check_SCRIPTS): Add
`test-command-line-encoding2'.
(TESTS): Likewise.
* test-suite/standalone/test-command-line-encoding2: New file.
* module/ice-9/boot-9.scm (cond, case): Reimplement using syntax-case,
with improved error messages and support for '=>' within 'case' as
mandated by the R7RS. Add warnings for duplicate case datums and
case datums that cannot be meaningfully compared using 'eqv?'.
* module/system/base/message.scm (%warning-types): Add 'bad-case-datum'
and 'duplicate-case-datum' warning types.
* test-suite/tests/syntax.test (cond, case): Update tests to reflect
improved error reporting. Add tests for '=>' within 'case'.
* test-suite/tests/tree-il.test (partial evaluation): Update tests to
reflect changes in how 'case' is expanded.
* doc/ref/api-control.texi (Conditionals): Document '=>' within 'case'.
* libguile/read.c (scm_read_string): Return a freshly allocated string
every time, even for empty strings. The motivation is to allow source
properties to be added to all strings. Previously, the shared global
'scm_nullstr' was returned for empty strings. Note that empty strings
still share a common global 'null_stringbuf'.
* test-suite/tests/srfi-13.test (substring/shared): Fix tests to reflect
the fact that empty string literals are no longer guaranteed to be
'eq?' to each other.
* module/language/elisp/compile-tree-il.scm (process-let-bindings):
Remove.
(parse-let-binding, parse-flet-binding): New procedures.
(generate-let, generate-let*): Now takes an association list mapping
symbols to values for the `bindings' argument.
(compile-let, compile-let*, compile-lexical-let)
(compile-lexical-let*): Parse the bindings list with
`parse-let-binding'.
(compile-flet): Parse the bindings list with `parse-flet-binding'.
* module/language/elisp/compile-tree-il.scm (bind-lexically?): Accept a
new `decls' argument and check it for `lexical' declarations.
Establish the same kind of binding whether or not a lexical binding
for `sym' exists, whereas previously the presence of a lexical binding
would cause newly-established bindings to be lexical bindings as well.
(split-let-bindings): Remove. All callers changed.
(generate-let, generate-let*, compile-lambda): Pass the declarations
list to `bind-lexically?'.
* test-suite/tests/elisp-compiler.test: Explicitly disable the
lexical-binding mode. Add `lexical' declarations where necessary.
* module/language/elisp/compile-tree-il.scm (split-lambda-arguments):
Remove.
(parse-lambda-list, make-simple-lambda): New procedures.
(compile-lambda): Use `parse-lambda-list' and `make-simple-lambda'.
Set empty rest arguments to the empty list instead of `#nil'.
* test-suite/tests/elisp-compiler.test ("Lambda Expressions")["rest
argument"]: Use Elisp `null' instead of a Scheme equality check.
* module/language/elisp/compile-tree-il (compile-pair): Use `function'
to perform functional evaluation. Previously, if the operator of a
compound form was not a symbol, the operator would be evaluated as a
normal expression. This happened to work only because there is a
`lambda' macro. The compiler will now signal an error if the operator
is neither a function name nor a lambda expression.
* test-suite/tests/elisp-compiler.test ("Lambda Expressions")["optional
argument"]: Remove an erroneous use of `function' in the function
position.
* module/language/elisp/compile-tree-il.scm: (always-lexical): Remove.
All uses changed.
(with-added-symbols): Remove.
(compile-with-always-lexical): Remove.
(process-options!): Remove support for the `#:always-lexical' option.
* module/language/elisp/runtime/function-slot.scm: Update import and
re-export lists.
* test-suite/tests/elisp-compiler.test: Remove or update tests using
`with-always-lexical'.
* module/language/elisp/bindings.scm (global?): New function.
* module/language/elisp/compile-tree-il.scm (lexical-binding): New
variable.
(bind-lexically?): If lexical binding is enabled, bind lexically
unless a special binding exists.
(compile-%set-lexical-binding-mode): New function.
* module/language/elisp/lexer.scm (lexical-binding-regexp): New
variable.
(lex): Return a `set-lexical-binding-mode!' token if a comment is
found while reading the first line.
* module/language/elisp/parser.scm (get-expression): Add support for
`set-lexical-binding-mode!' tokens.
* module/language/elisp/runtime/function-slot.scm: Import and re-export
the `%set-lexical-binding-mode' special form.
* test-suite/tests/elisp-compiler.test
("Let and Let*")["lambda args inside lexical-let"]: Update.
* module/language/elisp/compile-tree-il.scm (generate-let)
(generate-let*, compile-lambda, compile-with-added-symbols)
(compile-progn, compile-if): Return nil if the form's body is empty.
* test-suite/tests/elisp-compiler.test ("Sequencing")["empty progn"]:
New test.
("Conditionals")["if with no else"]: New test.
("Let and Let*")["empty let, empty let*"]: New test.
("Lambda Expressions")["empty lambda"]: New test.
* test-suite/tests/elisp-compiler.test ("Exceptions")["catch and
throw"]: Use a freshly-consed object instead of a literal object. This
test previously assumed that similar literal objects are never
identical, which no longer true.
("Equivalence Predifcates")["eq"]: Likewise.
* module/language/tree-il/analyze.scm (format-string-argument-count):
Add support for ~h.
* test-suite/tests/tree-il.test ("warnings")["format"]("~h", "~:h with
locale object", "~:h without locale object"): New tests.
* doc/ref/misc-modules.texi (Formatted Output): Document ~h. Recommend
use of ~h instead of ~:d.
* module/ice-9/format.scm (format): Add support for ~h.
* test-suite/tests/format.test ("~h localized number"): New test prefix.
* test-suite/tests/i18n.test (%american-english-locale-name,
%american-english-locale): New variables.
(under-american-english-locale-or-unresolved): New procedure.
("format ~h"): New test prefix.
* doc/ref/posix.texi (Network Databases): Update description of
`EAI_NODATA' to mention that Darwin provides it.
* libguile/net_db.c (scm_getaddrinfo): Likewise.
* test-suite/tests/net-db.test ("getaddrinfo")["wrong service name"]:
Accept `EAI_NODATA' too. Reported by David Fang <fang@csl.cornell.edu>,
see <http://bugs.gnu.org/10684>.
* test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved):
Add exception for Darwin 8. Reported by David Fang <fang@csl.cornell.edu>,
see <http://bugs.gnu.org/10684>.
* module/ice-9/boot-9.scm:
* module/ice-9/popen.scm:
* module/ice-9/pretty-print.scm:
* module/ice-9/r4rs.scm:
* module/rnrs/io/ports.scm:
* module/texinfo/string-utils.scm:
* module/web/http.scm:
* module/web/request.scm:
* module/web/response.scm:
* test-suite/vm/run-vm-tests.scm: Make the variable names in Scheme docstrings more
consistent. Replace a few instances of @var with @code when appropriate.
* libguile/foreign.h: Remove comment about the finalizer bit, as I don't
think that is the case any more.
* test-suite/tests/gc.test: Ignore flakiness in the gc-modules test.
* test-suite/lib.scm (clear-stale-stack-references): New helper.
* test-suite/tests/gc.test:
* test-suite/tests/threads.test: Use the new helper.
I removed the "unresolved" throw, as I'd like to see what the bots do
with this.