This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Trivial, avoid gratuitous incompatibility with byacc
- From: Marc Espie <espie at nerim dot net>
- To: gcc-patches at gcc dot gnu dot org
- Cc: gdr at integrable-solutions dot net
- Date: Mon, 12 Jan 2004 22:49:47 +0100
- Subject: [PATCH] Trivial, avoid gratuitous incompatibility with byacc
- Reply-to: espie at nerim dot net
I found this while building gcc 3.3.2 on OpenBSD.
byacc works like bison, so trying to play games with malloc will work
just as well...
One patch for head, one patch for the 3.3 branch. This is fairly
innocuous, and would reduce the amount of diffs in my tree...
So, if someone can okay this for -head, and if Gaby allows this to be
in 3.3...
2004-01-12 Marc Espie <espie@openbsd.org>
* system.h: handle YYBYACC like YYBISON.
Index: system.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/system.h,v
retrieving revision 1.181
diff -u -p -c -r1.181 system.h
*** system.h 9 Jan 2004 15:33:43 -0000 1.181
--- system.h 12 Jan 2004 21:43:02 -0000
*************** typedef char _Bool;
*** 553,559 ****
#define really_call_calloc calloc
#define really_call_realloc realloc
! #if defined(FLEX_SCANNER) || defined(YYBISON)
/* Flex and bison use malloc and realloc. Yuk. Note that this means
really_call_* cannot be used in a .l or .y file. */
#define malloc xmalloc
--- 553,559 ----
#define really_call_calloc calloc
#define really_call_realloc realloc
! #if defined(FLEX_SCANNER) || defined(YYBISON) || defined(YYBYACC)
/* Flex and bison use malloc and realloc. Yuk. Note that this means
really_call_* cannot be used in a .l or .y file. */
#define malloc xmalloc
2004-01-12 Marc Espie <espie@openbsd.org>
* system.h: handle YYBYACC like YYBISON.
Index: system.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/system.h,v
retrieving revision 1.133.4.1
diff -u -p -c -r1.133.4.1 system.h
*** system.h 31 Mar 2003 01:12:20 -0000 1.133.4.1
--- system.h 12 Jan 2004 21:44:08 -0000
*************** typedef char _Bool;
*** 584,590 ****
#undef strdup
#pragma GCC poison calloc strdup
! #if defined(FLEX_SCANNER) || defined (YYBISON)
/* Flex and bison use malloc and realloc. Yuk. */
#define malloc xmalloc
#define realloc xrealloc
--- 584,590 ----
#undef strdup
#pragma GCC poison calloc strdup
! #if defined(FLEX_SCANNER) || defined (YYBISON) || defined(YYBYACC)
/* Flex and bison use malloc and realloc. Yuk. */
#define malloc xmalloc
#define realloc xrealloc