From patchwork Tue Feb 2 20:26:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janus Weil X-Patchwork-Id: 577587 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4754C140307 for ; Wed, 3 Feb 2016 07:26:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=FNA7Koo2; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=F6J9W+axdNJBt9WttpCIaPdHkuYlGTWI7DuwPWEAsZYcaV c1mDPlb7mQbCze64Tjm7iPYIroftaXRw8APFcPp1KB3YHQm21Krd03wi/zwb7i+k aalep6cuEehV9AfkHed3ELVuXd/+x+Agy7+BOmhwNxy1pseU5pKBMhhj9MMxY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=BF4McAUzjmfy5PG3rnMPbqflEQ4=; b=FNA7Koo2irq5bUCjrFle B9JECB3npIywWmNO3E9WsS9pQQdVHEJsbC+Vb4i8BtC4RlOYl0ld3d493IrD6QsV Afb6W/by3fFa/1eVVsdLW+SMSeDljoAJsb8fMj/n01VN1De95YaXUaolloQhGIjA zrar9h09ETbeRH47FmSUF2k= Received: (qmail 33707 invoked by alias); 2 Feb 2016 20:26:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 33677 invoked by uid 89); 2 Feb 2016 20:26:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL, BAYES_50, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=gfc_expr, expr_type, walker, sk:transla X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-yk0-f172.google.com Received: from mail-yk0-f172.google.com (HELO mail-yk0-f172.google.com) (209.85.160.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 02 Feb 2016 20:26:11 +0000 Received: by mail-yk0-f172.google.com with SMTP id z7so119390271yka.3; Tue, 02 Feb 2016 12:26:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:date:message-id:subject:from :to:content-type; bh=6vlM56vgbWIPwI1k2011eS3JnujbtZtmZG6HjgACwVo=; b=Bx3n3bKddnyzohFgKASKO4ZKF+JqShbafv9d4vk4R/cS5Cn741YW4PvI++l76Y3o1X a+TQZCt236cmpYiEqWyJX4zJ85Av9Y+MSiheXqK00asBpKC6lxIYGM82wLR43WGjgGk2 Bf++c8quzBoE5FEkNoYzNhqkTvr4Jw+dGrxZsTgCJeQW6LanX8bKaIIeHScwG29QdZq0 C46ER8/sqvzN0se9UeAxW2zlW+LqDWZi7tHwtPBB1/TPYnEq8p7LPq1RbgxZ+1YHH4OO VfkVFRypalorc1mNMG9wtxLLopYCBGml2BGDAF9jNFv95lJ0oYIJkHLdDCR6UeHkymGM bTmQ== X-Gm-Message-State: AG10YOS3VT4utWMFLeoCpC6KhUANtIf1iAlZUBi2OIpr4Vhq61CCf1/AF2gh2xM2OWgWfcH5yHknNS00tnJRFg== MIME-Version: 1.0 X-Received: by 10.37.19.65 with SMTP id 62mr22048345ybt.177.1454444768840; Tue, 02 Feb 2016 12:26:08 -0800 (PST) Received: by 10.129.78.203 with HTTP; Tue, 2 Feb 2016 12:26:08 -0800 (PST) Date: Tue, 2 Feb 2016 21:26:08 +0100 Message-ID: Subject: [Patch, Fortran] PR 69495: unused-label warning does not tell which flag triggered it From: Janus Weil To: gfortran , gcc-patches Hi all, here is a diagnostics patch, which makes sure that the responsible flag is printed in several warning messages (for which this was still missing). The only case that I'm not completely sure about is the hunk in intrinsic.c. In particular I was not able to trigger this warning and found no occurrence of it in the testsuite. Could someone check if the flag that I'm using there is correct, please? As a small extra the patch also mentions the -Wpedantic flag in the gfortran documentation. It regtests cleanly on x86_64-linux-gnu. Ok for trunk? Cheers, Janus 2016-02-01 Janus Weil 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. * intrinsic.c (gfc_check_intrinsic_standard): Ditto. * resolve.c (resolve_elemental_actual): Ditto. (resolve_operator): Ditto. (warn_unused_fortran_label): Ditto. * trans-common.c (translate_common): Ditto. 2016-02-01 Janus Weil PR fortran/69495 * gfortran.dg/elemental_optional_args_6.f90: Use -Wpedantic flag. Index: gcc/fortran/check.c =================================================================== --- gcc/fortran/check.c (Revision 233091) +++ gcc/fortran/check.c (Arbeitskopie) @@ -5180,9 +5180,9 @@ gfc_check_transfer (gfc_expr *source, gfc_expr *mo return true; if (source_size < result_size) - gfc_warning (0, "Intrinsic TRANSFER at %L has partly undefined result: " - "source size %ld < result size %ld", &source->where, - (long) source_size, (long) result_size); + 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); return true; } Index: gcc/fortran/frontend-passes.c =================================================================== --- gcc/fortran/frontend-passes.c (Revision 233091) +++ gcc/fortran/frontend-passes.c (Arbeitskopie) @@ -715,11 +715,11 @@ 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", - e->value.function.esym->name, &(e->where)); + 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", - e->value.function.isym->name, &(e->where)); + 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 elimination. This builds up the list of functions in the expression Index: gcc/fortran/intrinsic.c =================================================================== --- gcc/fortran/intrinsic.c (Revision 233091) +++ gcc/fortran/intrinsic.c (Arbeitskopie) @@ -4369,7 +4369,7 @@ gfc_check_intrinsic_standard (const gfc_intrinsic_ { /* Do only print a warning if not a GNU extension. */ if (!silent && isym->standard != GFC_STD_GNU) - gfc_warning (0, "Intrinsic %qs (is %s) is used at %L", + gfc_warning (OPT_Wintrinsics_std, "Intrinsic %qs (is %s) is used at %L", isym->name, _(symstd_msg), &where); return true; Index: gcc/fortran/invoke.texi =================================================================== --- gcc/fortran/invoke.texi (Revision 233091) +++ gcc/fortran/invoke.texi (Arbeitskopie) @@ -709,8 +709,10 @@ Check the code for syntax errors, but do not actua 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 Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (Revision 233091) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -2127,9 +2127,9 @@ resolve_elemental_actual (gfc_expr *expr, gfc_code && (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 " - "MISSING, it cannot be the actual argument of an " - "ELEMENTAL procedure unless there is a non-optional " + 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)", arg->expr->symtree->n.sym->name, &arg->expr->where); } @@ -3685,7 +3685,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); } } @@ -14890,12 +14891,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; Index: gcc/fortran/trans-common.c =================================================================== --- gcc/fortran/trans-common.c (Revision 233091) +++ gcc/fortran/trans-common.c (Arbeitskopie) @@ -1138,13 +1138,13 @@ translate_common (gfc_common_head *common, gfc_sym 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, Index: gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90 =================================================================== --- gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90 (Revision 233091) +++ gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90 (Arbeitskopie) @@ -1,4 +1,5 @@ ! { dg-do run } +! { dg-options "-Wpedantic" } ! ! PR fortran/53692 !