From 28ce22e6cb59383f14dd41bf39e22a3a2c0529ad Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sat, 5 Nov 2016 11:35:23 +0100 Subject: [PATCH] re PR fortran/69495 (unused-label warning does not tell which flag triggered it) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2016-11-05 Janus Weil Manuel Lopez-Ibanez PR fortran/69495 * invoke.texi: Mention -Wpedantic as an alias of -pedantic. * check.c (gfc_check_transfer): Mention responsible flag in warning message. * frontend-passes.c (do_warn_function_elimination): Ditto. * resolve.c (resolve_elemental_actual): Ditto. (resolve_operator): Ditto. (warn_unused_fortran_label): Ditto. * trans-common.c (translate_common): Ditto. 2016-11-05 Janus Weil Dominique d'Humieres PR fortran/69495 * gfortran.dg/elemental_optional_args_6.f90: Use -Wpedantic flag. Co-Authored-By: Dominique d'Humieres Co-Authored-By: Manuel López-Ibáñez From-SVN: r241870 --- gcc/fortran/ChangeLog | 13 +++++++++++++ gcc/fortran/check.c | 3 ++- gcc/fortran/frontend-passes.c | 6 ++++-- gcc/fortran/invoke.texi | 4 +++- gcc/fortran/resolve.c | 13 ++++++++----- gcc/fortran/trans-common.c | 4 ++-- gcc/testsuite/ChangeLog | 6 ++++++ .../gfortran.dg/elemental_optional_args_6.f90 | 1 + 8 files changed, 39 insertions(+), 11 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bf85619bcc9..10aaff86c64 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,16 @@ +2016-11-05 Janus Weil + Manuel Lopez-Ibanez + + PR fortran/69495 + * invoke.texi: Mention -Wpedantic as an alias of -pedantic. + * check.c (gfc_check_transfer): Mention responsible flag in warning + message. + * frontend-passes.c (do_warn_function_elimination): Ditto. + * resolve.c (resolve_elemental_actual): Ditto. + (resolve_operator): Ditto. + (warn_unused_fortran_label): Ditto. + * trans-common.c (translate_common): Ditto. + 2016-11-05 Paul Thomas PR fortran/67564 diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index ff5e80b9df5..5057d4999fd 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -5187,7 +5187,8 @@ gfc_check_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size) return true; if (source_size < result_size) - gfc_warning (0, "Intrinsic TRANSFER at %L has partly undefined result: " + gfc_warning (OPT_Wsurprising, + "Intrinsic TRANSFER at %L has partly undefined result: " "source size %ld < result size %ld", &source->where, (long) source_size, (long) result_size); diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index e61673fc6e4..1ad797b579c 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -747,10 +747,12 @@ do_warn_function_elimination (gfc_expr *e) if (e->expr_type != EXPR_FUNCTION) return; if (e->value.function.esym) - gfc_warning (0, "Removing call to function %qs at %L", + gfc_warning (OPT_Wfunction_elimination, + "Removing call to function %qs at %L", e->value.function.esym->name, &(e->where)); else if (e->value.function.isym) - gfc_warning (0, "Removing call to function %qs at %L", + gfc_warning (OPT_Wfunction_elimination, + "Removing call to function %qs at %L", e->value.function.isym->name, &(e->where)); } /* Callback function for the code walker for doing common function diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 83fdf012f92..39a0232f71a 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -749,8 +749,10 @@ Check the code for syntax errors, but do not actually compile it. This will generate module files for each module present in the code, but no other output file. -@item -pedantic +@item -Wpedantic +@itemx -pedantic @opindex @code{pedantic} +@opindex @code{Wpedantic} Issue warnings for uses of extensions to Fortran 95. @option{-pedantic} also applies to C-language constructs where they occur in GNU Fortran source files, such as use of @samp{\e} in a diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 14685d274d2..4e245cff5b2 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -2140,7 +2140,8 @@ resolve_elemental_actual (gfc_expr *expr, gfc_code *c) && (set_by_optional || arg->expr->rank != rank) && !(isym && isym->id == GFC_ISYM_CONVERSION)) { - gfc_warning (0, "%qs at %L is an array and OPTIONAL; IF IT IS " + gfc_warning (OPT_Wpedantic, + "%qs at %L is an array and OPTIONAL; IF IT IS " "MISSING, it cannot be the actual argument of an " "ELEMENTAL procedure unless there is a non-optional " "argument with the same rank (12.4.1.5)", @@ -3811,7 +3812,8 @@ resolve_operator (gfc_expr *e) else msg = "Inequality comparison for %s at %L"; - gfc_warning (0, msg, gfc_typename (&op1->ts), &op1->where); + gfc_warning (OPT_Wcompare_reals, msg, + gfc_typename (&op1->ts), &op1->where); } } @@ -15393,12 +15395,13 @@ warn_unused_fortran_label (gfc_st_label *label) switch (label->referenced) { case ST_LABEL_UNKNOWN: - gfc_warning (0, "Label %d at %L defined but not used", label->value, - &label->where); + gfc_warning (OPT_Wunused_label, "Label %d at %L defined but not used", + label->value, &label->where); break; case ST_LABEL_BAD_TARGET: - gfc_warning (0, "Label %d at %L defined but cannot be used", + gfc_warning (OPT_Wunused_label, + "Label %d at %L defined but cannot be used", label->value, &label->where); break; diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index ee12fa22dc0..0c030584b68 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -1149,13 +1149,13 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list) if (warn_align_commons) { if (strcmp (common->name, BLANK_COMMON_NAME)) - gfc_warning (0, + gfc_warning (OPT_Walign_commons, "Padding of %d bytes required before %qs in " "COMMON %qs at %L; reorder elements or use " "-fno-align-commons", (int)offset, s->sym->name, common->name, &common->where); else - gfc_warning (0, + gfc_warning (OPT_Walign_commons, "Padding of %d bytes required before %qs in " "COMMON at %L; reorder elements or use " "-fno-align-commons", (int)offset, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4369222f1d4..7d3537dc690 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-11-05 Janus Weil + Dominique d'Humieres + + PR fortran/69495 + * gfortran.dg/elemental_optional_args_6.f90: Use -Wpedantic flag. + 2016-11-05 Paul Thomas PR fortran/67564 diff --git a/gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90 b/gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90 index ad1c252fb00..2dece646dde 100644 --- a/gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90 +++ b/gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90 @@ -1,4 +1,5 @@ ! { dg-do run } +! { dg-options "-Wpedantic" } ! ! PR fortran/53692 ! -- 2.30.2