Issue Details (XML | Word | Printable)

Key: PCC-40
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Henry Gebhardt
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

pcc doesn't compile due to warn_unused_result after gcc-4.3.3 upgrade

Created: 22/Feb/09 02:06 PM   Updated: 08/Aug/09 10:30 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. Text File pcc-warn_unused_result.patch (2 kB)

Environment: gcc-4.3.3 on linux x86

 Description  « Hide
Hi, I recently upgraded gcc from 4.3.2 to 4.3.3, and now pcc no longer compiles due to 'warn_unused_result' treated as errors. The attached patch fixes it, although I am not sure if that is the right approach.

Also, there is another 'warn_unused_result' not treated as error at the very end here (not fixed by patch):
$ make
cd cc && make all
make[1]: Entering directory `/home/hsgg/pcc.git-cvs/cc'
cd cc; make all -w
make[2]: Entering directory `/home/hsgg/pcc.git-cvs/cc/cc'
gcc -DLIBEXECDIR=\"/usr/local/libexec/\" -DINCLUDEDIR=\"/usr/local/include/\" -DPCCINCDIR=\"/usr/local/lib/pcc/i686-pc-linux-gnu/0.9.9/include/\" -DPCCLIBDIR=\"/usr/local/lib/pcc/i686-pc-linux-gnu/0.9.9/lib/\" -Dos_linux -DTARGMACH=i386 -Dmach_i386 -I../.. -I../../os/linux -I../../mip -I../../arch/i386 -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -c cc.c
gcc -DLIBEXECDIR=\"/usr/local/libexec/\" -DINCLUDEDIR=\"/usr/local/include/\" -DPCCINCDIR=\"/usr/local/lib/pcc/i686-pc-linux-gnu/0.9.9/include/\" -DPCCLIBDIR=\"/usr/local/lib/pcc/i686-pc-linux-gnu/0.9.9/lib/\" -Dos_linux -DTARGMACH=i386 -Dmach_i386 -I../.. -I../../os/linux -I../../mip -I../../arch/i386 -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -c -o compat.o ../../mip/compat.c
gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror cc.o compat.o -o pcc
make[2]: Leaving directory `/home/hsgg/pcc.git-cvs/cc/cc'
cd cpp; make all -w
make[2]: Entering directory `/home/hsgg/pcc.git-cvs/cc/cpp'
bison -y -d cpy.y
gcc -DCPP_DEBUG -I. -I../.. -I. -I../../mip -I../../arch/i386 -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -c -o cpy.o
gcc -DCPP_DEBUG -I. -I../.. -I. -I../../mip -I../../arch/i386 -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -c cpp.c
flex scanner.l
gcc -DCPP_DEBUG -I. -I../.. -I. -I../../mip -I../../arch/i386 -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -c -o scanner.o lex.yy.c
gcc -DCPP_DEBUG -I. -I../.. -I. -I../../mip -I../../arch/i386 -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -c -o compat.o ../../mip/compat.c
gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror cpp.o cpy.o scanner.o compat.o -o cpp
make[2]: Leaving directory `/home/hsgg/pcc.git-cvs/cc/cpp'
cd ccom; make all -w
make[2]: Entering directory `/home/hsgg/pcc.git-cvs/cc/ccom'
gcc -DGCC_COMPAT -DPCC_DEBUG -Dos_linux -Dmach_i386 -D_ISOC99_SOURCE -I. -I. -I../.. -I../../mip -I../../arch/i386 -I../../os/linux -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -DMKEXT -o mkext \
../../mip/mkext.c ../../arch/i386/table.c ../../mip/common.c
rm -f mkext.o table.o common.o
gcc -DGCC_COMPAT -DPCC_DEBUG -Dos_linux -Dmach_i386 -D_ISOC99_SOURCE -I. -I. -I../.. -I../../mip -I../../arch/i386 -I../../os/linux -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -c -o optim.o optim.c
bison -y -d cgram.y
conflicts: 2 shift/reduce
mv cgram.c
mv cgram.h
gcc -DGCC_COMPAT -DPCC_DEBUG -Dos_linux -Dmach_i386 -D_ISOC99_SOURCE -I. -I. -I../.. -I../../mip -I../../arch/i386 -I../../os/linux -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Werror -c -o pftn.o pftn.c
flex scan.l
mv lex.yy.c scan.c
gcc -DGCC_COMPAT -DPCC_DEBUG -Dos_linux -Dmach_i386 -D_ISOC99_SOURCE -I. -I. -I../.. -I../../mip -I../../arch/i386 -I../../os/linux -g -O2 -c -o scan.o scan.c
lex.yy.c: In function 'yylex':
scan.l:219: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result trees.c
(...continues compiling...)


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 22/Feb/09 04:39 PM
Your fixes are the only way to fix it AFAIK, I'll apply them later.
The warning from scan.l is in code generated by flex, which means that flex on your machine generate code that gcc may fail to compile.

Henry Gebhardt added a comment - 22/Feb/09 07:18 PM
Indeed, the last one is a flex bug, reported in June 2008, link is here for reference:

Since scan.c isn't compiled with -Werror, pcc actually compiles quite well without fixing flex, no action required for now.


Anders Magnusson added a comment - 08/Aug/09 10:30 AM
-Werror is now removed.