From 689752dc38345cbd14c6fdfa63cbfe3960181458 Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Mon, 29 Jan 2024 20:54:47 -0500 Subject: [PATCH] generate vsprojects/gperftools/tcmalloc.h from our main tcmalloc.h This will save me from risk of forgetting to update this file manually when bumping package version. --- configure.ac | 5 ++++- src/gperftools/tcmalloc.h.in | 5 +++++ vsprojects/gperftools/tcmalloc.h | 18 +++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c6a0493..c25e918 100644 --- a/configure.ac +++ b/configure.ac @@ -649,6 +649,9 @@ AS_IF([test "x$enable_aggressive_decommit_by_default" = xyes], [enable aggressive decommit by default])]) # Write generated configuration file +# NOTE: vsprojects/gperftools/tcmalloc.h is checked in AC_CONFIG_FILES([Makefile - src/gperftools/tcmalloc.h]) + src/gperftools/tcmalloc.h + vsprojects/gperftools/tcmalloc.h:src/gperftools/tcmalloc.h.in + ]) AC_OUTPUT diff --git a/src/gperftools/tcmalloc.h.in b/src/gperftools/tcmalloc.h.in index c0a0b0b..eca04ab 100644 --- a/src/gperftools/tcmalloc.h.in +++ b/src/gperftools/tcmalloc.h.in @@ -47,10 +47,12 @@ #define TC_VERSION_PATCH "@TC_VERSION_PATCH@" #define TC_VERSION_STRING "gperftools @TC_VERSION_MAJOR@.@TC_VERSION_MINOR@@TC_VERSION_PATCH@" +#ifndef _WIN32 /* For struct mallinfo, if it's defined. */ #if @ac_cv_have_struct_mallinfo@ || @ac_cv_have_struct_mallinfo2@ # include #endif +#endif #ifndef PERFTOOLS_NOTHROW @@ -108,11 +110,14 @@ extern "C" { PERFTOOLS_DLL_DECL void tc_malloc_stats(void) PERFTOOLS_NOTHROW; PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) PERFTOOLS_NOTHROW; + +#ifndef _WIN32 #if @ac_cv_have_struct_mallinfo@ PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) PERFTOOLS_NOTHROW; #endif #if @ac_cv_have_struct_mallinfo2@ PERFTOOLS_DLL_DECL struct mallinfo2 tc_mallinfo2(void) PERFTOOLS_NOTHROW; +#endif #endif /* diff --git a/vsprojects/gperftools/tcmalloc.h b/vsprojects/gperftools/tcmalloc.h index 5cc224b..9cdd0df 100644 --- a/vsprojects/gperftools/tcmalloc.h +++ b/vsprojects/gperftools/tcmalloc.h @@ -1,4 +1,4 @@ -// -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*- +/* -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* Copyright (c) 2003, Google Inc. * All rights reserved. * @@ -47,6 +47,13 @@ #define TC_VERSION_PATCH "" #define TC_VERSION_STRING "gperftools 2.15" +#ifndef _WIN32 +/* For struct mallinfo, if it's defined. */ +#if 1 || 1 +# include +#endif +#endif + #ifndef PERFTOOLS_NOTHROW #ifdef __cplusplus @@ -104,6 +111,15 @@ extern "C" { PERFTOOLS_DLL_DECL void tc_malloc_stats(void) PERFTOOLS_NOTHROW; PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) PERFTOOLS_NOTHROW; +#ifndef _WIN32 +#if 1 + PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) PERFTOOLS_NOTHROW; +#endif +#if 1 + PERFTOOLS_DLL_DECL struct mallinfo2 tc_mallinfo2(void) PERFTOOLS_NOTHROW; +#endif +#endif + /* * This is an alias for MallocExtension::instance()->GetAllocatedSize(). * It is equivalent to