expr.c (num_div_op): Take explicit location.

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.

From-SVN: r148662
parent 4c1a9016
2009-06-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc.dg/cpp/arith-3.c: Add column info.
2009-06-18 Sandra Loosemore <sandra@codesourcery.com> 2009-06-18 Sandra Loosemore <sandra@codesourcery.com>
* gcc.target/arm/fp16-compile-none-2.c: New. * gcc.target/arm/fp16-compile-none-2.c: New.
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
Please keep changes to arith-2.c and arith-3.c in sync. */ Please keep changes to arith-2.c and arith-3.c in sync. */
/* { dg-do preprocess } */ /* { dg-do preprocess } */
/* { dg-options "-std=c99" } */ /* { dg-options "-std=c99 -fshow-column" } */
#include <limits.h> #include <limits.h>
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
# error /* { dg-bogus "error" } */ # error /* { dg-bogus "error" } */
#endif #endif
#if -5 / (2 - 2) /* { dg-error "division by zero" } */ #if -5 / (2 - 2) /* { dg-error "13:division by zero" } */
#endif #endif
#if LONG_UDIVISION != LONG_UDIVISION_ANSWER #if LONG_UDIVISION != LONG_UDIVISION_ANSWER
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
#endif #endif
/* Binary %. Cannot overflow. */ /* Binary %. Cannot overflow. */
#if -5 % (2 - 2) /* { dg-error "division by zero" } */ #if -5 % (2 - 2) /* { dg-error "13:division by zero" } */
#endif #endif
#if TARG_MIN % 1 /* { dg-bogus "overflow" } */ #if TARG_MIN % 1 /* { dg-bogus "overflow" } */
......
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> 2009-06-17 Ian Lance Taylor <iant@google.com>
* include/cpplib.h (progname): Don't declare. * include/cpplib.h (progname): Don't declare.
......
...@@ -52,7 +52,8 @@ static cpp_num num_inequality_op (cpp_reader *, cpp_num, cpp_num, ...@@ -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, static cpp_num num_equality_op (cpp_reader *, cpp_num, cpp_num,
enum cpp_ttype); enum cpp_ttype);
static cpp_num num_mul (cpp_reader *, cpp_num, cpp_num); 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_lshift (cpp_num, size_t, size_t);
static cpp_num num_rshift (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) ...@@ -1123,7 +1124,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
case CPP_DIV: case CPP_DIV:
case CPP_MOD: case CPP_MOD:
top[-1].value = num_div_op (pfile, top[-1].value, 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; top[-1].loc = top->loc;
break; break;
...@@ -1668,10 +1669,13 @@ num_mul (cpp_reader *pfile, cpp_num lhs, cpp_num rhs) ...@@ -1668,10 +1669,13 @@ num_mul (cpp_reader *pfile, cpp_num lhs, cpp_num rhs)
return result; return result;
} }
/* Divide two preprocessing numbers, returning the answer or the /* Divide two preprocessing numbers, LHS and RHS, returning the answer
remainder depending upon OP. */ or the remainder depending upon OP. LOCATION is the source location
of this operator (for diagnostics). */
static cpp_num 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 result, sub;
cpp_num_part mask; cpp_num_part mask;
...@@ -1711,7 +1715,8 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op) ...@@ -1711,7 +1715,8 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
else else
{ {
if (!pfile->state.skip_eval) 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; return lhs;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment