From patchwork Sat Dec 6 17:06:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 418409 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 49F831400E7 for ; Sun, 7 Dec 2014 04:06:17 +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:subject:references :in-reply-to:content-type; q=dns; s=default; b=ptbcrmRAMHophIYXa O7BKn24RFXTct/2qnOjIe6egSehUVzbwvOVik/7JuCI8ms5+O2jNrIh/48aF1qVN J+ehymHqh/BZkGrOuQwv06sZe5Pt9s8R/EYHK8vdqSABjy4N+5HcPZAw9ToWzQe0 r1GiVJkjdB/Xbn7s+EhdEZDSvQ= 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:subject:references :in-reply-to:content-type; s=default; bh=qlg2ZpjG3bZRRfVvznM6H1m Cj7k=; b=cxLFdMYcFLkn/g1ydbF6UmEmJv2/qUh7XRfvoQ2Cpb+0QlfD6zOhX+K A6L1ssAQ3+9EQrYEttz254EyhT6UdKazPMN8xRXk+K4iz8+w+2n6RMMhhJzoLgl9 7aoCIXSRfp7XqLGH9TOicGpN8l8vh6pSoLusl9hsU6KxZ9IGKB+A= Received: (qmail 13898 invoked by alias); 6 Dec 2014 17:06:10 -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 13878 invoked by uid 89); 6 Dec 2014 17:06:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx01.qsc.de Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 06 Dec 2014 17:06:08 +0000 Received: from tux.net-b.de (port-92-194-114-130.dynamic.qsc.de [92.194.114.130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPSA id 7421C3CEF3; Sat, 6 Dec 2014 18:06:05 +0100 (CET) Message-ID: <5483377D.9060800@net-b.de> Date: Sat, 06 Dec 2014 18:06:05 +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: gcc-patches , gfortran , =?UTF-8?B?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= Subject: Re: [Patch, Fortran, committed] bool cleanup in error.c References: <54832FEC.20005@net-b.de> <5483349A.3070800@net-b.de> In-Reply-To: <5483349A.3070800@net-b.de> Tobias Burnus wrote: > Tobias Burnus wrote: >> This patch does a cleanup in error.c; it changes come "int" values to >> "bool" – based on Manuel's RFC patch – and it consolidates two >> buffers flags. >> Committed as Rev. 218449 as obvious. > And some more; committed as Rev. 218450. I forgot to attach the patch. Tobias Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 218449) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,4 +1,12 @@ 2014-12-06 Tobias Burnus + + * error.c (gfc_error_check): Use bool not int. + * gfortran.h (gfc_error_check): Update prototype. + * match.c (gfc_match_if): Update call. + * parse.c (decode_statement, decode_omp_directive, + decode_gcc_attribute): Ditto. + +2014-12-06 Tobias Burnus Manuel López-Ibáñez * error.c (gfc_buffer_error, gfc_error_flag_test): Use bool not int. Index: gcc/fortran/error.c =================================================================== --- gcc/fortran/error.c (Revision 218449) +++ gcc/fortran/error.c (Arbeitskopie) @@ -1440,14 +1440,12 @@ gfc_error_flag_test (void) /* Check to see if any errors have been saved. If so, print the error. Returns the state of error_flag. */ -int +bool gfc_error_check (void) { - int rc; + bool error_raised = (bool) error_buffer.flag; - rc = error_buffer.flag; - - if (error_buffer.flag) + if (error_raised) { if (error_buffer.message != NULL) fputs (error_buffer.message, stderr); @@ -1459,7 +1457,7 @@ gfc_error_check (void) exit (FATAL_EXIT_CODE); } - return rc; + return error_raised; } Index: gcc/fortran/gfortran.h =================================================================== --- gcc/fortran/gfortran.h (Revision 218449) +++ gcc/fortran/gfortran.h (Arbeitskopie) @@ -2688,7 +2688,7 @@ void gfc_error_now (const char *, ...) ATTRIBUTE_G void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); void gfc_clear_error (void); -int gfc_error_check (void); +bool gfc_error_check (void); bool gfc_error_flag_test (void); notification gfc_notification_std (int); Index: gcc/fortran/match.c =================================================================== --- gcc/fortran/match.c (Revision 218449) +++ gcc/fortran/match.c (Arbeitskopie) @@ -1497,7 +1497,7 @@ gfc_match_if (gfc_statement *if_type) /* All else has failed, so give up. See if any of the matchers has stored an error message of some sort. */ - if (gfc_error_check () == 0) + if (!gfc_error_check ()) gfc_error ("Unclassifiable statement in IF-clause at %C"); gfc_free_expr (expr); Index: gcc/fortran/parse.c =================================================================== --- gcc/fortran/parse.c (Revision 218449) +++ gcc/fortran/parse.c (Arbeitskopie) @@ -549,7 +549,7 @@ decode_statement (void) /* All else has failed, so give up. See if any of the matchers has stored an error message of some sort. */ - if (gfc_error_check () == 0) + if (!gfc_error_check ()) gfc_error_now ("Unclassifiable statement at %C"); reject_statement (); @@ -769,7 +769,7 @@ decode_omp_directive (void) if (gfc_option.gfc_flag_openmp || simd_matched) { - if (gfc_error_check () == 0) + if (!gfc_error_check ()) gfc_error_now ("Unclassifiable OpenMP directive at %C"); } @@ -796,7 +796,7 @@ decode_gcc_attribute (void) /* All else has failed, so give up. See if any of the matchers has stored an error message of some sort. */ - if (gfc_error_check () == 0) + if (!gfc_error_check ()) gfc_error_now ("Unclassifiable GCC directive at %C"); reject_statement ();