Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

poisoned "malloc"

86 views
Skip to first unread message

stephan.zimmer

unread,
Jul 18, 2008, 7:44:31 AM7/18/08
to
Hello all,

could anyone tell me what a 'poisoned "malloc"' is? I was trying to
build a gcc crosscompiler for v850-elf (version 3.2.1, host compiler
version 3.3) and failed with this error message. The error concerns
one of the files that are generated by the bison parser generator.
Could anyone shed some light on that?

Best,

Stephan

Hallvard B Furuseth

unread,
Jul 19, 2008, 5:37:08 PM7/19/08
to
stephan.zimmer writes:
> could anyone tell me what a 'poisoned "malloc"' is? I was trying to
> build a gcc crosscompiler for v850-elf (version 3.2.1, host compiler
> version 3.3) and failed with this error message.

Something is doing #pragma GCC poison ... malloc. Compile with gcc -E
instead of gcc -c to see where it is done. See Info node (cpp)Pragmas:

`#pragma GCC poison'
Sometimes, there is an identifier that you want to remove
completely from your program, and make sure that it never creeps
back in. To enforce this, you can "poison" the identifier with
this pragma. `#pragma GCC poison' is followed by a list of
identifiers to poison. If any of those identifiers appears
anywhere in the source after the directive, it is a hard error.
For example,

#pragma GCC poison printf sprintf fprintf
sprintf(some_string, "hello");

will produce an error.

If a poisoned identifier appears as part of the expansion of a
macro which was defined before the identifier was poisoned, it
will _not_ cause an error. This lets you poison an identifier
without worrying about system headers defining macros that use it.

For example,

#define strrchr rindex
#pragma GCC poison rindex
strrchr(some_string, 'h');

will not produce an error.

--
Hallvard

0 new messages