Re: 64bit debug compiler flag issue

Brian Paul <[email protected]>
Newsgroups gmane.comp.graphics.chromium.user
Message-ID <[email protected]>
Daniel E. Shipton wrote:
> When using -Werror for 64bit builds(default for Linux) you come across a 
> compile failure in printspu_init with gcc 4.1.1:
> 
> Compiling printspu_init.c
> cc1: warnings being treated as errors
> printspu_init.c: In function 'printspu_signal_handler':
> printspu_init.c:47: warning: field precision should have type 'int', but 
> argument 3 has type 'long int'
> gmake[3]: *** [../../built/printspu/Linux/printspu_init.o] Error 1
> 
> on this lines 47 and 84:
>        fprintf(print_spu.fp, "%.*s", endOfVariable - nextVariable + 1, 
> nextVariable);
> 
> This warning (turned error) can be avoided by casting the result of the 
> 3rd arg to an int. fprintf expects you to give it an int if specifying 
> how much to print.  endofVariable and nextVariable are both char* which 
> makes the whole expression return a long int.
>        fprintf(print_spu.fp, "%.*s", (int)(endOfVariable - nextVariable 
> + 1), nextVariable);

I've added the casts in CVS.  Thanks!

-Brian

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.