[Bug c/29480] Feature request - Addition to FORTIFY_SOURCE feature

2006-10-15 Thread robert at linuxfromscratch dot org


--- Comment #2 from robert at linuxfromscratch dot org  2006-10-15 19:41 
---
echo '#include 
int main () {
chdir( "/" );
}' > example.c

$ gcc -o example example.c -D_FORTIFY_SOURCE -O2
example.c: In function 'main':
example.c:5: warning: ignoring return value of 'chdir', declared with attribute
warn_unused_result

echo '#include 
#include 
int main () {
assert (chdir( "/" ));
}' > example2.c

$ gcc -o example2 example2.c -D_FORTIFY_SOURCE -O2

With assert(3) there's no warning.

These warnings usually affect fwrite(), dup(), chdir(), fchown(), fgets(),
write(), mktemp(), mkstemp(), and mkdtemp(). The results of these are usually
checked later by other functions, but FORTIFY_SOURCE does not know that and
complains.

To silence the warning we could either add more logic to FORTIFY_SOURCE to
follow functions, checking if their returns go unused in the completed code, or
add assert(3).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29480



[Bug c/32185] New: unused result warnings and -werror

2007-06-01 Thread robert at linuxfromscratch dot org
When building GCC with -D_FORTIFY_SOURCE we get some warnings which will cause
--enable-werror builds to die. I'm attaching a small patch.


-- 
   Summary: unused result warnings and -werror
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: robert at linuxfromscratch dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32185



[Bug c/32185] unused result warnings and -werror

2007-06-01 Thread robert at linuxfromscratch dot org


--- Comment #1 from robert at linuxfromscratch dot org  2007-06-02 03:14 
---
Created an attachment (id=13651)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13651&action=view)
Patch for fwrite() and getcwd() unused result warnings


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32185



[Bug other/32185] unused result warnings and -werror

2007-06-02 Thread robert at linuxfromscratch dot org


--- Comment #3 from robert at linuxfromscratch dot org  2007-06-03 00:50 
---
I checked whether it was fixed in trunk, but you're right I should have made a
patch that applies to trunk. Glibc is giving a false positive here, but the
programmer and compiler are the only ones able to know. Could the check in the
code be moved futher up so the compiler can see that the checking is being
done?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32185