summaryrefslogtreecommitdiff
path: root/gas/cond.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2001-03-31 06:47:54 +0000
committerAlan Modra <amodra@bigpond.net.au>2001-03-31 06:47:54 +0000
commitc8307e2aaf7d872f990e4d9335eefa0458a67313 (patch)
treeac8ab6d00638da579bf74743c7cb8f746e222d5b /gas/cond.c
parent68912e3bc31cf50463607ea7f08bf59569b6761a (diff)
downloadbinutils-redhat-c8307e2aaf7d872f990e4d9335eefa0458a67313.tar.gz
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 034796b2e3..6c6e8adfa3 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)
{