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

1263 commits

Author SHA1 Message Date
BT Templeton
5ddd9645c9 Merge branch 'bt/elisp'
Conflicts:
	am/guilec
	libguile/_scm.h
	libguile/vm-i-scheme.c
	module/language/elisp/compile-tree-il.scm
	module/language/elisp/runtime.scm
	module/language/elisp/runtime/macros.scm
	module/language/tree-il/compile-glil.scm
	module/language/tree-il/primitives.scm
2012-03-05 16:52:05 -05:00
Andy Wingo
07e69928fc hash-set! on weak tables returns the value
* 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.
2012-03-02 18:26:56 +01:00
Andy Wingo
dee4e3ee3c Merge remote-tracking branch 'origin/stable-2.0' 2012-03-02 17:46:52 +01:00
Andy Wingo
dab48cc567 tweaks to -Wformat's gettext detection
* 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.
2012-03-02 17:46:28 +01:00
Andy Wingo
d489998364 Merge remote-tracking branch 'origin/stable-2.0'
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
2012-03-02 17:20:47 +01:00
Andy Wingo
eebcacf41c peval: inline applications of lambda to rest args
* 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.
2012-03-02 16:47:39 +01:00
Andy Wingo
20337139d2 more general treatment of call-with-prompt
* 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.
2012-03-02 16:47:39 +01:00
Mark H Weaver
ef405f8ba7 Fix <TAG>vector-length when applied to other uniform vector types
* 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.
2012-03-01 16:16:18 -05:00
Ludovic Courtès
d316047326 Avoid failure when `format-analysis' stumbles upon unbound variables.
* 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.
2012-02-27 00:51:09 +01:00
Andy Wingo
a850c3ccc4 srfi-18 test fix
* 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.
2012-02-24 20:01:47 +01:00
Andy Wingo
415e00fc57 signal an error on multithreaded fork
* 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.
2012-02-24 11:20:21 +01:00
Andy Wingo
9d15db65ff Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
	module/language/tree-il/analyze.scm
2012-02-23 14:10:22 +01:00
Andy Wingo
71cc8d96ee add test for recent quick fix
* test-suite/tests/web-uri.test ("string->uri"): Add test for
  string->uri with hosts beginning in digits.
2012-02-22 20:08:44 +01:00
Noah Lavine
3c65e3fda5 Optimize Equality Primitives
* 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
2012-02-20 15:24:17 -05:00
Ludovic Courtès
98385ed20a Have -Wformat' recognize ngettext' calls.
* 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.
2012-02-19 23:54:18 +01:00
Ludovic Courtès
afc9803113 Have -Wformat' better recognize the gettext' procedure.
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.
2012-02-19 23:08:49 +01:00
Andy Wingo
58565208bd Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
	libguile/read.c
	libguile/srcprop.c
	module/ice-9/psyntax-pp.scm
2012-02-17 10:21:50 +01:00
Andy Wingo
2c84211e63 remove deprecated features test
* test-suite/tests/procprop.test ("procedure-arity"): Remove a test of
  deprecated features.
2012-02-15 23:40:42 +01:00
Mark H Weaver
cac24946da Add tests to verify that 'read' sets source properties when appropriate
* test-suite/tests/srcprop.test (source properties): Add tests.
2012-02-15 12:23:12 -05:00
Andy Wingo
a41bed83ab Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/read.c
	test-suite/tests/tree-il.test
2012-02-11 18:14:48 +01:00
Mark H Weaver
e7cf0457d7 Support => within case, and improve error messages for cond and case
* 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'.
2012-02-08 16:27:48 -05:00
Mark H Weaver
043850d984 Unoptimize 'read' to return freshly allocated empty strings
* 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.
2012-02-08 16:27:32 -05:00
Andy Wingo
0858753e82 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	libguile/gc-malloc.c
	libguile/ports.c
2012-02-08 11:48:08 +01:00
Ludovic Courtès
13fb25ba0c i18n: Skips ~h `format' tests when digit grouping info is missing.
* test-suite/tests/i18n.test ("format ~h"): Skip tests when
  `locale-digit-grouping' returns '().
2012-02-04 23:38:47 +01:00
BT Templeton
0e5b7e74e4 fix `flet' syntax
* 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'.
2012-02-03 18:53:50 -05:00
BT Templeton
f6e0a4a60c elisp binding declarations
* 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.
2012-02-03 18:53:50 -05:00
BT Templeton
1631817977 elisp lambda list parsing
* 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.
2012-02-03 18:53:49 -05:00
BT Templeton
48489836e2 evaluate the function position correctly
* 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.
2012-02-03 18:53:49 -05:00
BT Templeton
0a32abc462 remove `flet*' elisp special form
* module/language/elisp/compile-tree-il.scm (compile-flet*): Remove.
* module/language/elisp/runtime/function-slot.scm: Update module
  definition.
* test-suite/tests/elisp-compiler.test
  ("Lambda Expressions")["flet and flet*"]: Remove `flet*' test.
2012-02-03 18:53:49 -05:00
BT Templeton
e5a361d1f9 remove `with-always-lexical' elisp special form
* 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'.
2012-02-03 18:53:49 -05:00
BT Templeton
03e00c5c9d emacs-compatible lexical binding
* 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.
2012-02-03 18:53:49 -05:00
BT Templeton
d5ac6923c3 fix compilation of elisp forms with empty bodies
* 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.
2012-02-03 18:53:48 -05:00
BT Templeton
a338fa3d87 remove unnecessary elisp macros
* module/language/elisp/runtime/macros.scm (when, unless, dotimes)
  (dolist, pop, push): Remove. (They are not special forms in Emacs.)

* module/language/elisp/runtime/function-slot.scm: Update import and
  export lists.

* test-suite/tests/elisp-compiler.test ("Conditionals")["failing when"]
  ["succeeding when", "failing unless", "succeeding unless"]: Remove.
  ("Iteration")["dotimes", "dolist"]: Remove.
  ("List Built-Ins")["pop", "push"]: Remove.
2012-02-03 18:53:48 -05:00
BT Templeton
59e46065ce elisp test fixes
* 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.
2012-02-03 18:53:48 -05:00
BT Templeton
b0a9f1b4b4 remove unnecessary elisp subrs
* module/language/elisp/runtime/subrs.scm (copy-tree, number-sequence):
  Remove. (They are not subrs in Emacs.)

* test-suite/tests/elisp-compiler.test ("List Built-ins")["copy-tree",
  "number-sequence"]: Remove.
2012-02-03 18:53:48 -05:00
BT Templeton
16254e5a09 atomp' -> atom'
* module/language/elisp/runtime/subrs.scm (atomp) Rename to...
  (atom): ...this. All callers changed.
2012-02-03 18:53:48 -05:00
Ludovic Courtès
b4af80a423 Augment -Wformat' analysis with support for ~:h'.
* 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.
2012-02-03 16:52:15 +01:00
Ludovic Courtès
afd08fdf87 format: Add specifier ~h for localized number output.
* 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.
2012-02-03 16:35:06 +01:00
Ludovic Courtès
c76fdf69a8 i18n: Add a couple of tests for `monetary-amount->locale-string'.
* test-suite/tests/i18n.test ("monetary-amount->locale-string"): New
  test prefix.
2012-02-03 14:31:17 +01:00
Ludovic Courtès
1ba05158eb tests: Have `getaddrinfo' test work for Darwin 8.
* 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>.
2012-02-03 10:30:52 +01:00
Ludovic Courtès
6f63f118ef tests: Work around erroneous tr_TR locale in Darwin 8.
* 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>.
2012-02-03 10:17:12 +01:00
Mike Gran
ec97a06f86 Update srfi-14 test for Unicode 6.1
Some Latin-1 symbols have been reclassified as punctuation

* test-suite/tests/srfi-14.test: updated
2012-02-02 19:50:07 -08:00
Andy Wingo
52de2ab45a leniency in the "unused modules are removed" gc.test
* 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.
2012-02-02 00:10:11 +01:00
Andy Wingo
5270a001ad an experiment: clearing the C stack in gc tests
* 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.
2012-01-31 17:57:13 +01:00
Ludovic Courtès
b469997798 Remove stale test file.
* test-suite/tests/srfi-42.test: Delete "tmp1" at the end.
2012-01-30 20:57:42 +01:00
Andy Wingo
dfadcf85cb Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/debug.h
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	module/language/tree-il/peval.scm
	module/language/tree-il/primitives.scm
2012-01-30 20:27:35 +01:00
Andy Wingo
252acfe8e7 Merge commit '3d51e57cfb'
Conflicts:
	libguile/foreign.c
	libguile/hashtab.c
	module/ice-9/psyntax-pp.scm
	module/language/tree-il/compile-glil.scm
2012-01-30 18:52:46 +01:00
Andy Wingo
855db1905d Merge commit '9b0975f1dc'
Conflicts:
	libguile/foreign.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
2012-01-30 18:25:07 +01:00
Mark H Weaver
adb8054c6d Fix primitive-eval to return #<unspecified> for definitions
* module/ice-9/eval.scm (primitive-eval): Return #<unspecified> for
  definitions.  Previously the variable object was returned.

* test-suite/tests/eval.test (evaluator): Add test.

* NEWS: Add news entry.
2012-01-30 10:27:23 -05:00
Mark H Weaver
2f3e436411 Fix 'local-eval' when the specified environment is a module
* module/ice-9/local-eval.scm (local-wrap): Fix the (module? e) case, to
  reference the expression 'x' instead of the non-existent variable
  'exp', as was previously done.  Also use quasisyntax instead of
  quasiquote, so that the introduced 'lambda' is an identifier instead
  of a bare symbol, so that this will work in modules that have rebound
  'lambda' to something else.

* test-suite/tests/eval.test (local-eval): Make sure to test both
  'local-eval' and 'local-compile' when the specified environment is a
  module.
2012-01-30 03:02:32 -05:00