1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type

* libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void):
  New static functions that simply call scm_lock_mutex and
  scm_unlock_mutex, respectively, but return void instead of SCM.

  (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to
  scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to
  scm_dynwind_rewind_handler_with_scm.  Previously, we passed
  scm_unlock_mutex and scm_lock_mutex (which return SCM), but the
  scm_dynwind_* functions expect pointers to functions which return
  void.  When SCM is of type union, this changes the calling conventions
  of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86).
This commit is contained in:
Mark H Weaver 2011-05-22 15:23:27 -04:00
parent ad4bd7c2c0
commit 2a3db25e28

View file

@ -1456,12 +1456,24 @@ SCM_DEFINE (scm_lock_mutex_timed, "lock-mutex", 1, 2, 0,
}
#undef FUNC_NAME
static void
lock_mutex_return_void (SCM mx)
{
(void) scm_lock_mutex (mx);
}
static void
unlock_mutex_return_void (SCM mx)
{
(void) scm_unlock_mutex (mx);
}
void
scm_dynwind_lock_mutex (SCM mutex)
{
scm_dynwind_unwind_handler_with_scm ((void(*)(SCM))scm_unlock_mutex, mutex,
scm_dynwind_unwind_handler_with_scm (unlock_mutex_return_void, mutex,
SCM_F_WIND_EXPLICITLY);
scm_dynwind_rewind_handler_with_scm ((void(*)(SCM))scm_lock_mutex, mutex,
scm_dynwind_rewind_handler_with_scm (lock_mutex_return_void, mutex,
SCM_F_WIND_EXPLICITLY);
}