aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-05-06 11:01:48 +0000
committerNick Clifton <nickc@redhat.com>2004-05-06 11:01:48 +0000
commite59763172f0ba262bc2b0452db6fb816c457bba3 (patch)
tree3dbbd1d7f9491655b38ef50a0b936f2b94be763d /gas/config
parent41cf0c62851dd766a7c2558c396a7babdc657d86 (diff)
downloadgdb-e59763172f0ba262bc2b0452db6fb816c457bba3.zip
gdb-e59763172f0ba262bc2b0452db6fb816c457bba3.tar.gz
gdb-e59763172f0ba262bc2b0452db6fb816c457bba3.tar.bz2
Remove duplicate code and provide a function for generating internally consistent 'value out of range' messages
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-alpha.c12
-rw-r--r--gas/config/tc-arc.c12
-rw-r--r--gas/config/tc-mn10200.c12
-rw-r--r--gas/config/tc-mn10300.c12
-rw-r--r--gas/config/tc-ppc.c9
-rw-r--r--gas/config/tc-s390.c12
-rw-r--r--gas/config/tc-v850.c19
7 files changed, 13 insertions, 75 deletions
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 9360047..7e553fb 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -2373,17 +2373,7 @@ insert_operand (insn, operand, val, file, line)
}
if (val < min || val > max)
- {
- const char *err =
- _("operand out of range (%s not between %d and %d)");
- char buf[sizeof (val) * 3 + 2];
-
- sprint_value (buf, val);
- if (file)
- as_warn_where (file, line, err, buf, min, max);
- else
- as_warn (err, buf, min, max);
- }
+ as_warn_value_out_of_range (_("operand"), val, min, max, file, line);
}
if (operand->insert)
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 60cfa34..be1e93c 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -328,17 +328,7 @@ arc_insert_operand (insn, operand, mods, reg, val, file, line)
test = val;
if (test < (offsetT) min || test > (offsetT) max)
- {
- const char *err =
- "operand out of range (%s not between %ld and %ld)";
- char buf[100];
-
- sprint_value (buf, test);
- if (file == (char *) NULL)
- as_warn (err, buf, min, max);
- else
- as_warn_where (file, line, err, buf, min, max);
- }
+ as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line);
}
if (operand->insert)
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 6420694..64dd099 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -1342,17 +1342,7 @@ mn10200_insert_operand (insnp, extensionp, operand, val, file, line, shift)
test = val;
if (test < (offsetT) min || test > (offsetT) max)
- {
- const char *err =
- _("operand out of range (%s not between %ld and %ld)");
- char buf[100];
-
- sprint_value (buf, test);
- if (file == (char *) NULL)
- as_warn (err, buf, min, max);
- else
- as_warn_where (file, line, err, buf, min, max);
- }
+ as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line);
}
if ((operand->flags & MN10200_OPERAND_EXTENDED) == 0)
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index 8324646..36e6a05 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -2584,17 +2584,7 @@ mn10300_insert_operand (insnp, extensionp, operand, val, file, line, shift)
test = val;
if (test < (offsetT) min || test > (offsetT) max)
- {
- const char *err =
- _("operand out of range (%s not between %ld and %ld)");
- char buf[100];
-
- sprint_value (buf, test);
- if (file == (char *) NULL)
- as_warn (err, buf, min, max);
- else
- as_warn_where (file, line, err, buf, min, max);
- }
+ as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line);
}
if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 66366a5..fe66d2b 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1457,14 +1457,7 @@ ppc_insert_operand (insn, operand, val, file, line)
test = val;
if (test < (offsetT) min || test > (offsetT) max)
- {
- const char *err =
- _("operand out of range (%s not between %ld and %ld)");
- char buf[100];
-
- sprint_value (buf, test);
- as_bad_where (file, line, err, buf, min, max);
- }
+ as_bad_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line);
}
if (operand->insert)
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 4fafbec..2cb8cf1 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -601,21 +601,15 @@ s390_insert_operand (insn, operand, val, file, line)
/* Check for underflow / overflow. */
if (uval < min || uval > max)
{
- const char *err =
- "operand out of range (%s not between %ld and %ld)";
- char buf[100];
-
if (operand->flags & S390_OPERAND_LENGTH)
{
uval++;
min++;
max++;
}
- sprint_value (buf, uval);
- if (file == (char *) NULL)
- as_bad (err, buf, (int) min, (int) max);
- else
- as_bad_where (file, line, err, buf, (int) min, (int) max);
+
+ as_bad_value_out_of_range (_("operand"), uval, (offsetT) min, (offsetT) max, file, line);
+
return;
}
}
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index d53a973..b1085ac 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -1618,10 +1618,7 @@ v850_insert_operand (insn, operand, val, file, line, str)
if (val < (offsetT) min || val > (offsetT) max)
{
- /* xgettext:c-format */
- const char *err =
- _("operand out of range (%s not between %ld and %ld)");
- char buf[100];
+ char buf [128];
/* Restore min and mix to expected values for decimal ranges. */
if ((operand->flags & V850_OPERAND_SIGNED)
@@ -1633,18 +1630,12 @@ v850_insert_operand (insn, operand, val, file, line, str)
min = 0;
if (str)
- {
- sprintf (buf, "%s: ", str);
-
- sprint_value (buf + strlen (buf), val);
- }
+ sprintf (buf, "%s: ", str);
else
- sprint_value (buf, val);
+ buf[0] = 0;
+ strcat (buf, _("operand"));
- if (file == (char *) NULL)
- as_warn (err, buf, min, max);
- else
- as_warn_where (file, line, err, buf, min, max);
+ as_bad_value_out_of_range (buf, val, (offsetT) min, (offsetT) max, file, line);
}
}