mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-28 12:33:36 +08:00
gas/
2005-05-17 Jan Beulich <jbeulich@novell.com> * read.c (_find_end_of_line): New. (find_end_of_line): New. (HANDLE_CONDITIONAL_ASSEMBLY): Use it. (read_a_source_file): Use it. (s_globl): Use it. (s_macro): Use it. (get_line_sb): Use it. (s_errwarn): Replace discard_rest_of_line by ignore_rest_of_line. (s_comm_internal): Likewise. (s_lsym): Likewise. (s_macro): Likewise. (s_ignore): Use ignore_rest_of_line. * read.h (find_end_of_line): Prototype. (discard_rest_of_line): Remove prototype. #define to ignore_rest_of_line. gas/testsuite/ 2005-05-17 Jan Beulich <jbeulich@novell.com> * gas/mmix/err-byte1.s: Adjust expected error text on line 10.
This commit is contained in:
parent
7e8aeb9a48
commit
40a4d956e2
@ -1,3 +1,21 @@
|
|||||||
|
2005-05-17 Jan Beulich <jbeulich@novell.com>
|
||||||
|
|
||||||
|
* read.c (_find_end_of_line): New.
|
||||||
|
(find_end_of_line): New.
|
||||||
|
(HANDLE_CONDITIONAL_ASSEMBLY): Use it.
|
||||||
|
(read_a_source_file): Use it.
|
||||||
|
(s_globl): Use it.
|
||||||
|
(s_macro): Use it.
|
||||||
|
(get_line_sb): Use it.
|
||||||
|
(s_errwarn): Replace discard_rest_of_line by ignore_rest_of_line.
|
||||||
|
(s_comm_internal): Likewise.
|
||||||
|
(s_lsym): Likewise.
|
||||||
|
(s_macro): Likewise.
|
||||||
|
(s_ignore): Use ignore_rest_of_line.
|
||||||
|
* read.h (find_end_of_line): Prototype.
|
||||||
|
(discard_rest_of_line): Remove prototype. #define to
|
||||||
|
ignore_rest_of_line.
|
||||||
|
|
||||||
2005-05-17 Nick Clifton <nickc@redhat.com>
|
2005-05-17 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* config/tc-v850,h (TC_FIX_TYPE): Define.
|
* config/tc-v850,h (TC_FIX_TYPE): Define.
|
||||||
|
168
gas/read.c
168
gas/read.c
@ -221,6 +221,7 @@ static segT get_known_segmented_expression (expressionS * expP);
|
|||||||
static void pobegin (void);
|
static void pobegin (void);
|
||||||
static int get_line_sb (sb *);
|
static int get_line_sb (sb *);
|
||||||
static void generate_file_debug (void);
|
static void generate_file_debug (void);
|
||||||
|
static char *_find_end_of_line (char *, int, int);
|
||||||
|
|
||||||
void
|
void
|
||||||
read_begin (void)
|
read_begin (void)
|
||||||
@ -519,9 +520,11 @@ pobegin (void)
|
|||||||
#define HANDLE_CONDITIONAL_ASSEMBLY() \
|
#define HANDLE_CONDITIONAL_ASSEMBLY() \
|
||||||
if (ignore_input ()) \
|
if (ignore_input ()) \
|
||||||
{ \
|
{ \
|
||||||
while (!is_end_of_line[(unsigned char) *input_line_pointer++]) \
|
char *eol = find_end_of_line (input_line_pointer, flag_m68k_mri); \
|
||||||
if (input_line_pointer == buffer_limit) \
|
input_line_pointer = (input_line_pointer <= buffer_limit \
|
||||||
break; \
|
&& eol >= buffer_limit) \
|
||||||
|
? buffer_limit \
|
||||||
|
: eol + 1; \
|
||||||
continue; \
|
continue; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,9 +722,7 @@ read_a_source_file (char *name)
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* Find the end of the current expanded macro line. */
|
/* Find the end of the current expanded macro line. */
|
||||||
for (s = input_line_pointer - 1; *s; ++s)
|
s = find_end_of_line (input_line_pointer - 1, flag_m68k_mri);
|
||||||
if (is_end_of_line[(unsigned char) *s])
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (s != last_eol)
|
if (s != last_eol)
|
||||||
{
|
{
|
||||||
@ -911,34 +912,10 @@ read_a_source_file (char *name)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int inquote = 0;
|
|
||||||
#ifdef QUOTES_IN_INSN
|
|
||||||
int inescape = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* WARNING: c has char, which may be end-of-line. */
|
/* WARNING: c has char, which may be end-of-line. */
|
||||||
/* Also: input_line_pointer->`\0` where c was. */
|
/* Also: input_line_pointer->`\0` where c was. */
|
||||||
*input_line_pointer = c;
|
*input_line_pointer = c;
|
||||||
while (!is_end_of_line[(unsigned char) *input_line_pointer]
|
input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1);
|
||||||
|| inquote
|
|
||||||
#ifdef TC_EOL_IN_INSN
|
|
||||||
|| TC_EOL_IN_INSN (input_line_pointer)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (flag_m68k_mri && *input_line_pointer == '\'')
|
|
||||||
inquote = !inquote;
|
|
||||||
#ifdef QUOTES_IN_INSN
|
|
||||||
if (inescape)
|
|
||||||
inescape = 0;
|
|
||||||
else if (*input_line_pointer == '"')
|
|
||||||
inquote = !inquote;
|
|
||||||
else if (*input_line_pointer == '\\')
|
|
||||||
inescape = 1;
|
|
||||||
#endif
|
|
||||||
input_line_pointer++;
|
|
||||||
}
|
|
||||||
|
|
||||||
c = *input_line_pointer;
|
c = *input_line_pointer;
|
||||||
*input_line_pointer = '\0';
|
*input_line_pointer = '\0';
|
||||||
|
|
||||||
@ -1459,7 +1436,7 @@ s_comm_internal (int param,
|
|||||||
if (name == p)
|
if (name == p)
|
||||||
{
|
{
|
||||||
as_bad (_("expected symbol name"));
|
as_bad (_("expected symbol name"));
|
||||||
discard_rest_of_line ();
|
ignore_rest_of_line ();
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1785,7 +1762,7 @@ s_errwarn (int err)
|
|||||||
{
|
{
|
||||||
as_bad (_("%s argument must be a string"),
|
as_bad (_("%s argument must be a string"),
|
||||||
err ? ".error" : ".warning");
|
err ? ".error" : ".warning");
|
||||||
discard_rest_of_line ();
|
ignore_rest_of_line ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1966,7 +1943,7 @@ s_globl (int ignore ATTRIBUTE_UNUSED)
|
|||||||
void
|
void
|
||||||
s_irp (int irpc)
|
s_irp (int irpc)
|
||||||
{
|
{
|
||||||
char *file;
|
char *file, *eol;
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
sb s;
|
sb s;
|
||||||
const char *err;
|
const char *err;
|
||||||
@ -1975,8 +1952,9 @@ s_irp (int irpc)
|
|||||||
as_where (&file, &line);
|
as_where (&file, &line);
|
||||||
|
|
||||||
sb_new (&s);
|
sb_new (&s);
|
||||||
while (!is_end_of_line[(unsigned char) *input_line_pointer])
|
eol = find_end_of_line (input_line_pointer, 0);
|
||||||
sb_add_char (&s, *input_line_pointer++);
|
sb_add_buffer (&s, input_line_pointer, eol - input_line_pointer);
|
||||||
|
input_line_pointer = eol;
|
||||||
|
|
||||||
sb_new (&out);
|
sb_new (&out);
|
||||||
|
|
||||||
@ -2224,7 +2202,7 @@ s_lsym (int ignore ATTRIBUTE_UNUSED)
|
|||||||
if (name == p)
|
if (name == p)
|
||||||
{
|
{
|
||||||
as_bad (_("expected symbol name"));
|
as_bad (_("expected symbol name"));
|
||||||
discard_rest_of_line ();
|
ignore_rest_of_line ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2286,8 +2264,7 @@ s_lsym (int ignore ATTRIBUTE_UNUSED)
|
|||||||
static int
|
static int
|
||||||
get_line_sb (sb *line)
|
get_line_sb (sb *line)
|
||||||
{
|
{
|
||||||
char quote1, quote2, inquote;
|
char *eol;
|
||||||
unsigned char c;
|
|
||||||
|
|
||||||
if (input_line_pointer[-1] == '\n')
|
if (input_line_pointer[-1] == '\n')
|
||||||
bump_line_counters ();
|
bump_line_counters ();
|
||||||
@ -2299,45 +2276,16 @@ get_line_sb (sb *line)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
|
eol = find_end_of_line (input_line_pointer, flag_m68k_mri);
|
||||||
code needs to be changed. */
|
sb_add_buffer (line, input_line_pointer, eol - input_line_pointer);
|
||||||
if (!flag_m68k_mri)
|
input_line_pointer = eol;
|
||||||
quote1 = '"';
|
|
||||||
else
|
|
||||||
quote1 = '\0';
|
|
||||||
|
|
||||||
quote2 = '\0';
|
|
||||||
if (flag_m68k_mri)
|
|
||||||
quote2 = '\'';
|
|
||||||
#ifdef LEX_IS_STRINGQUOTE
|
|
||||||
quote2 = '\'';
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inquote = '\0';
|
|
||||||
|
|
||||||
while ((c = * input_line_pointer ++) != 0
|
|
||||||
&& (!is_end_of_line[c]
|
|
||||||
|| (inquote != '\0' && c != '\n')))
|
|
||||||
{
|
|
||||||
if (inquote == c)
|
|
||||||
inquote = '\0';
|
|
||||||
else if (inquote == '\0')
|
|
||||||
{
|
|
||||||
if (c == quote1)
|
|
||||||
inquote = quote1;
|
|
||||||
else if (c == quote2)
|
|
||||||
inquote = quote2;
|
|
||||||
}
|
|
||||||
|
|
||||||
sb_add_char (line, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't skip multiple end-of-line characters, because that breaks support
|
/* Don't skip multiple end-of-line characters, because that breaks support
|
||||||
for the IA-64 stop bit (;;) which looks like two consecutive end-of-line
|
for the IA-64 stop bit (;;) which looks like two consecutive end-of-line
|
||||||
characters but isn't. Instead just skip one end of line character and
|
characters but isn't. Instead just skip one end of line character and
|
||||||
return the character skipped so that the caller can re-insert it if
|
return the character skipped so that the caller can re-insert it if
|
||||||
necessary. */
|
necessary. */
|
||||||
return c;
|
return *input_line_pointer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define a macro. This is an interface to macro.c. */
|
/* Define a macro. This is an interface to macro.c. */
|
||||||
@ -2345,7 +2293,7 @@ get_line_sb (sb *line)
|
|||||||
void
|
void
|
||||||
s_macro (int ignore ATTRIBUTE_UNUSED)
|
s_macro (int ignore ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
char *file;
|
char *file, *eol;
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
sb s;
|
sb s;
|
||||||
const char *err;
|
const char *err;
|
||||||
@ -2354,8 +2302,9 @@ s_macro (int ignore ATTRIBUTE_UNUSED)
|
|||||||
as_where (&file, &line);
|
as_where (&file, &line);
|
||||||
|
|
||||||
sb_new (&s);
|
sb_new (&s);
|
||||||
while (!is_end_of_line[(unsigned char) *input_line_pointer])
|
eol = find_end_of_line (input_line_pointer, 0);
|
||||||
sb_add_char (&s, *input_line_pointer++);
|
sb_add_buffer (&s, input_line_pointer, eol - input_line_pointer);
|
||||||
|
input_line_pointer = eol;
|
||||||
|
|
||||||
if (line_label != NULL)
|
if (line_label != NULL)
|
||||||
{
|
{
|
||||||
@ -2877,7 +2826,7 @@ s_set (int equiv)
|
|||||||
if (name == end_name)
|
if (name == end_name)
|
||||||
{
|
{
|
||||||
as_bad (_("expected symbol name"));
|
as_bad (_("expected symbol name"));
|
||||||
discard_rest_of_line ();
|
ignore_rest_of_line ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3222,19 +3171,6 @@ ignore_rest_of_line (void)
|
|||||||
know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
|
know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
discard_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++;
|
|
||||||
|
|
||||||
/* Return pointing just after end-of-line. */
|
|
||||||
know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sets frag for given symbol to zero_address_frag, except when the
|
/* Sets frag for given symbol to zero_address_frag, except when the
|
||||||
symbol frag is already set to a dummy listing frag. */
|
symbol frag is already set to a dummy listing frag. */
|
||||||
|
|
||||||
@ -5298,11 +5234,7 @@ do_s_func (int end_p, const char *default_prefix)
|
|||||||
void
|
void
|
||||||
s_ignore (int arg ATTRIBUTE_UNUSED)
|
s_ignore (int arg ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
while (!is_end_of_line[(unsigned char) *input_line_pointer])
|
ignore_rest_of_line ();
|
||||||
{
|
|
||||||
++input_line_pointer;
|
|
||||||
}
|
|
||||||
++input_line_pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -5340,3 +5272,51 @@ input_scrub_insert_file (char *path)
|
|||||||
input_scrub_include_file (path, input_line_pointer);
|
input_scrub_include_file (path, input_line_pointer);
|
||||||
buffer_limit = input_scrub_next_buffer (&input_line_pointer);
|
buffer_limit = input_scrub_next_buffer (&input_line_pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find the end of a line, considering quotation and escaping of quotes. */
|
||||||
|
|
||||||
|
#if !defined(TC_SINGLE_QUOTE_STRINGS) && defined(SINGLE_QUOTE_STRINGS)
|
||||||
|
# define TC_SINGLE_QUOTE_STRINGS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_find_end_of_line (char *s, int mri_string, int insn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
char inquote = '\0';
|
||||||
|
int inescape = 0;
|
||||||
|
|
||||||
|
while (!is_end_of_line[(unsigned char) *s]
|
||||||
|
|| (inquote && !ISCNTRL (*s))
|
||||||
|
|| (inquote == '\'' && flag_mri)
|
||||||
|
#ifdef TC_EOL_IN_INSN
|
||||||
|
|| (insn && TC_EOL_IN_INSN (s))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (mri_string && *s == '\'')
|
||||||
|
inquote ^= *s;
|
||||||
|
else if (inescape)
|
||||||
|
inescape = 0;
|
||||||
|
else if (*s == '\\')
|
||||||
|
inescape = 1;
|
||||||
|
else if (!inquote
|
||||||
|
? *s == '"'
|
||||||
|
#ifdef TC_SINGLE_QUOTE_STRINGS
|
||||||
|
|| (TC_SINGLE_QUOTE_STRINGS && *s == '\'')
|
||||||
|
#endif
|
||||||
|
: *s == inquote)
|
||||||
|
inquote ^= *s;
|
||||||
|
++s;
|
||||||
|
}
|
||||||
|
if (inquote)
|
||||||
|
as_warn (_("missing closing `%c'"), inquote);
|
||||||
|
if (inescape)
|
||||||
|
as_warn (_("stray `\\'"));
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
find_end_of_line (char *s, int mri_string)
|
||||||
|
{
|
||||||
|
return _find_end_of_line (s, mri_string, 0);
|
||||||
|
}
|
||||||
|
@ -56,6 +56,7 @@ extern char lex_type[];
|
|||||||
extern char is_end_of_line[];
|
extern char is_end_of_line[];
|
||||||
|
|
||||||
extern int is_it_end_of_statement (void);
|
extern int is_it_end_of_statement (void);
|
||||||
|
extern char *find_end_of_line (char *, int);
|
||||||
|
|
||||||
extern int target_big_endian;
|
extern int target_big_endian;
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ extern void emit_expr (expressionS *exp, unsigned int nbytes);
|
|||||||
extern void equals (char *sym_name, int reassign);
|
extern void equals (char *sym_name, int reassign);
|
||||||
extern void float_cons (int float_type);
|
extern void float_cons (int float_type);
|
||||||
extern void ignore_rest_of_line (void);
|
extern void ignore_rest_of_line (void);
|
||||||
extern void discard_rest_of_line (void);
|
#define discard_rest_of_line ignore_rest_of_line
|
||||||
extern int output_leb128 (char *, valueT, int sign);
|
extern int output_leb128 (char *, valueT, int sign);
|
||||||
extern void pseudo_set (symbolS * symbolP);
|
extern void pseudo_set (symbolS * symbolP);
|
||||||
extern void read_a_source_file (char *name);
|
extern void read_a_source_file (char *name);
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2005-05-17 Jan Beulich <jbeulich@novell.com>
|
||||||
|
|
||||||
|
* gas/mmix/err-byte1.s: Adjust expected error text on line 10.
|
||||||
|
|
||||||
2005-05-17 Nick Clifton <nickc@redhat.com>
|
2005-05-17 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* gas/v850/split-lo16.s: Add test for a lo() pseudo reloc
|
* gas/v850/split-lo16.s: Add test for a lo() pseudo reloc
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
% { dg-do assemble { target mmix-*-* } }
|
% { dg-do assemble { target mmix-*-* } }
|
||||||
% { dg-error "unterminated string" "" { target mmix-*-* } 10 }
|
% { dg-error "unterminated string|missing closing" "" { target mmix-*-* } 10 }
|
||||||
% { dg-bogus "end of file" "" { xfail mmix-*-* } 0 }
|
% { dg-bogus "end of file" "" { xfail mmix-*-* } 0 }
|
||||||
|
|
||||||
# Note that the error is detected in the preformatter, before the text
|
# Note that the error is detected in the preformatter, before the text
|
||||||
|
Loading…
Reference in New Issue
Block a user