X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fcond.c;h=025ca51b11a30bdeda48da82c5f72e9a042b34e8;hb=bc4466dcf10e23054dc420c9eee11210dce0e9d8;hp=71a2a8e7d13d0fc43adf3dee0a1bbcd25e8226b9;hpb=252b5132c753830d5fd56823373aed85f2a0db63;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/cond.c b/gas/cond.c index 71a2a8e7d1..025ca51b11 100644 --- a/gas/cond.c +++ b/gas/cond.c @@ -1,5 +1,5 @@ /* cond.c - conditional assembly pseudo-ops, and .include - Copyright (C) 1990, 91, 92, 93, 95, 96, 97, 1998 + Copyright (C) 1990, 91, 92, 93, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -64,7 +64,7 @@ s_ifdef (arg) int arg; { register char *name; /* points to name of symbol */ - register struct symbol *symbolP; /* Points to symbol */ + register symbolS *symbolP; /* Points to symbol */ struct conditional_frame cframe; SKIP_WHITESPACE (); /* Leading whitespace is part of operand. */ @@ -247,8 +247,88 @@ s_ifc (arg) } void -s_endif (arg) +s_elseif (arg) int arg; +{ + expressionS operand; + int t; + + if (current_cframe == NULL) + { + as_bad (_("\".elseif\" without matching \".if\" - ignored")); + + } + else if (current_cframe->else_seen) + { + as_bad (_("\".elseif\" after \".else\" - ignored")); + as_bad_where (current_cframe->else_file_line.file, + current_cframe->else_file_line.line, + _("here is the previous \"else\"")); + as_bad_where (current_cframe->if_file_line.file, + current_cframe->if_file_line.line, + _("here is the previous \"if\"")); + } + else + { + as_where (¤t_cframe->else_file_line.file, + ¤t_cframe->else_file_line.line); + + if (!current_cframe->dead_tree) + { + 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 */ + + + SKIP_WHITESPACE (); /* Leading whitespace is part of operand. */ + + if (current_cframe != NULL && current_cframe->ignoring) + { + operand.X_add_number = 0; + while (! is_end_of_line[(unsigned char) *input_line_pointer]) + ++input_line_pointer; + } + else + { + 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; + } + + 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); + + demand_empty_rest_of_line (); +} + +void +s_endif (arg) + int arg ATTRIBUTE_UNUSED; { struct conditional_frame *hold; @@ -280,7 +360,7 @@ s_endif (arg) void s_else (arg) - int arg; + int arg ATTRIBUTE_UNUSED; { if (current_cframe == NULL) { @@ -372,11 +452,7 @@ ignore_input () s = input_line_pointer; - if (flag_m68k_mri -#ifdef NO_PSEUDO_DOT - || 1 -#endif - ) + if (NO_PSEUDO_DOT || flag_m68k_mri) { if (s[-1] != '.') --s;