[imapfilter-devel] Compiler Warnings

Michael Skibbe mskibbe at suse.de
Fri Aug 4 09:07:35 EEST 2006


On Wednesday 02 August 2006 19:36, Lefteris Chatzibarbas wrote:
> Michael Skibbe wrote:
> > Hi,
> > 
> > i see that rsnapshot has some little compiler warnings.
> > i fixed these problems and create a patch. What do you say about this?
> 
> Hello Michael,
> 
> (Didn't quite get the part about rsnapshot...)

oh sorry i'm confusing me self. i write this mail to the rsnapshot maillinglist, too and see later that it was a imapfilter patch. i'm maintainer of both and fixed compiler warnings same time in both programms.

> Could you please send me the compiler warnings?

here is a part of my log:

snip:
cert.c: In function 'write_cert':
cert.c:170: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result
cert.c: In function 'mismatch_cert':
cert.c:217: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result
snap:

snip:
system.c: In function 'ifsys_write':
system.c:214: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
system.c: In function 'ifsys_daemon':
system.c:286: warning: ignoring return value of 'dup', declared with attribute warn_unused_result
system.c:287: warning: ignoring return value of 'dup', declared with attribute warn_unused_result
snap:
 
> Also, could you explain to me, why is this pointer thing necessary with
> fgets(), fwrite(), dup(), etc.?

the man page of fgets say:
[...]
int fgetc(FILE *stream)
[...]

fgets has an integer return value. if you do not cache this return the gcc gives you a warning: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result

build your program with -W -Wall -O2 and you see this warnings, too.
cc -O2 -march=i586 -mtune=i686 -fmessage-length=0 -W -Wall -D_FORTIFY_SOURCE=2 -DMAKEFILE_SHAREDIR='"/usr/share/imapfilter"' -I/usr/local/include   -c -o core.o core.c
 
> Greetings,
> Lefteris
Greetings
Michael


-- 
----------------------------
| Michael Skibbe           |
| Core Services            |
| SUSE Linux Products GmbH |
----------------------------




More information about the Imapfilter-devel mailing list