[RFC] ARI related: Use of GCC poison pragma

Pierre Muller
2012-11-15T09:01:30Z

To avoid resurgence of expunged ARI problems,
Pedro suggested the use of GCC poison pragma.

The problem is that I have no experience with that
kind of code.
I looked into the gcc source,
and there seems to be a huge list of forbidden
macros and functions inside gcc/system.h
header.

Small extract of gcc-4.3.1 source:
#if (GCC_VERSION >= 3000)

/* Note autoconf checks for prototype declarations and includes
system.h while doing so. Only poison these tokens if actually
compiling gcc, so that the autoconf declaration tests for malloc
etc don't spuriously fail. */
#ifdef IN_GCC
#undef calloc
#undef strdup
#pragma GCC poison calloc strdup

#if !defined(FLEX_SCANNER) && !defined(YYBISON)
#undef malloc
#undef realloc
#pragma GCC poison malloc realloc
#endif

/* Old target macros that have moved to the target hooks structure. */
#pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN \
FUNCTION_PROLOGUE FUNCTION_EPILOGUE \
FUNCTION_END_PROLOGUE FUNCTION_BEGIN_EPILOGUE \

What would be the corresponding gdb file?
I suppose it would be defs.h

So would a patch adding
#if (GCC_VERSION >= 3000)
#pragma GCC poison xvasprintf
#endif
(and probably lots of other functions aand macros)
be an acceptable way to introduce these poisons?

Pierre Muller
as ARI maintainer