* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add sed patterns to
authorFred Fish <fnf@specifix.com>
Sat, 31 Oct 1992 00:35:08 +0000 (00:35 +0000)
committerFred Fish <fnf@specifix.com>
Sat, 31 Oct 1992 00:35:08 +0000 (00:35 +0000)
  remap all malloc's to xmalloc's and all realloc's to xrealloc's.
* c-exp.y, m2-exp.y:  Add comment about how malloc/realloc are
  remapped to xmalloc/xrealloc, use only malloc/realloc in grammer
  file.  Remove preprocessor defines that previously did remapping.

gdb/ChangeLog
gdb/Makefile.in
gdb/c-exp.y
gdb/m2-exp.y

index d7fd3ff367c0019af1d0cf351a914ca740c31b7c..4743e4e00225e536889e18fd29fdaf2f65433818 100644 (file)
@@ -1,3 +1,11 @@
+FFri Oct 30 16:33:02 1992  Fred Fish  (fnf@cygnus.com)
+
+       * Makefile.in (c-exp.tab.c, m2-exp.tab.c):  Add sed patterns to
+         remap all malloc's to xmalloc's and all realloc's to xrealloc's.
+       * c-exp.y, m2-exp.y:  Add comment about how malloc/realloc are
+         remapped to xmalloc/xrealloc, use only malloc/realloc in grammer
+         file.  Remove preprocessor defines that previously did remapping.
+
 Tue Oct 27 17:08:45 1992  K. Richard Pixley  (rich@cygnus.com)
 
        hp300 native support (hp300hpux untested).
index 9e0c0c4e7d3d991553035a859344b4fc0e61d711..c4a5cda1b266c00465275bc029bab67c263a35b0 100644 (file)
@@ -673,6 +673,8 @@ c-exp.tab.c: $(srcdir)/c-exp.y
        -sed -e '/extern.*malloc/d' \
             -e '/extern.*realloc/d' \
             -e '/extern.*free/d' \
+            -e 's/malloc/xmalloc/g' \
+            -e 's/realloc/xrealloc/g' \
          < y.tab.c > c-exp.tab.c
        -rm y.tab.c
 
@@ -684,6 +686,8 @@ m2-exp.tab.c: $(srcdir)/m2-exp.y
        -sed -e '/extern.*malloc/d' \
             -e '/extern.*realloc/d' \
             -e '/extern.*free/d' \
+            -e 's/malloc/xmalloc/g' \
+            -e 's/realloc/xrealloc/g' \
          < y.tab.c > m2-exp.tab.c
        -rm y.tab.c
 
index 3389142c786100aae320821e8e9059ade1d97e54..3fe853eb7efd90aee77f8d42c106ec60459b614f 100644 (file)
@@ -24,7 +24,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    See expression.h for the details of the format.
    What is important here is that it can be built up sequentially
    during the process of parsing; the lower levels of the tree always
-   come first in the result.  */
+   come first in the result.
+
+   Note that malloc's and realloc's in this file are transformed to
+   xmalloc and xrealloc respectively by the same sed command in the
+   makefile that remaps any other malloc/realloc inserted by the parser
+   generator.  Doing this with #defines and trying to control the interaction
+   with include files (<malloc.h> and <stdlib.h> for example) just became
+   too messy, particularly when such includes can be inserted at random
+   times by the parser generator.  */
    
 %{
 
@@ -193,18 +201,6 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
 %type <bval> block
 %left COLONCOLON
 
-%{
-/* Ensure that if the generated parser contains any calls to malloc/realloc,
-   that they get mapped to xmalloc/xrealloc.  We have to do this here
-   rather than earlier in the file because this is the first point after
-   the place where the SVR4 yacc includes <malloc.h>, and if we do it
-   before that, then the remapped declarations in <malloc.h> will collide
-   with the ones in "defs.h". */
-
-#define malloc xmalloc
-#define realloc        xrealloc
-%}
-
 \f
 %%
 
@@ -913,13 +909,13 @@ typename: TYPENAME
 
 nonempty_typelist
        :       type
-               { $$ = (struct type **) xmalloc (sizeof (struct type *) * 2);
+               { $$ = (struct type **) malloc (sizeof (struct type *) * 2);
                  $<ivec>$[0] = 1;      /* Number of types in vector */
                  $$[1] = $1;
                }
        |       nonempty_typelist ',' type
                { int len = sizeof (struct type *) * (++($<ivec>1[0]) + 1);
-                 $$ = (struct type **) xrealloc ((char *) $1, len);
+                 $$ = (struct type **) realloc ((char *) $1, len);
                  $$[$<ivec>$[0]] = $3;
                }
        ;
index 73e08553066bfeb306077c3bf7456e4ae05545b9..d932e1671f312378ccecede398c47400b5a1ea46 100644 (file)
@@ -26,9 +26,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    See expression.h for the details of the format.
    What is important here is that it can be built up sequentially
    during the process of parsing; the lower levels of the tree always
-   come first in the result.  */
+   come first in the result.
+
+   Note that malloc's and realloc's in this file are transformed to
+   xmalloc and xrealloc respectively by the same sed command in the
+   makefile that remaps any other malloc/realloc inserted by the parser
+   generator.  Doing this with #defines and trying to control the interaction
+   with include files (<malloc.h> and <stdlib.h> for example) just became
+   too messy, particularly when such includes can be inserted at random
+   times by the parser generator. */
    
 %{
+
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
@@ -177,18 +186,7 @@ struct block *modblock=0;
 %right QID
 */
 
-%{
-/* Ensure that if the generated parser contains any calls to malloc/realloc,
-   that they get mapped to xmalloc/xrealloc.  We have to do this here
-   rather than earlier in the file because this is the first point after
-   the place where the SVR4 yacc includes <malloc.h>, and if we do it
-   before that, then the remapped declarations in <malloc.h> will collide
-   with the ones in "defs.h". */
-
-#define malloc xmalloc
-#define realloc        xrealloc
-%}
-
+\f
 %%
 
 start   :      exp
@@ -1159,7 +1157,7 @@ static char *
 make_qualname(mod,ident)
    char *mod, *ident;
 {
-   char *new = xmalloc(strlen(mod)+strlen(ident)+2);
+   char *new = malloc(strlen(mod)+strlen(ident)+2);
 
    strcpy(new,mod);
    strcat(new,".");
This page took 0.040184 seconds and 4 git commands to generate.