New issue
Advanced search Search tips

Issue 625303 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Should be getting a compile failure in tcmalloc, but aren't

Project Member Reported by dpranke@chromium.org, Jul 1 2016

Issue description

https://cs.chromium.org/chromium/src/third_party/tcmalloc/chromium/src/symbolize.cc?rcl=0&l=229

is:

   write(child_in[1], pprof_buffer, strlen(pprof_buffer));

write() returns a value, and yet if you compile it without the -Wno-unused-result flag (i.e., so that we should be warning), we don't get a warning on desktop linux.

We do on CrOS with their clang version, which is how we noticed this.

in the <unistd.h> in the debian wheezy sysroot, the function is defined as 

extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur;

and it seems like the __wur is not defined (or, at least, expanding to nothing).

This seems like a bug?
 
Cc: thestig@chromium.org
If you look at where __wur comes from ( build/linux/debian_wheezy_i386-sysroot/usr/include/i386-linux-gnu/sys/cdefs.h):


/* If fortification mode, we warn about unused results of certain
   function calls which can lead to problems.  */
#if __GNUC_PREREQ (3,4)
# define __attribute_warn_unused_result__ \
   __attribute__ ((__warn_unused_result__))
# if __USE_FORTIFY_LEVEL > 0
#  define __wur __attribute_warn_unused_result__
# endif
#else
# define __attribute_warn_unused_result__ /* empty */
#endif
#ifndef __wur
# define __wur /* Ignore */
#endif

So I guess __USE_FORTIFY_LEVEL isn't > 0 for us. (...which might be bug 414824)
Ah, thanks. I failed to figure out where __wur was coming from, but I didn't try very hard.

Sign in to add a comment