Thanks to Ludovic for the new wording!
* doc/ref/api-compound.texi (Accessing Arrays from C): Correct text to
reflect the current implementation of scm_array_get_handle and
scm_array_handle_release - which don't actuall do any dynwind stuff.
This fixes a problem on some platforms where a pre-inst guile
incorrectly picks up an old installed library (e.g. from
/usr/local/lib) instead of the not-yet-installed newly built library.
For detailed discussion see
and
http://www.mail-archive.com/guile-devel@gnu.org/msg02529.html.
* pre-inst-guile-env.in (subdirs_with_ltlibs): Add libguile.
* pre-inst-guile.in (subdirs_with_ltlibs): Add libguile.
MinGW apparently can't export/import struct variables from/to a DLL,
so wrap the ones needed by inline.h in exported/imported pointer
variables.
All of the following changes apply to a MinGW build only.
* libguile/gc-freelist.c (scm_i_master_freelist_ptr,
scm_i_master_freelist2_ptr): New API variables.
* libguile/gc.h (scm_i_freelist_ptr, scm_i_freelist2_ptr,
scm_i_master_freelist_ptr, scm_i_master_freelist2_ptr): New global
variable declarations.
* libguile/inline.h (scm_cell): Use scm_i_freelist_ptr and
scm_i_master_freelist_ptr instead of scm_i_freelist and
scm_i_master_freelist.
(scm_double_cell): Use scm_i_freelist2_ptr and
scm_i_master_freelist2_ptr instead of scm_i_freelist2 and
scm_i_master_freelist2.
* libguile/threads.c (scm_i_freelist_ptr, scm_i_freelist2_ptr): New
global variables.
The dummy scm_init_* and scm_c_init_* functions in the empty libraries
for SRFIs 4, 13 and 14 clash with declarations with the same names in
libguile.h that are marked (in the MinGW build) with __declspec
(dllimport). These libraries are empty because their content was
moved into libguile some time ago, and I think these functions are
needed only so that the libraries appear to contain something. They
used also to be needed for the (load-extension ...) forms in the
corresponding .scm modules, but those forms were not needed anymore,
and so were removed, when everything moved into libguile.
* srfi/srfi-13.c (scm_init_srfi_13_no_clash_with_libguile): Renamed
from scm_init_srfi_13.
(scm_init_srfi_13_14_no_clash_with_libguile): Same.
* srfi/srfi-14.c (scm_init_srfi_14_no_clash_with_libguile): Same.
(scm_c_init_srfi_14_no_clash_with_libguile): Same.
* srfi/srfi-4.c (scm_init_srfi_4_no_clash_with_libguile): Same.
This reverts commit 0b3d52fae1.
It was a confusing mistake to create an FAQ file in the Guile
repository/distribution, because there was already an FAQ page on the
Guile web site. The information that was in the FAQ file is now in
the FAQ web page.
The main motivation for this is wanting a successful MinGW build,
which is currently failing with:
guile-guile.o: In function `inner_main':
/home/neil/SW/Guile/ovnight/libguile/guile.c:55: undefined reference to `__imp__gdb_result'
/home/neil/SW/Guile/ovnight/libguile/guile.c:55: undefined reference to `__imp__gdb_output'
/home/neil/SW/Guile/ovnight/libguile/guile.c:55: undefined reference to `__imp__gdb_output_length'
The detailed problem here is to do with how those variables are
declared as exported from the libguile DLL and imported by the guile.c
main program. But in fact we don't need to solve that problem because
the GDB interface is an idea that never actually happened. So here we
just remove the offending variable references from guile.c.
For the record, Guile contains two kinds of GDB support, one of which
is real (and works, last time I tried it), and the other mythical.
The first kind is that libguile includes the utility functions
gdb_print, gdb_eval, etc., and the variable gdb_output. These have no
purpose except for developers to use from GDB when debugging
something. For example, if you have a SCM x and want to know what it
is, you can do:
(gdb) call gdb_print(x)
(gdb) p gdb_output
The second kind is that those utility functions are somehow declared
to GDB, and then GDB itself uses/calls them in some useful way. This
was an interesting idea, but (AFAICT) never actually happened.
I think it's worth leaving gdb_interface.h in the repository and the
distribution, in case this idea is properly resurrected in the future.
* libguile/guile.c (top level): Remove GDB_INTERFACE declaration.
(inner_main): Remove GDB_INTERFACE_INIT call.
The warning is:
stime.c:85: warning: `tzname' redeclared without dllimport attribute: previous dllimport ignored
The second half of this section of #ifdefery implies that the MinGW
build isn't going to reference a function called `tzname' anyway
(because it's going to use `_tzname' instead). So why should a MinGW
build want any declaration of `tzname' at all?
As far as a declaration of `_tzname' is concerned, there are no
more #includes after this, so we must have already got a declaration
of `_tzname' from one of the preceding includes.
* libguile/stime.c (tzname): Remove declaration in __MINGW32__ build.
It isn't needed and causes a build warning.
As the Autoconf documentation says, "These days portable programs
[...] should not rely on `HAVE_RESTARTABLE_SYSCALLS', since nowadays
whether a system call is restartable is a dynamic issue, not a
configuration-time issue."
In other words, if we ever rely on HAVE_RESTARTABLE_SYSCALLS, we are
at the mercy of any code that Guile happens to be linked with, because
that code could install a signal handler without the SA_RESTART flag,
and then a Guile system call could unexpectedly return EINTR.
The readline part of this goes back to this problem report:
excellent example of the above paragraph. It was noted during the
discussion that undefining HAVE_RESTARTABLE_SYSCALLS would fix the
problem, but that solution wasn't adopted - I guess because Guile was
still using cooperative threads then (not pthreads) and so there was a
significant concern (whether founded or not) that not using
restartable syscalls (where available) could lead to a loss of
performance.
Now Guile's default mode of operation is with pthreads, where we
already don't assume that HAVE_RESTARTABLE_SYSCALLS is reliable, so
there is no possible further performance loss. And in any case we
really have no choice, if we want correct operation.
* configure.in (AC_SYS_RESTARTABLE_SYSCALLS): Removed.
* doc/ref/posix.texi (Signals): Remove statement that Guile always
sets SA_RESTART flag.
* guile-readline/configure.in (GUILE_SIGWINCH_SA_RESTART_CLEARED):
Remove this setting, together with its test code.
(HAVE_RL_PRE_INPUT_HOOK): Remove this setting and its code, as no
longer needed.
* guile-readline/readline.c (sigwinch_enable_restart): Removed.
(scm_init_readline): Remove setting of rl_pre_input_hook.
* libguile/_scm.h (SCM_SYSCALL): Remove the definition that relies on
HAVE_RESTARTABLE_SYSCALLS.
* libguile/scmsigs.c (scm_sigaction_for_thread): Don't always set the
SA_RESTART flag if available. Update docstring accordingly.
(scm_init_scmsigs): Remove code that sets SA_RESTART flag for all
signals.
Thanks to Greg Troxel for reporting, and Barry Fishman for the
explanation and fix.
* test-suite/tests/popen.test ("open-input-pipe"): Use shell function
`read' with an explicit argument, as apparently not all shells
support read with no argument.
* libguile/threads.c (scm_join_thread): Always recheck t->exited
before calling block_self again, in case thread t has now exited.
* test-suite/tests/threads.test (joining): New test.
On the one hand we want the child process in these tests to exit. On
the other, we don't want it to exit before the parent Guile code has
tested the relevant condition (EOF in the first test, broken pipe in
the second) - because these conditions would obviously be true if the
child had already exited, and that's not what we're trying to test
here. We're trying to test getting EOF and broken pipe while the
child process is still alive.
* test-suite/tests/popen.test (open-input-pipe:no duplicate): Add
another pipe from parent to child, so that the child can finish by
reading from this. Then the parent controls the child lifetime by
writing to this pipe.
* test-suite/tests/popen.test (open-output-pipe:no duplicate): Add
another pipe from child to parent, and have the child finish by
endlessly writing into this. Then the parent controls the child
lifetime by closing its end of the pipe, causing a broken pipe in
the child.
* test-suite/tests/reader.test ("read-options"): Add test
for long postfix keywords.
* libguile/read.c (scm_read_mixed_case_symbol): Fix
exception on symbols are greater than 128 chars. Also,
colons are not stripped from long postfix keywords.
* configure.in: Check for the declaration of flock(2).
* libguile/posix.c [!__MINGW32__][!HAVE_DECL_FLOCK]: Provide an flock(2)
declaration, needed on Tru64 5.1b.
* test-suite/standalone/test-round.c (HAVE_MACHINE_FPU_H): Include
<sys/types.h> when available. This fixes compilation on NetBSD.
Reported by Greg Toxel.
* configure.in (CPPFLAGS): Add `-mieee' or `-ieee' on Alpha and SH.
* libguile/numbers.c (guile_ieee_init): Make sure `-mieee' was passed
when using GCC on Alpha.
* NEWS: Update.
* test-suite/standalone/test-conversion.c (ieee_init): New function.
(guile_Inf, guile_NaN): New variables.
(test_from_double, test_to_double): Use them. Divisions by zero made
`cc' on Tru64 5.1b ("Compaq C V6.5-011") bail out and led to a
floating point exception when compiled with GCC on the same platform.
(main): Call `ieee_init ()'.
* configure.in: Check for the declaration of unsetenv(3), which Tru64
5.1b doesn't have.
* libguile/posix.c: Include <stdlib.h> since that's where POSIX says
unsetenv(3) should reside.
(scm_putenv): Don't attempt to use unsetenv(3) if its declaration
isn't available since that wouldn't work well on Tru64.
* test-suite/standalone/test-conversion.c: Remove extraneous semicolon
following `DEF[SU]TST' invocations since that made Compaq C
V6.5-011 (`cc' on Tru64 5.1b) bail out.
* configure.in (enable_deprecated): Set SCM_WARN_DEPRECATED_DEFAULT
even when --disable-deprecated is passed.
* libguile/deprecation.h: Declare deprecation-issuing methods even
if SCM_ENABLE_DEPRECATED is not set.
* libguile/deprecation.c: Ditto.
(scm_init_deprecation): Include full body even for unset
SCM_ENABLE_DEPRECATED.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
The crux of this problem was that the thread doing a throw, and so
checking scm_i_critical_section_level, was different from the thread
that was in a critical section.
* libguile/async.h (scm_i_critical_section_level): Removed, replaced
by per-thread critical_section_level.
(SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END): Use
per-thread critical_section_level.
* libguile/continuations.c (scm_dynthrow): Check per-thread
critical_section_level.
* libguile/threads.c (guilify_self_1): Init per-thread
critical_section_level.
(scm_i_critical_section_level): Removed.
* libguile/threads.h (scm_i_thread): New critical_section_level field.
* libguile/throw.c (scm_ithrow): Check per-thread critical_section_level.
* libguile/symbols.c (intern_symbol): New function, with code formerly
duplicated in `scm_i_c_mem2symbol ()' and `scm_i_mem2symbol ()'.
(scm_i_c_mem2symbol, scm_i_mem2symbol): Use it.
(scm_take_locale_symboln): Use `intern_symbol ()'. This fixes
bug #25865.
* test-suite/standalone/Makefile.am
(test_scm_take_locale_symbol_SOURCES,
test_scm_take_locale_symbol_CFLAGS,
test_scm_take_locale_symbol_LDADD): New variables.
(check_PROGRAMS, TESTS): Add `test-scm-take-locale-symbol'.
* benchmark-suite/benchmarks/subr.bm (hook1, hook3): New variables.
("subr invocation")("generic subr with rest arg", "generic subr with
rest arg and 3+ parameters"): New benchmarks.
("subr application")("generic subr with rest arg", "generic subr with
rest arg and 3+ parameters"): New benchmarks.
This fixes the following helgrind report.
Thread #1: lock order "0x4114748 before 0x4331084" violated
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x407A55F: deval (eval.c:4077)
by 0x407A071: scm_dapply (eval.c:5012)
by 0x407888A: scm_apply (eval.c:4811)
by 0x407E20C: scm_call_0 (eval.c:4666)
by 0x406BDF7: scm_dynamic_wind (dynwind.c:111)
by 0x407620C: ceval (eval.c:4571)
by 0x407E8D9: scm_primitive_eval_x (eval.c:5921)
by 0x407E934: scm_eval_x (eval.c:5956)
by 0x40B9140: scm_shell (script.c:737)
by 0x4095AC5: invoke_main_func (init.c:367)
by 0x4065A81: c_body (continuations.c:349)
Required order was established by acquisition of lock at 0x4114748
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40B7BE1: scm_sigaction_for_thread (scmsigs.c:339)
by 0x40911DE: scm_gsubr_apply (gsubr.c:223)
by 0x4079E36: scm_dapply (eval.c:4930)
by 0x407AB68: deval (eval.c:4378)
by 0x407A071: scm_dapply (eval.c:5012)
by 0x407888A: scm_apply (eval.c:4811)
by 0x407E1D0: scm_call_1 (eval.c:4672)
by 0x407FEEE: scm_map (eval.c:5489)
by 0x407BDCC: deval (eval.c:4367)
by 0x407D197: deval (eval.c:3698)
by 0x407A071: scm_dapply (eval.c:5012)
followed by a later acquisition of lock at 0x4331084
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40DC397: scm_enter_guile (threads.c:377)
by 0x40DC8F4: scm_pthread_mutex_lock (threads.c:1485)
by 0x4083FAA: scm_gc_for_newcell (gc.c:484)
by 0x40A9781: scm_cons (inline.h:115)
by 0x4079867: scm_dapply (eval.c:4850)
by 0x407888A: scm_apply (eval.c:4811)
by 0x40796D6: scm_call_3 (eval.c:4684)
by 0x409A7C2: module_variable (modules.c:302)
by 0x409A7EE: module_variable (modules.c:312)
by 0x409A962: scm_sym2var (modules.c:466)
by 0x40738F4: scm_lookupcar1 (eval.c:2874)
* libguile/scmsigs.c (close_1): Renamed `handler_to_async'; also
handle #f case and wrapping the async in a cons, if necessary.
(install_handler): Pass in async instead of constructing it; combine
two branches into one.
(scm_sigaction_for_thread): Allocate async upfront instead of inside
the critical section, and pass it to install_handler calls. Leave
critical section before signaling out-of-range error.
This fixes lots of helgrind-reported problems, such as:
Thread #1: lock order "0x4325084 before 0x4108928" violated
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40CFD37: scm_enter_guile (threads.c:377)
by 0x40D0284: scm_pthread_mutex_lock (threads.c:1485)
by 0x405A736: scm_async_click (async.c:155)
by 0x406F9EE: deval (eval.c:4080)
by 0x40761D9: scm_primitive_eval_x (eval.c:5921)
by 0x40AD20E: install_handler (scmsigs.c:113)
by 0x40AD402: scm_sigaction_for_thread (scmsigs.c:394)
by 0x4087D1F: scm_gsubr_apply (gsubr.c:223)
by 0x406DF55: scm_dapply (eval.c:4930)
by 0x407147C: deval (eval.c:4378)
by 0x406E1BD: scm_dapply (eval.c:5012)
Required order was established by acquisition of lock at 0x4325084
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40CFD37: scm_enter_guile (threads.c:377)
by 0x408C58B: scm_i_init_guile (init.c:421)
by 0x40D1873: scm_i_init_thread_for_guile (threads.c:589)
by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:731)
by 0x40D19BD: scm_with_guile (threads.c:720)
by 0x408C42E: scm_boot_guile (init.c:350)
by 0x8048710: main (guile.c:69)
followed by a later acquisition of lock at 0x4108928
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40AFD61: scm_make_smob_type (smob.c:294)
by 0x40AFF19: scm_smob_prehistory (smob.c:512)
by 0x408C595: scm_i_init_guile (init.c:423)
by 0x40D1873: scm_i_init_thread_for_guile (threads.c:589)
by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:731)
by 0x40D19BD: scm_with_guile (threads.c:720)
by 0x408C42E: scm_boot_guile (init.c:350)
by 0x8048710: main (guile.c:69)
* libguile/async.c (scm_async_click): Don't leave Guile mode when
locking async_mutex. We don't need to, because none of the code
that has async_mutex locked can block, and doing so may lead to lock
ordering problems between async_mutex and a thread's heap_mutex.
This fixes the following helgrind report.
Thread #1: lock order "0x4325084 before 0x4105328" violated
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40D01EA: scm_i_thread_put_to_sleep (threads.c:1622)
by 0x4078958: scm_make_fluid (fluids.c:114)
by 0x40778D6: scm_init_feature (feature.c:101)
by 0x408C62E: scm_i_init_guile (init.c:464)
by 0x40D1873: scm_i_init_thread_for_guile (threads.c:583)
by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:725)
by 0x40D19BD: scm_with_guile (threads.c:714)
by 0x408C42E: scm_boot_guile (init.c:350)
by 0x8048710: main (guile.c:69)
Required order was established by acquisition of lock at 0x4325084
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40CFFA4: guilify_self_1 (threads.c:468)
by 0x408C58B: scm_i_init_guile (init.c:421)
by 0x40D1873: scm_i_init_thread_for_guile (threads.c:583)
by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:725)
by 0x40D19BD: scm_with_guile (threads.c:714)
by 0x408C42E: scm_boot_guile (init.c:350)
by 0x8048710: main (guile.c:69)
followed by a later acquisition of lock at 0x4105328
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40CFFAC: guilify_self_1 (threads.c:470)
by 0x408C58B: scm_i_init_guile (init.c:421)
by 0x40D1873: scm_i_init_thread_for_guile (threads.c:583)
by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:725)
by 0x40D19BD: scm_with_guile (threads.c:714)
by 0x408C42E: scm_boot_guile (init.c:350)
by 0x8048710: main (guile.c:69)
* threads.c (guilify_self_1): Add self to global thread list _before_
entering Guile mode.