I'm modifying Qemu's source code, created a file like this
#if defined(TARGET_I386)
/* some defines */
#elif defined(TARGET_ARM)
/* some other defines */
#endif
This file is then included in vl.c
, and gcc reports the following error message:
error: attempt to use poisoned "TARGET_I386"
error: attempt to use poisoned "TARGET_ARM"
TARGET_I386
is defined in another header file and is used in other qemu's source file.
What's the meaning of this error message?
Update:
As mentioned by Matthias Werner, these defines should not be used for target independent code. These poison identifies are defined in poison.h
Apparently the identifiers have been marked as poisoned
From GCC Documentation
#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.
Poison identifiers in QEMU should not be used when building target independent code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With