Try to prevent direct use of exit(), malloc(), etc
Use `#pragma GCC poison` (supported since GCC 3, maybe earlier) when compiling with GCC to help prevent direct uses being introduced for functions which DOH provides a wrapper for.
This commit is contained in:
parent
6d29260a1a
commit
747a51f095
4 changed files with 50 additions and 16 deletions
|
|
@ -25,6 +25,15 @@
|
|||
%{
|
||||
#define yylex yylex
|
||||
|
||||
/* doh.h uses #pragma GCC posion with GCC to prevent direct calls to certain
|
||||
* standard C library functions being introduced, but those cause errors due
|
||||
* to checks like `#if defined YYMALLOC || defined malloc` in the bison
|
||||
* template code. We can't easily arrange to include headers after that
|
||||
* template code, so instead we disable the problematic poisoning for this
|
||||
* file.
|
||||
*/
|
||||
#define DOH_NO_POISON_MALLOC_FREE
|
||||
|
||||
#include "swig.h"
|
||||
#include "cparse.h"
|
||||
#include "preprocessor.h"
|
||||
|
|
@ -34,6 +43,9 @@
|
|||
#undef alloca
|
||||
#define alloca Malloc
|
||||
|
||||
#define YYMALLOC Malloc
|
||||
#define YYFREE Free
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Externals
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue