Subject: Re: bug#30106: Loading file /sources/emacs/lisp/emacs-lisp/ert.elc failed to provide feature `mod-test'

From: Philipp Stephani <[email-masked]>
Date: Wed, 17 Jan 2018 22:16:58 +0000

Glenn Morris <[email-masked]> schrieb am Mi., 17. Jan. 2018 um 21:31 Uhr:

> Eli Zaretskii wrote:
>
> >> Same error on rhel 7.4 if configure with --without-threads
> --with-modules.
> >>
> >>   Emacs module assertion: Module function called from outside the
> current
> >>   Lisp thread
> >
> > Does this go away if you put
> >
> >   return true;
> >
> > at the end of in_current_thread, outside of all the #ifdef's?
>
> No.
>
>
>
>
>
The current implementation of in_current_thread is definitely bogus if
threads are disabled; I can't even compile temacs with --without-threads
--with-modules:

*emacs-module.c:814:42: **error: **incompatible integer to pointer
conversion passing 'sys_thread_t' (aka 'int') to parameter of type
'pthread_t _Nullable'*

*      (aka 'struct _opaque_pthread_t *') [-Werror,-Wint-conversion]*

  return pthread_equal (pthread_self (), current_thread->thread_id);

*                                         ^~~~~~~~~~~~~~~~~~~~~~~~~*

*/usr/include/pthread.h:340:59: note: *passing argument to parameter here

int pthread_equal(pthread_t _Nullable, pthread_t _Nullable);

because if threads are disabled, the thread ID is an int.

The function also doesn't handle the case where neither HAVE_PTHREAD nor
WINDOWSNT are defined (but maybe we don't have such platforms).

Maybe systhread.h should have a function

extern sys_thread_t sys_thread_self ();

so emacs-module.c doesn't have to care about the threading implementations.