summaryrefslogtreecommitdiffstats
path: root/libcpp
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-18 15:10:23 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-18 15:10:23 +0000
commit468215944c831d348db89e151c74a2f6df2df9cd (patch)
tree18edd293d0c14435ca25ef1e53b3051f9a051794 /libcpp
parentaca66fe1bec201950a3b1eb457df8a35fdf14cba (diff)
downloadppe42-gcc-468215944c831d348db89e151c74a2f6df2df9cd.tar.gz
ppe42-gcc-468215944c831d348db89e151c74a2f6df2df9cd.zip
2009-06-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
libcpp/ * expr.c (num_div_op): Take explicit location. testsuite/ * gcc.dg/cpp/arith-3.c: Add column info. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148662 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog4
-rw-r--r--libcpp/expr.c17
2 files changed, 15 insertions, 6 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index e6ef4c31b07..d7146588f09 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * expr.c (num_div_op): Take explicit location.
+
2009-06-17 Ian Lance Taylor <iant@google.com>
* include/cpplib.h (progname): Don't declare.
diff --git a/libcpp/expr.c b/libcpp/expr.c
index 6887b165690..96dd2fde24c 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -52,7 +52,8 @@ static cpp_num num_inequality_op (cpp_reader *, cpp_num, cpp_num,
static cpp_num num_equality_op (cpp_reader *, cpp_num, cpp_num,
enum cpp_ttype);
static cpp_num num_mul (cpp_reader *, cpp_num, cpp_num);
-static cpp_num num_div_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype);
+static cpp_num num_div_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype,
+ source_location);
static cpp_num num_lshift (cpp_num, size_t, size_t);
static cpp_num num_rshift (cpp_num, size_t, size_t);
@@ -1123,7 +1124,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
case CPP_DIV:
case CPP_MOD:
top[-1].value = num_div_op (pfile, top[-1].value,
- top->value, top->op);
+ top->value, top->op, top->loc);
top[-1].loc = top->loc;
break;
@@ -1668,10 +1669,13 @@ num_mul (cpp_reader *pfile, cpp_num lhs, cpp_num rhs)
return result;
}
-/* Divide two preprocessing numbers, returning the answer or the
- remainder depending upon OP. */
+/* Divide two preprocessing numbers, LHS and RHS, returning the answer
+ or the remainder depending upon OP. LOCATION is the source location
+ of this operator (for diagnostics). */
+
static cpp_num
-num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
+num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op,
+ source_location location)
{
cpp_num result, sub;
cpp_num_part mask;
@@ -1711,7 +1715,8 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
else
{
if (!pfile->state.skip_eval)
- cpp_error (pfile, CPP_DL_ERROR, "division by zero in #if");
+ cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0,
+ "division by zero in #if");
return lhs;
}
OpenPOWER on IntegriCloud