From f7748ed531007153407efb62bc54ed42fa109a72 Mon Sep 17 00:00:00 2001 From: Ashwin Agrawal Date: Tue, 26 Sep 2017 11:21:03 -0700 Subject: [PATCH] Fix compiler warnings for ext_alloc.c. After commit 1822c8269fb2f12efa29a35d1e57b3ff6ab28bea started seeing bunch of warnings like ------------------------------------------- memaccounting.c:247:1: warning: no previous prototype for function 'MemoryAccounting_DeclareDone' [-Wmissing-prototypes] MemoryAccounting_DeclareDone() ^ ../../../../src/include/utils/memaccounting.h:238:1: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function MemoryAccounting_DeclareDone(); ^ void memaccounting.c:263:1: warning: no previous prototype for function 'MemoryAccounting_RequestQuotaIncrease' [-Wmissing-prototypes] MemoryAccounting_RequestQuotaIncrease() ^ ../../../../src/include/utils/memaccounting.h:241:1: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function MemoryAccounting_RequestQuotaIncrease(); ^ void 2 warnings generated. ext_alloc.c:35:1: warning: no previous prototype for function 'Ext_OptimizerAlloc' [-Wmissing-prototypes] Ext_OptimizerAlloc(size_t size) ^ ext_alloc.c:50:17: warning: unused variable 'account' [-Wunused-variable] MemoryAccount *account = MemoryAccounting_ConvertIdToAccount(ActiveMemoryAccountId); ^ ext_alloc.c:48:1: warning: no previous prototype for function 'Ext_OptimizerFree' [-Wmissing-prototypes] Ext_OptimizerFree(void *ptr) ^ ext_alloc.c:59:1: warning: no previous prototype for function 'GetOptimizerOutstandingMemoryBalance' [-Wmissing-prototypes] GetOptimizerOutstandingMemoryBalance() ^ ------------------------------------------- --- src/backend/utils/mmgr/ext_alloc.c | 2 +- src/include/utils/ext_alloc.h | 2 +- src/include/utils/memaccounting.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/utils/mmgr/ext_alloc.c b/src/backend/utils/mmgr/ext_alloc.c index 31d1be86bc..dc8876843e 100644 --- a/src/backend/utils/mmgr/ext_alloc.c +++ b/src/backend/utils/mmgr/ext_alloc.c @@ -15,6 +15,7 @@ #include "utils/gp_alloc.h" #include "utils/memaccounting.h" #include "utils/memaccounting_private.h" +#include "utils/ext_alloc.h" /* * This variable is used to track memory that is not freed by Orca during a @@ -47,7 +48,6 @@ Ext_OptimizerAlloc(size_t size) void Ext_OptimizerFree(void *ptr) { - MemoryAccount *account = MemoryAccounting_ConvertIdToAccount(ActiveMemoryAccountId); void *malloc_pointer = UserPtr_GetVmemPtr(ptr); size_t freed_size = VmemPtr_GetUserPtrSize((VmemHeader*) malloc_pointer); MemoryAccounting_Free(ActiveMemoryAccountId, freed_size); diff --git a/src/include/utils/ext_alloc.h b/src/include/utils/ext_alloc.h index 2ec4c97c1f..1b1bdcceec 100644 --- a/src/include/utils/ext_alloc.h +++ b/src/include/utils/ext_alloc.h @@ -24,7 +24,7 @@ extern void* Ext_OptimizerAlloc(size_t size); extern uint64 -GetOptimizerOutstandingMemoryBalance(); +GetOptimizerOutstandingMemoryBalance(void); #ifdef __cplusplus diff --git a/src/include/utils/memaccounting.h b/src/include/utils/memaccounting.h index fc93769e30..bb27c848e1 100644 --- a/src/include/utils/memaccounting.h +++ b/src/include/utils/memaccounting.h @@ -235,10 +235,10 @@ extern void MemoryAccounting_PrettyPrint(void); extern uint64 -MemoryAccounting_DeclareDone(); +MemoryAccounting_DeclareDone(void); extern uint64 -MemoryAccounting_RequestQuotaIncrease(); +MemoryAccounting_RequestQuotaIncrease(void); extern void MemoryAccounting_ExplainAppendCurrentOptimizerAccountInfo(StringInfoData *str); -- GitLab