unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: guile-devel@gnu.org
Subject: Re: Avoid warnings in threads.c when building without threads
Date: Sun, 24 Jul 2016 15:32:33 +0200	[thread overview]
Message-ID: <87vazvqhzi.fsf@pobox.com> (raw)
In-Reply-To: <8337mzvjzq.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 24 Jul 2016 05:38:01 +0300")

On Sun 24 Jul 2016 04:38, Eli Zaretskii <eliz@gnu.org> writes:

>> > --- 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.
>
> Then code which ignores the value should cast to void.

That way leads to madness :) There are many function call sites in Guile
that ignore the function return values.  GCC does not warn about them,
and rightly so.  The problem here is that the "null" definition of
scm_i_pthread_cancel is a bare expression and for some reason GCC is
treating this case differently.  The solution AFAIU is to make the null
definition of scm_i_pthread_cancel into a function so that it is more
like the proper definition.  That way not only will GCC not warn, but it
will also do type checking for us.

Applied a fix along these lines; a --without-threads configuration
builds without warnings and passes all tests for me now.

Andy



      reply	other threads:[~2016-07-24 13:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-16 17:12 Avoid warnings in threads.c when building without threads Eli Zaretskii
2016-07-22  7:16 ` Eli Zaretskii
2016-07-23 20:49 ` Andy Wingo
2016-07-24  2:38   ` Eli Zaretskii
2016-07-24 13:32     ` Andy Wingo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vazvqhzi.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=eliz@gnu.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).