aboutsummaryrefslogtreecommitdiff
path: root/gas/cond.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-09-07 01:17:16 +0000
committerIan Lance Taylor <ian@airs.com>1995-09-07 01:17:16 +0000
commit86038ada178e4cf8f3a541f2720b26761901e769 (patch)
tree18df56d5a8bc0f1649c6429f0c3d68a3c8c3aef6 /gas/cond.c
parentfca4042a3a74ccc2974d28bbde58e79915799494 (diff)
downloadgdb-86038ada178e4cf8f3a541f2720b26761901e769.zip
gdb-86038ada178e4cf8f3a541f2720b26761901e769.tar.gz
gdb-86038ada178e4cf8f3a541f2720b26761901e769.tar.bz2
* app.c (do_scrub_chars): In MRI mode, silently end quoted strings
at newline characters. In MRI mode, always keep spaces in the operands field. In MRI mode, treat a line comment character as a regular comment character following a space. * cond.c (ignore_input): Use strncasecmp rather than strncmp when looking for special pseudo-ops. * read.c (cons_worker): In MRI mode, the expressions stop at the first unquoted space. (equals): Likewise.
Diffstat (limited to 'gas/cond.c')
-rw-r--r--gas/cond.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/gas/cond.c b/gas/cond.c
index def9db9..b32f3f5 100644
--- a/gas/cond.c
+++ b/gas/cond.c
@@ -61,19 +61,23 @@ s_ifdef (arg)
{
as_bad ("invalid identifier for \".ifdef\"");
obstack_1grow (&cond_obstack, 0);
+ ignore_rest_of_line ();
}
else
{
- get_symbol_end ();
- ++input_line_pointer;
+ char c;
+
+ c = get_symbol_end ();
symbolP = symbol_find (name);
+ *input_line_pointer = c;
initialize_cframe (&cframe);
cframe.ignoring = cframe.dead_tree || !((symbolP != 0) ^ arg);
- current_cframe = (struct conditional_frame *) obstack_copy (&cond_obstack, &cframe, sizeof (cframe));
+ current_cframe = ((struct conditional_frame *)
+ obstack_copy (&cond_obstack, &cframe,
+ sizeof (cframe)));
+ demand_empty_rest_of_line ();
} /* if a valid identifyer name */
-
- return;
} /* s_ifdef() */
void
@@ -85,10 +89,19 @@ s_if (arg)
int t;
SKIP_WHITESPACE (); /* Leading whitespace is part of operand. */
- expression (&operand);
- if (operand.X_op != O_constant)
- as_bad ("non-constant expression in \".if\" statement");
+ 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 \".if\" statement");
+ }
switch ((operatorT) arg)
{
@@ -108,7 +121,8 @@ s_if (arg)
cframe.ignoring = cframe.dead_tree || ! t;
current_cframe = ((struct conditional_frame *)
obstack_copy (&cond_obstack, &cframe, sizeof (cframe)));
- return;
+
+ demand_empty_rest_of_line ();
} /* s_if() */
/* Get a string for the MRI IFC or IFNC pseudo-ops. */
@@ -268,14 +282,16 @@ ignore_input ()
}
/* We cannot ignore certain pseudo ops. */
- if ((s[0] == 'i'
- && (!strncmp (s, "if", 2)
- || !strncmp (s, "ifdef", 5)
- || !strncmp (s, "ifndef", 6)))
- || (s[0] == 'e'
- && (!strncmp (s, "else", 4)
- || !strncmp (s, "endif", 5)
- || !strncmp (s, "endc", 4))))
+ if (((s[0] == 'i'
+ || s[0] == 'I')
+ && (!strncasecmp (s, "if", 2)
+ || !strncasecmp (s, "ifdef", 5)
+ || !strncasecmp (s, "ifndef", 6)))
+ || ((s[0] == 'e'
+ || s[0] == 'E')
+ && (!strncasecmp (s, "else", 4)
+ || !strncasecmp (s, "endif", 5)
+ || !strncasecmp (s, "endc", 4))))
return 0;
return (current_cframe != NULL) && (current_cframe->ignoring);