Please keep changes to arith-2.c and arith-3.c in sync. */
/* { dg-do preprocess } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fshow-column" } */
#include <limits.h>
# error /* { dg-bogus "error" } */
#endif
-#if -5 / (2 - 2) /* { dg-error "division by zero" } */
+#if -5 / (2 - 2) /* { dg-error "13:division by zero" } */
#endif
#if LONG_UDIVISION != LONG_UDIVISION_ANSWER
#endif
/* Binary %. Cannot overflow. */
-#if -5 % (2 - 2) /* { dg-error "division by zero" } */
+#if -5 % (2 - 2) /* { dg-error "13:division by zero" } */
#endif
#if TARG_MIN % 1 /* { dg-bogus "overflow" } */
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);
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;
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;
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;
}