From 61b96bb4281e65ed15d15ed7e9ae5102d64bc8c9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 31 Mar 2001 06:47:54 +0000 Subject: Fix conditional assembly listings when more than one .else/.elsif --- gas/cond.c | 96 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 47 insertions(+), 49 deletions(-) (limited to 'gas/cond.c') diff --git a/gas/cond.c b/gas/cond.c index 034796b..6c6e8ad 100644 --- a/gas/cond.c +++ b/gas/cond.c @@ -255,9 +255,6 @@ void s_elseif (arg) int arg; { - expressionS operand; - int t; - if (current_cframe == NULL) { as_bad (_("\".elseif\" without matching \".if\" - ignored")); @@ -277,54 +274,55 @@ s_elseif (arg) as_where (¤t_cframe->else_file_line.file, ¤t_cframe->else_file_line.line); - if (!current_cframe->dead_tree) - { - current_cframe->dead_tree = !current_cframe->ignoring; - current_cframe->ignoring = !current_cframe->ignoring; - if (LISTING_SKIP_COND ()) - { - if (! current_cframe->ignoring) - listing_list (1); - else - listing_list (2); - } - } /* if not a dead tree */ - } /* if error else do it */ + current_cframe->dead_tree |= !current_cframe->ignoring; + current_cframe->ignoring = current_cframe->dead_tree; + } if (current_cframe == NULL || current_cframe->ignoring) { while (! is_end_of_line[(unsigned char) *input_line_pointer]) ++input_line_pointer; - return; + + if (current_cframe == NULL) + return; } + else + { + expressionS operand; + int t; - /* Leading whitespace is part of operand. */ - SKIP_WHITESPACE (); + /* Leading whitespace is part of operand. */ + SKIP_WHITESPACE (); - expression (&operand); - if (operand.X_op != O_constant) - as_bad (_("non-constant expression in \".elseif\" statement")); + expression (&operand); + if (operand.X_op != O_constant) + as_bad (_("non-constant expression in \".elseif\" statement")); - switch ((operatorT) arg) - { - case O_eq: t = operand.X_add_number == 0; break; - case O_ne: t = operand.X_add_number != 0; break; - case O_lt: t = operand.X_add_number < 0; break; - case O_le: t = operand.X_add_number <= 0; break; - case O_ge: t = operand.X_add_number >= 0; break; - case O_gt: t = operand.X_add_number > 0; break; - default: - abort (); - return; - } + switch ((operatorT) arg) + { + case O_eq: t = operand.X_add_number == 0; break; + case O_ne: t = operand.X_add_number != 0; break; + case O_lt: t = operand.X_add_number < 0; break; + case O_le: t = operand.X_add_number <= 0; break; + case O_ge: t = operand.X_add_number >= 0; break; + case O_gt: t = operand.X_add_number > 0; break; + default: + abort (); + return; + } - current_cframe->ignoring = current_cframe->dead_tree || ! t; + current_cframe->ignoring = current_cframe->dead_tree || ! t; + } if (LISTING_SKIP_COND () - && current_cframe->ignoring && (current_cframe->previous_cframe == NULL || ! current_cframe->previous_cframe->ignoring)) - listing_list (2); + { + if (! current_cframe->ignoring) + listing_list (1); + else + listing_list (2); + } demand_empty_rest_of_line (); } @@ -368,7 +366,6 @@ s_else (arg) if (current_cframe == NULL) { as_bad (_(".else without matching .if - ignored")); - } else if (current_cframe->else_seen) { @@ -385,20 +382,21 @@ s_else (arg) as_where (¤t_cframe->else_file_line.file, ¤t_cframe->else_file_line.line); - if (!current_cframe->dead_tree) + current_cframe->ignoring = + current_cframe->dead_tree | !current_cframe->ignoring; + + if (LISTING_SKIP_COND () + && (current_cframe->previous_cframe == NULL + || ! current_cframe->previous_cframe->ignoring)) { - current_cframe->ignoring = !current_cframe->ignoring; - if (LISTING_SKIP_COND ()) - { - if (! current_cframe->ignoring) - listing_list (1); - else - listing_list (2); - } - } /* if not a dead tree */ + if (! current_cframe->ignoring) + listing_list (1); + else + listing_list (2); + } current_cframe->else_seen = 1; - } /* if error else do it */ + } if (flag_mri) { -- cgit v1.1