[fixed in 4.5] -Wunused-value cannot be suppressed

Bug #475934 reported by Stanislaw Pitucha
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-4.4 (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Some functions that have warn-unused-result cannot be used in a way described in http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Warning-Options.html

For example this line (where STDOUT_FILENO==0 and FLAG_EXIT_NOW is defined as some string):
(void) write(STDOUT_FILENO, FLAG_EXIT_NOW, sizeof FLAG_EXIT_NOW - 1);

compiled with:

cc -g -O -W -Wall -Wno-system-headers -Werror -Wunused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -c ....

will report "error: ignoring return value of ‘write’, declared with attribute warn_unused_result". According to gcc docs, casting to (void) should prevent that.

ProblemType: Bug
Architecture: i386
Date: Thu Nov 5 22:31:44 2009
DistroRelease: Ubuntu 9.10
Package: gcc 4:4.4.1-1ubuntu2
ProcEnviron:
 LANGUAGE=pl_PL.UTF-8
 PATH=(custom, no user)
 LANG=pl_PL.UTF-8
 SHELL=/bin/zsh
ProcVersionSignature: Ubuntu 2.6.31-14.48-generic
SourcePackage: gcc-defaults
Uname: Linux 2.6.31-14-generic i686

Revision history for this message
Stanislaw Pitucha (viraptor-gmail) wrote :
Revision history for this message
Matthias Klose (doko) wrote :

fixed in 4.5 (available as gcc-snapshot in lucid)

affects: gcc-defaults (Ubuntu) → gcc-4.4 (Ubuntu)
Changed in gcc-4.4 (Ubuntu):
importance: Undecided → Low
status: New → Triaged
summary: - -Wunused-value cannot be suppressed
+ [fixed in 4.5] -Wunused-value cannot be suppressed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.