tfzxyinhao / gperftools

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

struct mallinfo needs to be defined in tcmalloc.h #450

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The attached patch moves #includes for struct mallinfo from
tcmalloc.cc to tcmalloc.h.

The .h file already had a "#include <stdlib.h> // for struct mallinfo"
line, but that doesn't work for systems where it's not defined in
stdlib.h.

It is important that struct mallinfo is defined in the header file,
otherwise it will cause compiler warnings such as this from Clang:

In file included from src/tcmalloc.cc:90:
./src/gperftools/tcmalloc.h:96:38: warning: 'tc_mallinfo' has
C-linkage specified, but returns user-defined type
      'struct mallinfo' which is incompatible with C [-Wreturn-type-c-linkage]
  PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW;
                                     ^

Original issue reported on code.google.com by h...@chromium.org on 24 Jul 2012 at 4:11

Attachments:

GoogleCodeExporter commented 9 years ago
Ping?

We've applied this in Chromium, but it would be nice to have it applied 
upstream as well to avoid having a diff.

Original comment by h...@chromium.org on 17 Aug 2012 at 9:31

GoogleCodeExporter commented 9 years ago

Original comment by chapp...@gmail.com on 3 Nov 2012 at 4:55

GoogleCodeExporter commented 9 years ago
r180 | chappedm@gmail.com | 2012-11-04 17:53:01 -0500 (Sun, 04 Nov 2012) | 2 
lines

issue-450: Move includes for struct mallinfo from tcmalloc.cc to tcmalloc.h to 
fix compiler warnings from clang.

Original comment by chapp...@gmail.com on 4 Nov 2012 at 10:54