cuitao2046 / gperftools

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

Compillation warnings in 1.6 #264

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here are the warnings that I got when compiled with 4.2.1:
src/base/low_level_alloc.cc:179: warning: 'LowLevelAlloc::Arena' has a field 
'LowLevelAlloc::Arena::freelist' whose type uses the anonymous namespace
src/debugallocation.cc: In function 'void* DebugAllocate(size_t, int)':
src/debugallocation.cc:966: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/debugallocation.cc: In function 'void DebugDeallocate(void*, int)':
src/debugallocation.cc:971: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/debugallocation.cc: In function 'void* realloc(void*, size_t)':
src/debugallocation.cc:1065: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'

Original issue reported on code.google.com by yuriv...@yahoo.com on 7 Aug 2010 at 7:16

GoogleCodeExporter commented 9 years ago
Thanks for the report.  What compile flags are you using?  Easiest to say would 
be to just cut and paste one of the compile lines you see when you run make.

I can fix the debugallocation ones easy enough; I'll do it for next release.  
I'm not sure why gcc is unhappy with the anonymous namespace type; I'll look 
into that.

Original comment by csilv...@gmail.com on 8 Aug 2010 at 2:35

GoogleCodeExporter commented 9 years ago
c++ -DHAVE_CONFIG_H -I. -I. -I./src  -I./src   -DNO_TCMALLOC_SAMPLES  
-D_THREAD_SAFE -pthread -DNDEBUG -Wall -Wwrite-strings -Woverloaded-virtual 
-Wno-sign-compare -fno-omit-frame-pointer   -DTCMALLOC_FOR_DEBUGALLOCATION -O2 
-pipe -fno-strict-aliasing -MT libtcmalloc_minimal_debug_la-debugallocation.lo 
-MD -MP -MF ".deps/libtcmalloc_minimal_debug_la-debugallocation.Tpo" -c -o 
libtcmalloc_minimal_debug_la-debugallocation.lo `test -f 
'src/debugallocation.cc' || echo './'`src/debugallocation.cc;  then mv -f 
".deps/libtcmalloc_minimal_debug_la-debugallocation.Tpo" 
".deps/libtcmalloc_minimal_debug_la-debugallocation.Plo"; else rm -f 
".deps/libtcmalloc_minimal_debug_la-debugallocation.Tpo"; exit 1; fi
 c++ -DHAVE_CONFIG_H -I. -I. -I./src -I./src -DNO_TCMALLOC_SAMPLES -D_THREAD_SAFE -pthread -DNDEBUG -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-omit-frame-pointer -DTCMALLOC_FOR_DEBUGALLOCATION -O2 -pipe -fno-strict-aliasing -MT libtcmalloc_minimal_debug_la-debugallocation.lo -MD -MP -MF .deps/libtcmalloc_minimal_debug_la-debugallocation.Tpo -c src/debugallocation.cc  -fPIC -DPIC -o .libs/libtcmalloc_minimal_debug_la-debugallocation.o
src/debugallocation.cc: In function 'void* DebugAllocate(size_t, int)':
src/debugallocation.cc:966: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/debugallocation.cc: In function 'void DebugDeallocate(void*, int)':
src/debugallocation.cc:971: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/debugallocation.cc: In function 'void* realloc(void*, size_t)':
src/debugallocation.cc:1065: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'

Original comment by yuriv...@yahoo.com on 26 Aug 2010 at 8:19

GoogleCodeExporter commented 9 years ago
What platform are you on?  What operating system, what cpu, etc?  I will use 
this to add to my list of systems where pthread_t is a pointer.

Also, I'm unable to reproduce the warning message you see for 
low_level_alloc.cc, using gcc 4.2.4 on ubuntu x86_64.

Original comment by csilv...@gmail.com on 30 Aug 2010 at 10:10

GoogleCodeExporter commented 9 years ago
FreeBSD-8.1-STABLE. amd64
gcc-4.2.1

Original comment by yuriv...@yahoo.com on 1 Sep 2010 at 7:24

GoogleCodeExporter commented 9 years ago
The previous warning list was for 1.5 (I think, not sure)

Current list for 1.6 is:
src/debugallocation.cc:966: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/debugallocation.cc:971: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/debugallocation.cc:1065: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/base/low_level_alloc.cc:179: warning: 'LowLevelAlloc::Arena' has a field 
'LowLevelAlloc::Arena::freelist' whose type uses the anonymous namespace
src/debugallocation.cc:966: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/debugallocation.cc:971: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/debugallocation.cc:1065: warning: format '%lu' expects type 'long unsigned 
int', but argument 6 has type 'pthread*'
src/base/low_level_alloc.cc:179: warning: 'LowLevelAlloc::Arena' has a field 
'LowLevelAlloc::Arena::freelist' whose type uses the anonymous namespace

Original comment by yuriv...@yahoo.com on 1 Sep 2010 at 7:49

GoogleCodeExporter commented 9 years ago
OK, I think I have a fix for the debugallocation warnings.  Can you try 
replacing this line in src/base/basictypes.h:
   #if defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__APPLE__) 
with this:
   #if defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__APPLE__) || defined(__FreeBSD__)

If that works, I'll make it part of the next release.

The low_level_alloc use is actually safe, but it's simple enough to quiet the 
warning (I think), so I'll do that.

Original comment by csilv...@gmail.com on 2 Sep 2010 at 12:04

GoogleCodeExporter commented 9 years ago
This should be fixed in perftools 1.7, just released.

Original comment by csilv...@gmail.com on 5 Feb 2011 at 12:21