guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile-1.8.1 - problems on AMD64


From: Stanislav Ievlev
Subject: Re: guile-1.8.1 - problems on AMD64
Date: Mon, 16 Oct 2006 10:25:40 +0400

On Sat, Oct 14, 2006 at 02:13:38PM +0100, Neil Jerram wrote:
> address@hidden (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 
address@hidden 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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]