On 11/08/2008 04:46 PM, Tom Tromey wrote: >>>>>> "Jiri" == Jiri Slaby <[EMAIL PROTECTED]> writes: > > Jiri> while compiling slightly augmented cc1, I've found a poison > Jiri> pragma bug. Here comes a trimmed example of the bug: > > Jiri> $ echo -e '#pragma GCC poison malloc\nstruct { int malloc; };'|gcc - -E > -o/dev/null > Jiri> <stdin>:2:14: error: attempt to use poisoned "malloc" > > Could you explain what you think the bug is?
Either its use in gcc sources or the way how the #pragma keyword is handled (this can be hardly changed). > My first reaction is that this is not a bug. #pragma poison works on > identifiers, no matter what context they appear in (outside of system > headers). For this reason, poison is not always useful. > __attribute__((deprecated)) might be closer to what you want, though > it can be hard to use that with system-declared functions like malloc. I want to extend cpp to extract some more info (for backward mapping from preprocessed_code into source_code+line+column) into xml while preprocessing and I use gdome2 library. If I try to compile it, it fails due to: struct _GMemVTable { gpointer (*malloc) (gsize n_bytes); gpointer (*realloc) (gpointer mem, gsize n_bytes); void (*free) (gpointer mem); /* optional; set to NULL if not used ! */ gpointer (*calloc) (gsize n_blocks, from /usr/include/glib-2.0/glib/gmem.h. If I remove this structure compeltely, everything is OK (it's unused anyway). At least some option to disable these pragma checks inside cpp would be great. (I suppose there is none, I found it neither in gcc.info nor cpp.info nor anywhere else...)