* cg_dfn.c: Include "libiberty.h"

(DFN_INCR_DEPTH): Define instead of DFN_DEPTH.
	(dfn_stack): Define as pointer rather than array.
	(pre_visit): Reallocate dfn_stack as needed.
This commit is contained in:
Ian Lance Taylor 1999-06-13 19:38:06 +00:00
parent 2575273dcb
commit bd917ff662
2 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,10 @@
1999-06-13 Ian Lance Taylor <ian@zembu.com>
* cg_dfn.c: Include "libiberty.h"
(DFN_INCR_DEPTH): Define instead of DFN_DEPTH.
(dfn_stack): Define as pointer rather than array.
(pre_visit): Reallocate dfn_stack as needed.
1999-04-26 Tom Tromey <tromey@cygnus.com> 1999-04-26 Tom Tromey <tromey@cygnus.com>
* aclocal.m4, configure: Updated for new version of libtool. * aclocal.m4, configure: Updated for new version of libtool.

View file

@ -17,13 +17,14 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
#include <stdio.h> #include <stdio.h>
#include "libiberty.h"
#include "gprof.h" #include "gprof.h"
#include "cg_arcs.h" #include "cg_arcs.h"
#include "cg_dfn.h" #include "cg_dfn.h"
#include "symtab.h" #include "symtab.h"
#include "utils.h" #include "utils.h"
#define DFN_DEPTH 100 #define DFN_INCR_DEPTH (128)
typedef struct typedef struct
{ {
@ -32,7 +33,8 @@ typedef struct
} }
DFN_Stack; DFN_Stack;
DFN_Stack dfn_stack[DFN_DEPTH]; DFN_Stack *dfn_stack = NULL;
int dfn_maxdepth = 0;
int dfn_depth = 0; int dfn_depth = 0;
int dfn_counter = DFN_NAN; int dfn_counter = DFN_NAN;
@ -194,11 +196,13 @@ static void
DEFUN (pre_visit, (parent), Sym * parent) DEFUN (pre_visit, (parent), Sym * parent)
{ {
++dfn_depth; ++dfn_depth;
if (dfn_depth >= DFN_DEPTH)
if (dfn_depth >= dfn_maxdepth)
{ {
fprintf (stderr, "[pre_visit] dfn_stack overflow\n"); dfn_maxdepth += DFN_INCR_DEPTH;
done (1); dfn_stack = xrealloc (dfn_stack, dfn_maxdepth * sizeof *dfn_stack);
} }
dfn_stack[dfn_depth].sym = parent; dfn_stack[dfn_depth].sym = parent;
dfn_stack[dfn_depth].cycle_top = dfn_depth; dfn_stack[dfn_depth].cycle_top = dfn_depth;
parent->cg.top_order = DFN_BUSY; parent->cg.top_order = DFN_BUSY;