From patchwork Sun Oct 5 13:01:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 396643 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 C731B1400E9 for ; Mon, 6 Oct 2014 00:01:47 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=fxT+O+CLBz+LWuOrKoy3PrPImIy685sZpgOAI/i983zLAV9288 tA2tGOfgdTiMes6a6/Zc5tjhSYLmX+YIl1FsJ0BzzIXzLhle6Scds7WshSvGrEGf 5QHtCpUA/oGxnumel0M2JCtWI5T2VwaYBOH23nXD1ZWm/tnozC8PR0QnM= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=HuhJfy0ZO6gzgsjMEcKmDhwjHdQ=; b=geJWBAVyig9MBc2FNjtm K2gulw2XYaYgRfc+A4cRRjb20eyGxzhBmIkRix3j6OcY+K+YW13AZEDwOh7rc3fn JJ9Rc2NoUhv1wdqRDYpqR+KL/VLf5cfQ9C+P+LPbLZa41BaN3ECaZqAlBbQmg4/q Z/KRMQmbO1dYvED3JFZYXwQ= Received: (qmail 7573 invoked by alias); 5 Oct 2014 13:01:40 -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 7562 invoked by uid 89); 5 Oct 2014 13:01:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 05 Oct 2014 13:01:38 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s95D1ZWt024932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 5 Oct 2014 09:01:35 -0400 Received: from redhat.com (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s95D1Vd2009828 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Sun, 5 Oct 2014 09:01:34 -0400 Date: Sun, 5 Oct 2014 15:01:31 +0200 From: Marek Polacek To: "Joseph S. Myers" Cc: GCC Patches Subject: [C PATCH] Use error_operand_p more Message-ID: <20141005130131.GI3503@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) It occured to me that we should probably use error_operand_p in the C FE where appropriate. Following change is meant only as a little cleanup. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2014-10-04 Marek Polacek * c-convert.c (convert): Use error_operand_p. * c-typeck.c (require_complete_type): Likewise. (really_atomic_lvalue): Likewise. (digest_init): Likewise. (handle_omp_array_sections_1): Likewise. Marek diff --git gcc/c/c-convert.c gcc/c/c-convert.c index 38bacda..95be453 100644 --- gcc/c/c-convert.c +++ gcc/c/c-convert.c @@ -72,8 +72,7 @@ convert (tree type, tree expr) location_t loc = EXPR_LOCATION (expr); if (type == error_mark_node - || expr == error_mark_node - || TREE_TYPE (expr) == error_mark_node) + || error_operand_p (expr)) return error_mark_node; if ((invalid_conv_diag diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c index f69c28b..b3b82bb 100644 --- gcc/c/c-typeck.c +++ gcc/c/c-typeck.c @@ -192,7 +192,7 @@ require_complete_type (tree value) { tree type = TREE_TYPE (value); - if (value == error_mark_node || type == error_mark_node) + if (error_operand_p (value)) return error_mark_node; /* First, detect a valid value with a complete type. */ @@ -1950,7 +1950,7 @@ default_function_array_read_conversion (location_t loc, struct c_expr exp) static bool really_atomic_lvalue (tree expr) { - if (expr == error_mark_node || TREE_TYPE (expr) == error_mark_node) + if (error_operand_p (expr)) return false; if (!TYPE_ATOMIC (TREE_TYPE (expr))) return false; @@ -6492,8 +6492,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, if (type == error_mark_node || !init - || init == error_mark_node - || TREE_TYPE (init) == error_mark_node) + || error_operand_p (init)) return error_mark_node; STRIP_TYPE_NOPS (inside_init); @@ -11365,7 +11364,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec &types, tree ret, low_bound, length, type; if (TREE_CODE (t) != TREE_LIST) { - if (t == error_mark_node || TREE_TYPE (t) == error_mark_node) + if (error_operand_p (t)) return error_mark_node; if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) {