git-hulk / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

missing stdlib header include #354

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From 1.8:

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I. -I./src -I./src -Wall 
-Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc 
-fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree 
-fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc 
-fno-builtin-pvalloc -Wno-unused-result -DNO_FRAME_POINTER -O2 -g -pipe -Wall 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-DTCMALLOC_LARGE_PAGES -c src/base/elf_mem_image.cc  -fPIC -DPIC -o 
.libs/elf_mem_image.o
src/base/elf_mem_image.cc: In member function ‘void 
base::ElfMemImage::Init(const void*)’:
src/base/elf_mem_image.cc:237:28: warning: comparison between signed and 
unsigned integer expressions [-Wsign-compare]
src/base/elf_mem_image.cc:246:22: warning: comparison between signed and 
unsigned integer expressions [-Wsign-compare]
src/base/elf_mem_image.cc:247:23: warning: comparison between signed and 
unsigned integer expressions [-Wsign-compare]
src/base/elf_mem_image.cc:253:3: error: ‘ptrdiff_t’ was not declared in 
this scope
src/base/elf_mem_image.cc:253:3: note: suggested alternatives:
/usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/x86_64-redh
at-linux/bits/c++config.h:1737:20: note:   ‘std::ptrdiff_t’
/usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../include/c++/4.6.0/x86_64-redh
at-linux/bits/c++config.h:1737:20: note:   ‘std::ptrdiff_t’
src/base/elf_mem_image.cc:253:13: error: expected ‘;’ before 
‘relocation’
src/base/elf_mem_image.cc:257:37: error: ‘relocation’ was not declared in 
this scope

Obvious fix: #include <stddef.h>

Original issue reported on code.google.com by spo...@gmail.com on 18 Jul 2011 at 4:59

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the report.  We'll fix this for the next release.

Out of curiousity, what OS and compiler (what version of gcc?) were you using?

Original comment by csilv...@gmail.com on 18 Jul 2011 at 9:20

GoogleCodeExporter commented 9 years ago
Fedora 15, gcc 4.7.0 ( I think)

Original comment by spo...@gmail.com on 18 Jul 2011 at 9:36

GoogleCodeExporter commented 9 years ago
All gcc versions 4.x experience this.  And I agree with the reported that 
including stddef.h fixes the problem.  Here's the patch that I use to build for 
openSUSE.

<cut>
Index: google-perftools-1.8/src/base/elf_mem_image.h
===================================================================
--- google-perftools-1.8.orig/src/base/elf_mem_image.h
+++ google-perftools-1.8/src/base/elf_mem_image.h
@@ -46,6 +46,7 @@

 #define HAVE_ELF_MEM_IMAGE 1

+#include <stddef.h>
 #include <stdlib.h>
 #include <link.h>  // for ElfW
</cut>

Original comment by craig.e....@gmail.com on 19 Jul 2011 at 5:26

GoogleCodeExporter commented 9 years ago
Hmm, I compiled under quite a few gcc 4.x's and didn't see the problem.  I've 
been told that stddef.h is provided through fewer standard headers in 
relatively new gcc's, so maybe that explains it.  In any case, we'll fix it for 
next time.

Original comment by csilv...@gmail.com on 19 Jul 2011 at 9:20

GoogleCodeExporter commented 9 years ago
Issue 356 has been merged into this issue.

Original comment by csilv...@gmail.com on 25 Jul 2011 at 9:11

GoogleCodeExporter commented 9 years ago
Issue 357 has been merged into this issue.

Original comment by csilv...@gmail.com on 27 Jul 2011 at 3:50

GoogleCodeExporter commented 9 years ago
A lot of people have been seeing this, so I've released perftools 1.8.1 that 
fixes just this problem.

Original comment by csilv...@gmail.com on 27 Jul 2011 at 4:16