[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Avoid warnings in threads.c when building without threads
From: |
Andy Wingo |
Subject: |
Re: Avoid warnings in threads.c when building without threads |
Date: |
Sat, 23 Jul 2016 22:49:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
On Sat 16 Jul 2016 19:12, Eli Zaretskii <address@hidden> writes:
> The patch to shut up these warnings is below. OK to commit?
>
> --- libguile/null-threads.h~0 2016-01-02 13:32:40.000000000 +0200
> +++ libguile/null-threads.h 2016-07-15 17:47:37.101375000 +0300
> @@ -43,7 +43,7 @@
> #define scm_i_pthread_create(t,a,f,d) (*(t)=0, (void)(f), ENOSYS)
> #define scm_i_pthread_detach(t) do { } while (0)
> #define scm_i_pthread_exit(v) exit (EXIT_SUCCESS)
> -#define scm_i_pthread_cancel(t) 0
> +#define scm_i_pthread_cancel(t) (void)0
> #define scm_i_pthread_cleanup_push(t,v) 0
> #define scm_i_pthread_cleanup_pop(e) 0
> #define scm_i_sched_yield() 0
I think not, sorry :/ pthread_cancel returns an int, so
scm_i_pthread_cancel should always return an int.
> --- libguile/threads.c~ 2016-06-20 23:35:06.000000000 +0300
> +++ libguile/threads.c 2016-07-15 17:48:20.757625000 +0300
> @@ -1058,7 +1058,7 @@ SCM_DEFINE (scm_call_with_new_thread, "c
> }
>
> while (scm_is_false (data.thread))
> - scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
> + (void)scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
>
> scm_i_pthread_mutex_unlock (&data.mutex);
>
Likewise this is not needed -- the problem is in the cond_wait
definition.
null-threads.h is a distressing header file. I think the right thing to
do is to use typedefs and static inline functions instead of CPP macros.
That way we keep type-safety, and also the compiler will stop
complaining.
Andy