On Sun, Aug 30, 2009 at 3:57 PM, Grzegorz Jaskiewicz<g...@pointblue.com.pl> wrote: > > On 30 Aug 2009, at 15:46, Greg Stark wrote: > >> So three of the four dead initialization warnings are legitimate -- if >> minor -- errors. Attached is a patch to remove the redundant >> initializations. > > > well, all I can do is this: http://llvm.org/bugs/show_bug.cgi?id=4832 > > I find it hard to belive tho, that it only found 4 possible positives ;)
You might try something like the attached. -- greg http://mit.edu/~gsstark/resume.pdf
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 4939046..de011fe 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -23,6 +23,11 @@ #include "utils/memutils.h" +#undef MemoryContextAlloc +#undef MemoryContextAllocZero +#undef MemoryContextAllocZeroAligned +#undef repalloc + /***************************************************************************** * GLOBAL MEMORY * diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index e504ffa..d6ac006 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -49,6 +49,10 @@ extern void *MemoryContextAlloc(MemoryContext context, Size size); extern void *MemoryContextAllocZero(MemoryContext context, Size size); extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size); +#define MemoryContextAlloc(c,s) (MemoryContextAlloc((c),(s))?:(exit(1),NULL)) +#define MemoryContextAllocZero(c,s) (MemoryContextAlloc((c),(s))?:(exit(1),NULL)) +#define MemoryContextAllocZeroAligned(c,s) (MemoryContextAlloc((c),(s))?:(exit(1),NULL)) + #define palloc(sz) MemoryContextAlloc(CurrentMemoryContext, (sz)) #define palloc0(sz) MemoryContextAllocZero(CurrentMemoryContext, (sz)) @@ -70,6 +74,8 @@ extern void pfree(void *pointer); extern void *repalloc(void *pointer, Size size); +#define repalloc(p,s) (repalloc((p),(s))?:(exit(1),NULL)) + /* * MemoryContextSwitchTo can't be a macro in standard C compilers. * But we can make it an inline function when using GCC.
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers