static int hex_float (int, char *);
static segT get_known_segmented_expression (expressionS * expP);
static void pobegin (void);
-static int get_line_sb (sb *);
+static int get_non_macro_line_sb (sb *);
static void generate_file_debug (void);
-static char *_find_end_of_line (char *, int, int);
+static char *_find_end_of_line (char *, int, int, int);
\f
void
read_begin (void)
#define HANDLE_CONDITIONAL_ASSEMBLY() \
if (ignore_input ()) \
{ \
- char *eol = find_end_of_line (input_line_pointer, flag_m68k_mri); \
+ char *eol = find_end_of_line (input_line_pointer, flag_m68k_mri); \
input_line_pointer = (input_line_pointer <= buffer_limit \
&& eol >= buffer_limit) \
? buffer_limit \
/* WARNING: c has char, which may be end-of-line. */
/* Also: input_line_pointer->`\0` where c was. */
*input_line_pointer = c;
- input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1);
+ input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1, 0);
c = *input_line_pointer;
*input_line_pointer = '\0';
sb_new (&out);
- err = expand_irp (irpc, 0, &s, &out, get_line_sb);
+ err = expand_irp (irpc, 0, &s, &out, get_non_macro_line_sb);
if (err != NULL)
as_bad_where (file, line, "%s", err);
or zero if there are no more lines. */
static int
-get_line_sb (sb *line)
+get_line_sb (sb *line, int in_macro)
{
char *eol;
return 0;
}
- eol = find_end_of_line (input_line_pointer, flag_m68k_mri);
+ eol = _find_end_of_line (input_line_pointer, flag_m68k_mri, 0, in_macro);
sb_add_buffer (line, input_line_pointer, eol - input_line_pointer);
input_line_pointer = eol;
return *input_line_pointer++;
}
+static int
+get_non_macro_line_sb (sb *line)
+{
+ return get_line_sb (line, 0);
+}
+
+static int
+get_macro_line_sb (sb *line)
+{
+ return get_line_sb (line, 1);
+}
+
/* Define a macro. This is an interface to macro.c. */
void
sb_new (&label);
sb_add_string (&label, S_GET_NAME (line_label));
- err = define_macro (0, &s, &label, get_line_sb, file, line, &name);
+ err = define_macro (0, &s, &label, get_macro_line_sb, file, line, &name);
sb_kill (&label);
}
else
- err = define_macro (0, &s, NULL, get_line_sb, file, line, &name);
+ err = define_macro (0, &s, NULL, get_macro_line_sb, file, line, &name);
if (err != NULL)
as_bad_where (file, line, err, name);
else
sb many;
sb_new (&one);
- if (!buffer_and_nest (start, end, &one, get_line_sb))
+ if (!buffer_and_nest (start, end, &one, get_non_macro_line_sb))
{
as_bad (_("%s without %s"), start, end);
return;
#endif
static char *
-_find_end_of_line (char *s, int mri_string, int insn ATTRIBUTE_UNUSED)
+_find_end_of_line (char *s, int mri_string, int insn ATTRIBUTE_UNUSED,
+ int in_macro)
{
char inquote = '\0';
int inescape = 0;
#ifdef TC_EOL_IN_INSN
|| (insn && TC_EOL_IN_INSN (s))
#endif
+ /* PR 6926: When we are parsing the body of a macro the sequence
+ \@ is special - it refers to the invocation count. If the @
+ character happens to be registered as a line-separator character
+ by the target, then the is_end_of_line[] test above will have
+ returned true, but we need to ignore the line separating
+ semantics in this particular case. */
+ || (in_macro && inescape && *s == '@')
)
{
if (mri_string && *s == '\'')
char *
find_end_of_line (char *s, int mri_string)
{
- return _find_end_of_line (s, mri_string, 0);
+ return _find_end_of_line (s, mri_string, 0, 0);
}