unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Stanislav Ievlev <inger@altlinux.org>
Cc: guile-devel@gnu.org, ldv@altlinux.org
Subject: Re: guile-1.8.1 - problems on AMD64
Date: Mon, 16 Oct 2006 10:25:40 +0400	[thread overview]
Message-ID: <20061016062540.GE17598@basalt.office.altlinux.org> (raw)
In-Reply-To: <87vemnca65.fsf@ossau.uklinux.net>

On Sat, Oct 14, 2006 at 02:13:38PM +0100, Neil Jerram wrote:
> ludovic.courtes@laas.fr (Ludovic Court?s) writes:
> 
> > As for this:
> >
> >   async.c: In function 'scm_i_queue_async_cell':
> >   async.c:250: warning: ignoring return value of 'write', declared with attribute warn_unused_result
> >
> > I don't really understand what this code does, but I have the feeling
> > that line 250 could be rewritten this way:
> >
> >   SCM_SYSCALL ((void)write (sleep_fd, &dummy, 1));
> >
> > Can somebody familiar with this comment?
> 
> Agreed.  Stanislav, can you try this and confirm whether it removes
> the warning you are getting?

New compiller is a too smart for it ;)
--
$ make
...
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -pthread -pipe -Wall -O2
 -march=i686 -mtune=pentium4 -Wall -Wmissing-prototypes -Werror -c async.c
 -fPIC -DPIC -o .libs/libguile_la-async.o
 cc1: warnings being treated as errors
 async.c: In function 'scm_i_queue_async_cell':
 async.c:250: warning: ignoring return value of 'write', declared with
 attribute warn_unused_result
 make[1]: *** [libguile_la-async.lo] Ошибка 1
 make[1]: Leaving directory `/mnt/archive/RPM/BUILD/guile-1.8.1/libguile'
 make: *** [all] Ошибка 2

$ grep SCM_SYSCALL async.c
       SCM_SYSCALL((void)write (sleep_fd, &dummy, 1));
-- 

I think, you will have to create an explicit tests:
--
$ gcc-4.1  -O1  l.c 
l.c: In function 'main':
l.c:6: warning: ignoring return value of 'write', declared with attribute
warn_unused_result
$ cat l.c 
#include <unistd.h>

int main()
{
     char c;
     (void)write(1,&c,1);
     return 0;
}
			

$ gcc-4.1  -O1  l0.c 
$ cat l0.c 
#include <unistd.h>

int main()
{
       char c;
       if(write(1,&c,1));
       return 0;
}

$ gcc-4.1  -O1  l1.c 
$ cat l1.c 
#include <unistd.h>

void ignore(int retcode)
{
}

int main()
{
        char c;
        ignore(write(1,&c,1));
        return 0;
}
			

The best solution is to create a simple wrapper like this:
--
$ gcc -O1 l2.c 
[stas@stas zzz]$ cat l2.c 
#include <stdlib.h>
#include <unistd.h>

#include <error.h>
#include <errno.h>

#define CHECK_OR_IGNORE(x) if (x) error(EXIT_FAILURE,errno,#x)

int main()
{
        char c;
        CHECK_OR_IGNORE(write(1,&c,1));
        return 0;
}
			

--

--
With best regards
Stanislav Ievlev;



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2006-10-16  6:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-10  6:34 guile-1.8.1 - problems on AMD64 Stanislav Ievlev
2006-10-10  8:23 ` Ludovic Courtès
2006-10-11 11:01   ` Stanislav Ievlev
2006-10-11 20:08     ` Kevin Ryde
2006-10-12 12:58     ` Ludovic Courtès
2006-10-13  6:26       ` Stanislav Ievlev
2006-10-13  7:38         ` Ludovic Courtès
2006-10-14 13:13           ` Neil Jerram
2006-10-16  6:25             ` Stanislav Ievlev [this message]
2006-10-16  8:04               ` Ludovic Courtès
2006-10-19 18:46                 ` Neil Jerram
2006-10-21 13:12                   ` Ludovic Courtès

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=20061016062540.GE17598@basalt.office.altlinux.org \
    --to=inger@altlinux.org \
    --cc=guile-devel@gnu.org \
    --cc=ldv@altlinux.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).