aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-10-06 08:17:47 +0000
committerNick Clifton <nickc@redhat.com>2008-10-06 08:17:47 +0000
commit7592cfd75db08f5ccbd4403ca80047c2f4540401 (patch)
tree1db132a1f2b9911d48d15958afa92c833bb3ba72 /gas
parente2232c63f487a77b9f64a9f36fae468393bec46a (diff)
downloadbinutils-7592cfd75db08f5ccbd4403ca80047c2f4540401.zip
binutils-7592cfd75db08f5ccbd4403ca80047c2f4540401.tar.gz
binutils-7592cfd75db08f5ccbd4403ca80047c2f4540401.tar.bz2
PR 6926
* read.c (get_line_sb): Renamed to get_non_macro_line_sb. (_find_end_of_line): Add extra parameter indicating if the line is inside a macro. If it is then do not allow the @ character to be treated as a line separator character. (read_a_source): Update use of _find_end_of_line. (find_end_of_line): Likewise. (s_irp): Update use of get_line_sb. (s_macro): Likewise. (do_repeat): Likewise. (get_line_sb): New function. Like the old version of get_line_sb except that it takes an extra parameter indicating whether the line is inside a macro. (get_macro_line_sb): New function.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog17
-rw-r--r--gas/read.c44
2 files changed, 49 insertions, 12 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 450a18f..502d2cb 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,20 @@
+2008-10-06 Nick Clifton <nickc@redhat.com>
+
+ PR 6926
+ * read.c (get_line_sb): Renamed to get_non_macro_line_sb.
+ (_find_end_of_line): Add extra parameter indicating if the line is
+ inside a macro. If it is then do not allow the @ character to be
+ treated as a line separator character.
+ (read_a_source): Update use of _find_end_of_line.
+ (find_end_of_line): Likewise.
+ (s_irp): Update use of get_line_sb.
+ (s_macro): Likewise.
+ (do_repeat): Likewise.
+ (get_line_sb): New function. Like the old version of get_line_sb
+ except that it takes an extra parameter indicating whether the
+ line is inside a macro.
+ (get_macro_line_sb): New function.
+
2008-10-04 Hans-Peter Nilsson <hp@axis.com>
* config/tc-cris.c: Update all comments regarding explicit relocations
diff --git a/gas/read.c b/gas/read.c
index ec69c4e..db801bc 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -220,9 +220,9 @@ static void s_reloc (int);
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);
void
read_begin (void)
@@ -530,7 +530,7 @@ pobegin (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 \
@@ -923,7 +923,7 @@ read_a_source_file (char *name)
/* 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';
@@ -2178,7 +2178,7 @@ s_irp (int irpc)
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);
@@ -2468,7 +2468,7 @@ s_lsym (int ignore ATTRIBUTE_UNUSED)
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;
@@ -2482,7 +2482,7 @@ get_line_sb (sb *line)
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;
@@ -2494,6 +2494,18 @@ get_line_sb (sb *line)
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
@@ -2518,11 +2530,11 @@ s_macro (int ignore ATTRIBUTE_UNUSED)
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
@@ -2928,7 +2940,7 @@ do_repeat (int count, const char *start, const char *end)
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;
@@ -5780,7 +5792,8 @@ input_scrub_insert_file (char *path)
#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;
@@ -5791,6 +5804,13 @@ _find_end_of_line (char *s, int mri_string, int insn ATTRIBUTE_UNUSED)
#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 == '\'')
@@ -5818,5 +5838,5 @@ _find_end_of_line (char *s, int mri_string, int insn ATTRIBUTE_UNUSED)
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);
}