From patchwork Sun Sep 13 23:45:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= X-Patchwork-Id: 517247 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 858E41401AD for ; Mon, 14 Sep 2015 09:46:46 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=HImRC/VG; 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:from:date:message-id:subject:to:content-type; q= dns; s=default; b=Ump6G9V+QlPNfuA/5TscKKbQ4fqjOiWxpDFdEAUKESv/tK 0K6CCaOdPTscxb7LGa6H9rpLyFXlQagcyen4zc3VKpZL0k0N6ypl2PBnLc89YFou mseaw2RvqSXxSFch2RVFXmQxRk0vyV6G0LLCJ7od0ZTZ63/qYbXe+QWR+Y3b4= 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:from:date:message-id:subject:to:content-type; s= default; bh=lkpMxYPPcKllRDmr5HHUfSRG7QA=; b=HImRC/VGHsjrYBteNgxV YPKkVrDjpdHCyxhyA6XQ6FmC54Jqnr8QAVHKrMau3PbO2/NmHk5FMvpYh3K9tvqU mjxKOZVUnFvrsplHjBswjiIrtNWazRwZqIaemkpzAGJdyBjdMxVBWOpibFFJT2Cm UKanM0FOMGVxfkbspqE9QOo= Received: (qmail 91031 invoked by alias); 13 Sep 2015 23:46:38 -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 91007 invoked by uid 89); 13 Sep 2015 23:46:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wi0-f179.google.com Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 13 Sep 2015 23:46:36 +0000 Received: by wicfx3 with SMTP id fx3so119462895wic.1; Sun, 13 Sep 2015 16:46:31 -0700 (PDT) X-Received: by 10.180.85.164 with SMTP id i4mr20993576wiz.54.1442187991333; Sun, 13 Sep 2015 16:46:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.186.214 with HTTP; Sun, 13 Sep 2015 16:45:51 -0700 (PDT) From: =?UTF-8?B?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= Date: Mon, 14 Sep 2015 01:45:51 +0200 Message-ID: Subject: [PATCH diagnostics/67460] Replace some_warnings_are_errors with diagnostic_kind_count (context, DK_WERROR) To: Gcc Patch List , "fortran@gcc.gnu.org List" , Jason Merrill , "Joseph S. Myers" , Dodji Seketeli The flag diagnostic_context::some_warnings_are_errors controls whether to give the message "all warnings being treated as errors". However, when warnings are buffered and then discarded, this flag is not reset. It turns out we do not need this flag at all, since we already count explicitly how many warnings were converted into errors, and this number is kept up to date for the buffered diagnostics used by Fortran. Bootstrapped & tested on x86_64-linux-gnu with --enable-languages=c,c++,objc,fortran,ada,obj-c++ OK? gcc/ChangeLog: 2015-09-14 Manuel López-Ibáñez PR fortran/67460 * diagnostic.c (diagnostic_initialize): Do not set some_warnings_are_errors. (diagnostic_finish): Use DK_WERROR count instead. (diagnostic_report_diagnostic): Do not set some_warnings_are_errors. * diagnostic.h (struct diagnostic_context): Remove some_warnings_are_errors. gcc/testsuite/ChangeLog: 2015-09-14 Manuel López-Ibáñez PR fortran/67460 * gfortran.dg/pr67460.f90: New test. Index: gcc/diagnostic.c =================================================================== --- gcc/diagnostic.c (revision 227717) +++ gcc/diagnostic.c (working copy) @@ -135,11 +135,10 @@ diagnostic_initialize (diagnostic_contex much more elaborated pretty-printer if they wish. */ context->printer = XNEW (pretty_printer); new (context->printer) pretty_printer (); memset (context->diagnostic_count, 0, sizeof context->diagnostic_count); - context->some_warnings_are_errors = false; context->warning_as_error_requested = false; context->n_opts = n_opts; context->classify_diagnostic = XNEWVEC (diagnostic_t, n_opts); for (i = 0; i < n_opts; i++) context->classify_diagnostic[i] = DK_UNSPECIFIED; @@ -202,11 +201,11 @@ diagnostic_color_init (diagnostic_contex void diagnostic_finish (diagnostic_context *context) { /* Some of the errors may actually have been warnings. */ - if (context->some_warnings_are_errors) + if (diagnostic_kind_count (context, DK_WERROR)) { /* -Werror was given. */ if (context->warning_as_error_requested) pp_verbatim (context->printer, _("%s: all warnings being treated as errors"), @@ -859,13 +858,10 @@ diagnostic_report_diagnostic (diagnostic warnings for ranges of source code. */ if (diagnostic->kind == DK_IGNORED) return false; } - if (orig_diag_kind == DK_WARNING && diagnostic->kind == DK_ERROR) - context->some_warnings_are_errors = true; - context->lock++; if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT) { #ifndef ENABLE_CHECKING Index: gcc/diagnostic.h =================================================================== --- gcc/diagnostic.h (revision 227717) +++ gcc/diagnostic.h (working copy) @@ -64,14 +64,10 @@ struct diagnostic_context pretty_printer *printer; /* The number of times we have issued diagnostics. */ int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND]; - /* True if we should display the "warnings are being tread as error" - message, usually displayed once per compiler run. */ - bool some_warnings_are_errors; - /* True if it has been requested that warnings be treated as errors. */ bool warning_as_error_requested; /* The number of option indexes that can be passed to warning() et al. */ Index: gcc/testsuite/gfortran.dg/pr67460.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr67460.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/pr67460.f90 (revision 0) @@ -0,0 +1,24 @@ +! Bogus "all warnings being treated as errors" +! { dg-do compile } +! { dg-options "-std=f2003 -Werror" } +MODULE btree_i8_k_sp2d_v + TYPE btree_node + INTEGER id + TYPE(btree_node_p), DIMENSION(:), POINTER :: subtrees + TYPE(btree_node), POINTER :: parent + END TYPE btree_node + TYPE btree_node_p + TYPE(btree_node), POINTER :: node + END TYPE btree_node_p +CONTAINS + RECURSIVE SUBROUTINE btree_verify_node (tree, node, level, nids, lastv,& + count, num_nodes, max_leaf_level, min_leaf_level, printing) + TYPE(btree_node), INTENT(IN) :: node + INTEGER :: branch + IF (ASSOCIATED (node%subtrees(branch)%node)) THEN + IF (node%subtrees(branch)%node%parent%id .NE. node%id) THEN + WRITE(*,*)'foo' + ENDIF + ENDIF + END SUBROUTINE btree_verify_node +END MODULE btree_i8_k_sp2d_v