From patchwork Sat Nov 15 11:13:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 411164 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 858451400A0 for ; Sat, 15 Nov 2014 22:13:26 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=tm/ySg0wcxscSPM+4 07gGQ9f9f4JGNW98hVcmdpCXOlL69veZXpEOI/YmeYdicUqDn1kVi18oeFpsnyNe U1u2DDdVC+7nUnXK2jd+oMuwDLe1Sy/AQz8txji0LVm/0P4Pi/Y1O4f9bJUu0EUN i8AkDHdK0kypqVm0dgLzAz6Vwg= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=ULA+wknXdYc4NcpG7n3NdZH oNN8=; b=L6OxR8vh+1GCQ0nOidLyUsYwXN9DvJ3tD1V/uKSxf5+pwUnFRqCN2y3 y1ldiNmwRx2iVOKKfltIdXzhTfA7EvxzIS0eJY7zg7/i6jQoIQrkCNFNV73ySg7u xfNChD8nRyBDPPYqF+0SXufYWA+deNh7YIHrkD/YHXG/+HPUMU8E= Received: (qmail 792 invoked by alias); 15 Nov 2014 11:13:18 -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 772 invoked by uid 89); 15 Nov 2014 11:13:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx02.qsc.de Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 15 Nov 2014 11:13:13 +0000 Received: from tux.net-b.de (port-92-194-240-118.dynamic.qsc.de [92.194.240.118]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPSA id 5F2A124F87; Sat, 15 Nov 2014 12:13:09 +0100 (CET) Message-ID: <54673545.5070802@net-b.de> Date: Sat, 15 Nov 2014 12:13:09 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: FX CC: gcc-patches , gfortran , =?UTF-8?B?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= Subject: Re: [Patch, Fortran] Convert gfc_fatal_error to common diagnostics References: <54671B84.50807@net-b.de> <3D3E8845-F5FB-40CA-B86C-42A4E0AC3B66@gmail.com> In-Reply-To: <3D3E8845-F5FB-40CA-B86C-42A4E0AC3B66@gmail.com> FX wrote: > Please document, in the source, the difference between gfc_fatal_error > and gfc_fatal_error_1. They currently have the same generic > description, which wouldn’t help people writing new front-end code to > know which one to use. Moreover, if the transition will not be > complete soon (or indeterminate), it should be added to the wiki’s > list of partial transitions. Well, the diagnostics conversion is on going and was only delayed due to delays of reviewing the line-map part of last patch. (That part was required for %C support; the last patch added the _2 variants for gfc_error_now/gfc_warning_now.) In any case, the support for %L should be ready soon. When that's in, there won't be any need for gfc*_error*/gfc*_warning* duplication any more. Support for buffered output (and discarding it), will take a bit longer – but is also planed for GCC 5. This support is required for gfc_error/gfc_warning and, hence, for most diagnostic output. Thus, I don't think it should be put into the wiki. (Admittedly, I also do not know which page you are referring to.) In any case, there are several PRs about issues fixed by the on-going change to the common diagnostics. When that's done, there are still additional task for diagnostic improvements left (see PRs), all which required the common diagnostic in place. > Other than that, OK, and thanks for doing this tedious work. Thanks for the review! For the diagnostic changes, you have mainly to thank Manuel, who is the driving force behind all diagnositic work (C, C++) and who did the lion share of the Fortran front end work (including the required changes in the common part). Tobias PS: Attached is the error.c part of the committed patch (r217600); I added a few lines above the functions _2/_1 to make clear when to use them. I hope that we can soon remove the old version. Index: gcc/fortran/error.c =================================================================== --- gcc/fortran/error.c (Revision 217599) +++ gcc/fortran/error.c (Arbeitskopie) @@ -933,6 +933,7 @@ gfc_notify_std (int std, const char *gmsgid, ...) /* Immediate warning (i.e. do not buffer the warning). */ +/* Use gfc_warning_now_2 instead, unless gmsgid contains a %L. */ void gfc_warning_now (const char *gmsgid, ...) @@ -1086,6 +1087,7 @@ gfc_diagnostic_finalizer (diagnostic_context *cont } /* Immediate warning (i.e. do not buffer the warning). */ +/* This function uses the common diagnostics, but does not support %L, yet. */ bool gfc_warning_now_2 (int opt, const char *gmsgid, ...) @@ -1104,6 +1106,7 @@ gfc_warning_now_2 (int opt, const char *gmsgid, .. } /* Immediate warning (i.e. do not buffer the warning). */ +/* This function uses the common diagnostics, but does not support %L, yet. */ bool gfc_warning_now_2 (const char *gmsgid, ...) @@ -1122,6 +1125,7 @@ gfc_warning_now_2 (const char *gmsgid, ...) /* Immediate error (i.e. do not buffer). */ +/* This function uses the common diagnostics, but does not support %L, yet. */ void gfc_error_now_2 (const char *gmsgid, ...) @@ -1135,6 +1139,24 @@ gfc_error_now_2 (const char *gmsgid, ...) va_end (argp); } + +/* Fatal error, never returns. */ +/* This function uses the common diagnostics, but does not support %L, yet. */ + +void +gfc_fatal_error (const char *gmsgid, ...) +{ + va_list argp; + diagnostic_info diagnostic; + + va_start (argp, gmsgid); + diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION, DK_FATAL); + report_diagnostic (&diagnostic); + va_end (argp); + + gcc_unreachable (); +} + /* Clear the warning flag. */ void @@ -1213,6 +1235,7 @@ warning: /* Immediate error. */ +/* Use gfc_error_now_2 instead, unless gmsgid contains a %L. */ void gfc_error_now (const char *gmsgid, ...) @@ -1243,9 +1266,10 @@ gfc_error_now (const char *gmsgid, ...) /* Fatal error, never returns. */ +/* Use gfc_fatal_error instead, unless gmsgid contains a %L. */ void -gfc_fatal_error (const char *gmsgid, ...) +gfc_fatal_error_1 (const char *gmsgid, ...) { va_list argp;