[imapfilter-devel] Compiler Warnings

Michael Skibbe mskibbe at suse.de
Fri Aug 4 09:16:21 EEST 2006


On Thursday 03 August 2006 21:33, David DeSimone wrote:
> Michael Skibbe <mskibbe at suse.de> wrote:
> >
> > i see that rsnapshot has some little compiler warnings.
> > i fixed these problems and create a patch. What do you say about this?
> 
> These changes seem a bit dubious.  What are you trying to fix?

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:

[...]

> In all of the above cases, you should be able to avoid your compiler
> warnings, not by capturing and freeing the return value, but instead by
> casting the return value to (void).  

that's an good idea.

> In all cases above, the intent is 
> to use the side-effect of the function, so ignoring the return value is
> reasonable and valid.  

No.
this warnings are not critical but some system do not like these small problems.

> Although of course, better error checking would be nice...

Yes see above. I test it and i get errors then i fix it. but your suggestion to cast the return variables to void is better than my idea.

MFG
Michael

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




More information about the Imapfilter-devel mailing list