aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2014-12-03 17:50:06 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2014-12-03 17:50:06 +0000
commit48749dbcc461753861059d1fc48c40d2e0aefaa2 (patch)
treeffa63d8c289a7c4e01689478d728abff9b4c33ab /gcc/fortran/expr.c
parentd6d34aa9133afdee0ca74b354a72cb720f431c1a (diff)
downloadgcc-48749dbcc461753861059d1fc48c40d2e0aefaa2.zip
gcc-48749dbcc461753861059d1fc48c40d2e0aefaa2.tar.gz
gcc-48749dbcc461753861059d1fc48c40d2e0aefaa2.tar.bz2
re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color)
gcc/testsuite/ChangeLog: 2014-12-03 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * gfortran.dg/warnings_are_errors_1.f90: Update warnings to errors. * gfortran.dg/warnings_are_errors_1.f: Likewise. gcc/fortran/ChangeLog: 2014-12-03 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * gfortran.h (gfc_warning): Now returns bool. Add overload that accepts opt. (gfc_warning_1): Declare. * error.c (pp_warning_buffer,warningcount_buffered,werrorcount_buffered): New. (gfc_buffer_error): Set pp_warning_buffer.flush_p. (gfc_clear_pp_buffer): New. (gfc_warning_1): Renamed from gfc_warning. (gfc_warning): Add three new overloads. One that takes just a format string and ellipsis, another that takes also a warning option, and another that takes also va_list instead of ellipsis. (gfc_clear_warning): Clear pp_warning_buffer. (gfc_warning_check): Flush pp_warning_buffer and update warning and werror counters. (gfc_diagnostics_init): Init pp_warning_buffer. * Update all gfc_warning calls that do not multiple locations to use %qs and OPT_W*, otherwise use gfc_warning_1. gcc/ChangeLog: 2014-12-03 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * pretty-print.c (output_buffer::output_buffer): Init flush_p to true. (pp_flush): Flush only if flush_p. (pp_really_flush): New. * pretty-print.h (struct output_buffer): Add flush_p. (pp_really_flush): Declare. From-SVN: r218326
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 59f770c..edf8336 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3173,7 +3173,8 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
/* This is possibly a typo: x = f() instead of x => f(). */
if (warn_surprising
&& rvalue->expr_type == EXPR_FUNCTION && gfc_expr_attr (rvalue).pointer)
- gfc_warning ("POINTER-valued function appears on right-hand side of "
+ gfc_warning (OPT_Wsurprising,
+ "POINTER-valued function appears on right-hand side of "
"assignment at %L", &rvalue->where);
/* Check size of array assignments. */
@@ -3198,9 +3199,10 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
{
int rc;
if (warn_surprising)
- gfc_warning ("BOZ literal at %L is bitwise transferred "
- "non-integer symbol '%s'", &rvalue->where,
- lvalue->symtree->n.sym->name);
+ gfc_warning (OPT_Wsurprising,
+ "BOZ literal at %L is bitwise transferred "
+ "non-integer symbol %qs", &rvalue->where,
+ lvalue->symtree->n.sym->name);
if (!gfc_convert_boz (rvalue, &lvalue->ts))
return false;
if ((rc = gfc_range_check (rvalue)) != ARITH_OK)
@@ -3246,22 +3248,25 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
mpfr_sub (diff, rv, rvalue->value.real, GFC_RND_MODE);
if (!mpfr_zero_p (diff))
- gfc_warning ("Change of value in conversion from "
- " %s to %s at %L", gfc_typename (&rvalue->ts),
+ gfc_warning (OPT_Wconversion,
+ "Change of value in conversion from "
+ " %qs to %qs at %L", gfc_typename (&rvalue->ts),
gfc_typename (&lvalue->ts), &rvalue->where);
mpfr_clear (rv);
mpfr_clear (diff);
}
else
- gfc_warning ("Possible change of value in conversion from %s "
- "to %s at %L",gfc_typename (&rvalue->ts),
+ gfc_warning (OPT_Wconversion,
+ "Possible change of value in conversion from %qs "
+ "to %qs at %L", gfc_typename (&rvalue->ts),
gfc_typename (&lvalue->ts), &rvalue->where);
}
else if (warn_conversion_extra && lvalue->ts.kind > rvalue->ts.kind)
{
- gfc_warning ("Conversion from %s to %s at %L",
+ gfc_warning (OPT_Wconversion_extra,
+ "Conversion from %qs to %qs at %L",
gfc_typename (&rvalue->ts),
gfc_typename (&lvalue->ts), &rvalue->where);
}
@@ -3783,7 +3788,8 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
}
if (warn)
- gfc_warning ("Pointer at %L in pointer assignment might outlive the "
+ gfc_warning (OPT_Wtarget_lifetime,
+ "Pointer at %L in pointer assignment might outlive the "
"pointer target", &lvalue->where);
}