Kaydet (Commit) 2d4dc491 authored tarafından Ivo Hinkelmann's avatar Ivo Hinkelmann

INTEGRATION: CWS dmake45 (1.5.2); FILE MERGED

2006/06/13 23:31:49 vq 1.5.2.2: #i64431# Fix .SETDIR problem with percent targets.
2006/05/05 21:33:06 vq 1.5.2.1: #i65122# Fix problem with "non-documented" handling of multiple %-targets
plus several improved comments and a man page correction.
üst 054a12bf
/* $RCSfile: infer.c,v $ /* $RCSfile: infer.c,v $
-- $Revision: 1.5 $ -- $Revision: 1.6 $
-- last change: $Author: hr $ $Date: 2006-04-20 12:00:49 $ -- last change: $Author: ihi $ $Date: 2006-06-29 11:24:00 $
-- --
-- SYNOPSIS -- SYNOPSIS
-- Infer how to make a target. -- Infer how to make a target.
...@@ -52,6 +52,11 @@ static ICELLPTR add_iset ANSI((ICELLPTR,ICELLPTR,CELLPTR,DFALINKPTR, ...@@ -52,6 +52,11 @@ static ICELLPTR add_iset ANSI((ICELLPTR,ICELLPTR,CELLPTR,DFALINKPTR,
static ICELLPTR derive_prerequisites ANSI((ICELLPTR, ICELLPTR *)); static ICELLPTR derive_prerequisites ANSI((ICELLPTR, ICELLPTR *));
static char * dump_inf_chain ANSI((ICELLPTR, int, int)); static char * dump_inf_chain ANSI((ICELLPTR, int, int));
#ifdef DBUG
static void _dump_dfa_stack ANSI((DFALINKPTR, DFASETPTR));
static void _dump_iset ANSI(( char *, ICELLPTR ));
#endif
PUBLIC void PUBLIC void
Infer_recipe( cp, setdirroot )/* Infer_recipe( cp, setdirroot )/*
...@@ -239,19 +244,29 @@ CELLPTR setdirroot; ...@@ -239,19 +244,29 @@ CELLPTR setdirroot;
pmatch->ic_dfa->dl_per = NIL(char); pmatch->ic_dfa->dl_per = NIL(char);
/* If infcell already had a directory set then modify it based on /* If infcell already had a .SETDIR directory set then modify it
* whether it was the original cell or some intermediary. */ * based on whether it was the original cell or some intermediary. */
if( imeta->ce_dir ) { if( imeta->ce_dir ) {
if( infcell->ce_dir && infcell == cp ) { if( infcell->ce_dir && infcell == cp ) {
/* cp->ce_dir was set and we have pushed the directory prior /* cp->ce_dir was set and we have pushed the directory prior
* to calling this routine. We should therefore pop it and * to calling this routine.
* push the new concatenated directory required by the * We build a new path by appending imeta->ce_dir to the
* inference. */ * current directory of the original cell.
infcell->ce_dir=DmStrDup(Build_path(infcell->ce_dir, * We should therefore pop it and push the new concatenated
imeta->ce_dir)); * directory required by the inference.
* This leaks memory as cp->ce_dir is not freed before
* setting the new the new infcell->ce_dir value but as
* the pointer could be a `A_POOL` member we accept this. */
infcell->ce_dir = DmStrDup(Build_path(infcell->ce_dir,
imeta->ce_dir));
}
else {
/* Inherit a copy of the .SETDIR value. Use a copy because
* the original could have been freed in the meantime
* in Make() by the FREE() before _pool_lookup(). This can
* also leak if infcell->ce_dir was set before. */
infcell->ce_dir = DmStrDup(imeta->ce_dir);
} }
else
infcell->ce_dir = imeta->ce_dir;
} }
for( lp=imeta->ce_indprq; lp != NIL(LINK); lp=lp->cl_next ) { for( lp=imeta->ce_indprq; lp != NIL(LINK); lp=lp->cl_next ) {
...@@ -505,7 +520,9 @@ ICELLPTR *nnmp; ...@@ -505,7 +520,9 @@ ICELLPTR *nnmp;
static char * static char *
buildname( tg, meta, per ) buildname( tg, meta, per )/*
============================
Replace '%' with per in meta. Expand the result and return it. */
char *tg; char *tg;
char *meta; char *meta;
char *per; char *per;
...@@ -787,6 +804,7 @@ int print; ...@@ -787,6 +804,7 @@ int print;
#ifdef DBUG #ifdef DBUG
static void
_dump_dfa_stack(dfas, dfa_stack) _dump_dfa_stack(dfas, dfa_stack)
DFALINKPTR dfas; DFALINKPTR dfas;
DFASETPTR dfa_stack; DFASETPTR dfa_stack;
...@@ -812,6 +830,7 @@ DFASETPTR dfa_stack; ...@@ -812,6 +830,7 @@ DFASETPTR dfa_stack;
} }
static void
_dump_iset( name, iset ) _dump_iset( name, iset )
char *name; char *name;
ICELLPTR iset; ICELLPTR iset;
...@@ -834,7 +853,7 @@ ICELLPTR iset; ...@@ -834,7 +853,7 @@ ICELLPTR iset;
else else
printf( "dfa: (nil)\n" ); printf( "dfa: (nil)\n" );
printf( "sdr: %04x\n", iset->ic_setdirroot ); printf( "sdr: %p\n", iset->ic_setdirroot );
_dump_dfa_stack(iset->ic_dfastack.df_set, &iset->ic_dfastack); _dump_dfa_stack(iset->ic_dfastack.df_set, &iset->ic_dfastack);
printf( "dmax: %d\n", iset->ic_dmax ); printf( "dmax: %d\n", iset->ic_dmax );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment