aboutsummaryrefslogtreecommitdiff
path: root/gas/cond.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-03-31 06:47:54 +0000
committerAlan Modra <amodra@gmail.com>2001-03-31 06:47:54 +0000
commit61b96bb4281e65ed15d15ed7e9ae5102d64bc8c9 (patch)
tree1519a47d47120445c93e517b143353d65f109da8 /gas/cond.c
parent69e37bf6a2178f46c52f5e9d1e607a2067ec2c8b (diff)
downloadgdb-61b96bb4281e65ed15d15ed7e9ae5102d64bc8c9.zip
gdb-61b96bb4281e65ed15d15ed7e9ae5102d64bc8c9.tar.gz
gdb-61b96bb4281e65ed15d15ed7e9ae5102d64bc8c9.tar.bz2
Fix conditional assembly listings when more than one .else/.elsif
Diffstat (limited to 'gas/cond.c')
-rw-r--r--gas/cond.c96
1 files changed, 47 insertions, 49 deletions
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 (&current_cframe->else_file_line.file,
&current_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 (&current_cframe->else_file_line.file,
&current_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)
{