This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: allow plugins to disable poison


Paolo Bonzini wrote:
On 10/06/2009 11:25 PM, Taras Glek wrote:
Hi,
Current GCC poison behavior prevents plugins from using malloc() &
friends which causes conflicts with 3rd party headers that call malloc
from their headers.

* system.h: Do not use poison when PLUGIN_NO_POISON is defined

While I don't disagree with this change in principle, I think malloc and realloc should be the only poisonings disabled. Also, it would be nice if this was done automatically for all plugins, for example by doing in gcc-plugin.h
I disagree. GCC poisons a lot of identifiers and the risk of collisions with other headers is fairly high.

#ifndef IN_GCC #define IN_GCC +#define IN_GCC_PLUGIN #endif
Yes, good idea. I updated the patch.

* system.h: Do not use poison when PLUGIN_NO_POISON is defined
* gcc-plugin.h: Define IN_GCC_PLUGIN

Taras
Index: gcc/gcc-plugin.h
===================================================================
--- gcc/gcc-plugin.h	(revision 152497)
+++ gcc/gcc-plugin.h	(working copy)
@@ -22,6 +22,7 @@
 
 #ifndef IN_GCC
 #define IN_GCC
+#define IN_GCC_PLUGIN
 #endif
 
 #include "config.h"
Index: gcc/system.h
===================================================================
--- gcc/system.h	(revision 152497)
+++ gcc/system.h	(working copy)
@@ -661,7 +661,7 @@
 #define realloc xrealloc
 #endif
 
-#if (GCC_VERSION >= 3000)
+#if (GCC_VERSION >= 3000) && !defined(IN_GCC_PLUGIN)
 
 /* Note autoconf checks for prototype declarations and includes
    system.h while doing so.  Only poison these tokens if actually

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]