Bill Allombert on Mon, 07 Sep 2009 22:28:27 +0200


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

Re: gcc warnings


On Mon, Sep 07, 2009 at 03:26:14PM +0200, Jeroen Demeyer wrote:
> Hello list,
>
> this is a list of warnings which gcc 4.4.1 gives when compiling pari.  I  

Thanks, I did not get theses ones yet.

> think the warning about system() is not a big deal, but in my opinion  
> the others should (and easily can) be dealt with.
>
> ../src/gp/gp.c: In function 'system0':
> ../src/gp/gp.c:1712: warning: ignoring return value of 'system',  
> declared with attribute warn_unused_result

This one is dubious.

> ../src/gp/gp_rl.c: In function 'print_escape_string':
> ../src/gp/gp_rl.c:824: warning: format not a string literal and no  
> format arguments

This is clearly a bug, we should use puts instead of printf

> ../src/modules/galois.c: In function 'read_obj':
> ../src/modules/galois.c:328: warning: ignoring return value of 'fread',  
> declared with attribute warn_unused_result
> ../src/modules/galois.c: In function 'lirecoset':
> ../src/modules/galois.c:344: warning: ignoring return value of 'fread',  
> declared with attribute warn_unused_result
> ../src/modules/galois.c:345: warning: ignoring return value of 'fread',  
> declared with attribute warn_unused_result
> ../src/modules/galois.c:346: warning: ignoring return value of 'fread',  
> declared with attribute warn_unused_result
> ../src/modules/galois.c: In function 'lireresolv':
> ../src/modules/galois.c:357: warning: ignoring return value of 'fread',  
> declared with attribute warn_unused_result
> ../src/modules/galois.c:358: warning: ignoring return value of 'fread',  
> declared with attribute warn_unused_result

The real bug here is the use of fread instead of a more highlevel
functions.

Cheers,
Bill.