version 1.64.2.1, 2012/11/20 03:02:57 |
version 1.65, 2012/11/03 02:25:13 |
Line 1227 do_Cond_EvalExpression(Boolean *value) |
|
Line 1227 do_Cond_EvalExpression(Boolean *value) |
|
int |
int |
Cond_Eval(char *line) |
Cond_Eval(char *line) |
{ |
{ |
#define MAXIF 128 /* maximum depth of .if'ing */ |
#define MAXIF 128 /* maximum depth of .if'ing */ |
#define MAXIF_BUMP 32 /* how much to grow by */ |
#define MAXIF_BUMP 32 /* how much to grow by */ |
enum if_states { |
enum if_states { |
IF_ACTIVE, /* .if or .elif part active */ |
IF_ACTIVE, /* .if or .elif part active */ |
ELSE_ACTIVE, /* .else part active */ |
ELSE_ACTIVE, /* .else part active */ |
Line 1237 Cond_Eval(char *line) |
|
Line 1237 Cond_Eval(char *line) |
|
SKIP_TO_ENDIF /* nothing else to execute */ |
SKIP_TO_ENDIF /* nothing else to execute */ |
}; |
}; |
static enum if_states *cond_state = NULL; |
static enum if_states *cond_state = NULL; |
static unsigned int max_if_depth = MAXIF; |
static int max_if_depth = MAXIF; |
|
|
const struct If *ifp; |
const struct If *ifp; |
Boolean isElif; |
Boolean isElif; |
Line 1339 Cond_Eval(char *line) |
|
Line 1339 Cond_Eval(char *line) |
|
} |
} |
} else { |
} else { |
/* Normal .if */ |
/* Normal .if */ |
if (cond_depth + 1 >= max_if_depth) { |
if (cond_depth >= max_if_depth) { |
/* |
/* |
* This is rare, but not impossible. |
* This is rare, but not impossible. |
* In meta mode, dirdeps.mk (only runs at level 0) |
* In meta mode, dirdeps.mk (only runs at level 0) |
* can need more than the default. |
* can need more than the default. |
*/ |
*/ |
max_if_depth += MAXIF_BUMP; |
max_if_depth += MAXIF_BUMP; |
cond_state = bmake_realloc(cond_state, max_if_depth * |
cond_state = bmake_realloc(cond_state, |
sizeof(*cond_state)); |
max_if_depth * sizeof(*cond_state)); |
} |
} |
state = cond_state[cond_depth]; |
state = cond_state[cond_depth]; |
cond_depth++; |
cond_depth++; |