(demand_empty_rest_of_line): Issue an error here.
(ignore_rest_of_line): Silently skip to end.
(demand_copy_string): Issue an error, not warning.
(equals): Likewise.
* config/obj-elf.c (obj_elf_section_name): Likewise.
(obj_elf_section): Likewise.
* config/tc-arc.c (arc_extoper): Remove bogus NULL checks.
(arc_extinst): Likewise.
* config/tc-ia64.c (dot_saveb): Use demand_empty_rest_of_line.
(dot_spill): Likewise.
(dot_unwabi): Likewise.
(dot_prologue): Likewise.
2004-03-18 Nathan Sidwell <nathan@codesourcery.com>
+ * read.c (read_a_source_file): Use demand_empty_rest_of_line.
+ (demand_empty_rest_of_line): Issue an error here.
+ (ignore_rest_of_line): Silently skip to end.
+ (demand_copy_string): Issue an error, not warning.
+ (equals): Likewise.
+ * config/obj-elf.c (obj_elf_section_name): Likewise.
+ (obj_elf_section): Likewise.
+ * config/tc-arc.c (arc_extoper): Remove bogus NULL checks.
+ (arc_extinst): Likewise.
+ * config/tc-ia64.c (dot_saveb): Use demand_empty_rest_of_line.
+ (dot_spill): Likewise.
+ (dot_unwabi): Likewise.
+ (dot_prologue): Likewise.
+
* expr.c (operand): Reject ++ and --.
(operator): Likewise.
end++;
if (end == input_line_pointer)
{
- as_warn (_("missing name"));
+ as_bad (_("missing name"));
ignore_rest_of_line ();
return NULL;
}
SKIP_WHITESPACE ();
if (*input_line_pointer != '#')
{
- as_warn (_("character following name is not '#'"));
+ as_bad (_("character following name is not '#'"));
ignore_rest_of_line ();
return;
}
name = input_line_pointer;
c = get_symbol_end ();
name = xstrdup (name);
- if (NULL == name)
- {
- ignore_rest_of_line ();
- return;
- }
p = name;
while (*p)
name = input_line_pointer;
c = get_symbol_end ();
name = xstrdup (name);
- if (NULL == name)
- {
- ignore_rest_of_line ();
- return;
- }
strcpy (syntax, name);
name_len = strlen (name);
strcat (syntax, "%S%L");
ext_op = (struct arc_opcode *) xmalloc (sizeof (struct arc_opcode));
- if (NULL == ext_op)
- {
- ignore_rest_of_line ();
- return;
- }
-
ext_op->syntax = xstrdup (syntax);
- if (NULL == ext_op->syntax)
- {
- ignore_rest_of_line ();
- return;
- }
ext_op->mask = I (-1) | ((0x3 == opcode) ? C (-1) : 0);
ext_op->value = I (opcode) | ((0x3 == opcode) ? C (subopcode) : 0);
add_unwind_entry (output_br_mem (brmask));
if (!is_end_of_line[sep] && !is_it_end_of_statement ())
- ignore_rest_of_line ();
+ demand_empty_rest_of_line ();
}
static void
sep = parse_operand (&e);
if (!is_end_of_line[sep] && !is_it_end_of_statement ())
- ignore_rest_of_line ();
+ demand_empty_rest_of_line ();
if (e.X_op != O_constant)
as_bad ("Operand to .spill must be a constant");
}
sep = parse_operand (&e2);
if (!is_end_of_line[sep] && !is_it_end_of_statement ())
- ignore_rest_of_line ();
+ demand_empty_rest_of_line ();
if (e1.X_op != O_constant)
{
as_bad ("No second operand to .prologue");
sep = parse_operand (&e2);
if (!is_end_of_line[sep] && !is_it_end_of_statement ())
- ignore_rest_of_line ();
+ demand_empty_rest_of_line ();
if (e1.X_op == O_constant)
{
#endif
input_line_pointer--;
/* Report unknown char as ignored. */
- ignore_rest_of_line ();
+ demand_empty_rest_of_line ();
}
#ifdef md_after_pass_hook
#endif
}
\f
+
+/* Verify that we are at the end of a line. If not, issue an error and
+ skip to EOL. */
+
void
demand_empty_rest_of_line (void)
{
if (is_end_of_line[(unsigned char) *input_line_pointer])
input_line_pointer++;
else
- ignore_rest_of_line ();
-
- /* Return having already swallowed end-of-line. */
-}
-
-void
-ignore_rest_of_line (void)
-{
- /* For suspect lines: gives warning. */
- if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
if (ISPRINT (*input_line_pointer))
- as_warn (_("rest of line ignored; first ignored character is `%c'"),
+ as_bad (_("junk at end of line, first unrecognized character is `%c'"),
*input_line_pointer);
else
- as_warn (_("rest of line ignored; first ignored character valued 0x%x"),
+ as_bad (_("junk at end of line, first unrecognized character valued 0x%x"),
*input_line_pointer);
-
- while (input_line_pointer < buffer_limit
- && !is_end_of_line[(unsigned char) *input_line_pointer])
- input_line_pointer++;
+ ignore_rest_of_line ();
}
+
+ /* Return pointing just after end-of-line. */
+ know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
+}
+
+/* Silently advance to the end of line. Use this after already having
+ issued an error about something bad. */
+
+void
+ignore_rest_of_line (void)
+{
+ while (input_line_pointer < buffer_limit
+ && !is_end_of_line[(unsigned char) *input_line_pointer])
+ input_line_pointer++;
input_line_pointer++;
}
else
{
- as_warn (_("missing string"));
+ as_bad (_("missing string"));
retval = NULL;
ignore_rest_of_line ();
}
if (flag_mri)
{
/* Check garbage after the expression. */
- ignore_rest_of_line ();
+ demand_empty_rest_of_line ();
mri_comment_end (stop, stopc);
}
}