From patchwork Sat Sep 10 16:36:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 668389 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 3sWfqV65bJz9ssP for ; Sun, 11 Sep 2016 02:37:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=lsSFAcdw; 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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=uqJKxz+GT4KfWoLNNcWTKyMcfzCLkQI13J3td/6jrKs/IemabUx9w 3+/Uq7jWcbwima+QNqV+cXqC64yshQim5/l6p0OyGNQ9oZYmt+TvB4RrdRRxGs78 fAxwTdodsPMutlGviEcPPZgLNvbjPIIFHJkryJ7Q7AyKPoj/8LlVX8= 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:subject:message-id:mime-version:content-type; s= default; bh=ApPPe7hmEZVXmjYJjhF3qv3Wll0=; b=lsSFAcdwJV4hLQwKehuf yxkXvfef/2R3c7/XSlMwTXhLQgKkBW2CcQJ7NsaKip/a0SBEn3GvbF/4uIrosAEb Rw68pIUpG1rOwyVclV2Q6pj0SyiACpNRza7ALcbwM4oPSxxwM3nuDNeZsCtZN9lt JkyB3GtK0x1PhFQGhbb8rRQ= Received: (qmail 99866 invoked by alias); 10 Sep 2016 16:37:00 -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 99854 invoked by uid 89); 10 Sep 2016 16:37:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Sat, 10 Sep 2016 16:36:58 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9286AB98CB; Sat, 10 Sep 2016 16:36:57 +0000 (UTC) Received: from redhat.com (ovpn-204-19.brq.redhat.com [10.40.204.19]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8AGariQ002958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 10 Sep 2016 12:36:56 -0400 Date: Sat, 10 Sep 2016 18:36:53 +0200 From: Marek Polacek To: GCC Patches , Joseph Myers Subject: [C PATCH] Tidy build_unary_op Message-ID: <20160910163653.GL19950@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.0 (2016-08-17) A minor cleanup. First, FLAG is a really bad name for a parameter, and second, using two vars for the same thing is redundant (we never modify any of them). Also some bad formatting. Bootstrap/regtest on x86_64-linux running. Ok for trunk? 2016-09-10 Marek Polacek * c-typeck.c (build_unary_op): Rename FLAG parameter to NOCONVERT. Use it. Marek diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c index d56c3d6..8c7f895 100644 --- gcc/c/c-typeck.c +++ gcc/c/c-typeck.c @@ -4112,17 +4112,17 @@ cas_loop: /* Construct and perhaps optimize a tree representation for a unary operation. CODE, a tree_code, specifies the operation and XARG is the operand. - For any CODE other than ADDR_EXPR, FLAG nonzero suppresses + For any CODE other than ADDR_EXPR, NOCONVERT nonzero suppresses the default promotions (such as from short to int). - For ADDR_EXPR, the default promotions are not applied; FLAG nonzero + For ADDR_EXPR, the default promotions are not applied; NOCONVERT nonzero allows non-lvalues; this is only used to handle conversion of non-lvalue arrays to pointers in C99. LOCATION is the location of the operator. */ tree -build_unary_op (location_t location, - enum tree_code code, tree xarg, int flag) +build_unary_op (location_t location, enum tree_code code, tree xarg, + int noconvert) { /* No default_conversion here. It causes trouble for ADDR_EXPR. */ tree arg = xarg; @@ -4131,7 +4131,6 @@ build_unary_op (location_t location, tree val; tree ret = error_mark_node; tree eptype = NULL_TREE; - int noconvert = flag; const char *invalid_op_diag; bool int_operands; @@ -4276,7 +4275,8 @@ build_unary_op (location_t location, if (TREE_CODE (arg) == C_MAYBE_CONST_EXPR) { tree inner = build_unary_op (location, code, - C_MAYBE_CONST_EXPR_EXPR (arg), flag); + C_MAYBE_CONST_EXPR_EXPR (arg), + noconvert); if (inner == error_mark_node) return error_mark_node; ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), @@ -4486,7 +4486,7 @@ build_unary_op (location_t location, /* Anything not already handled and not a true memory reference or a non-lvalue array is an error. */ - if (typecode != FUNCTION_TYPE && !flag + if (typecode != FUNCTION_TYPE && !noconvert && !lvalue_or_else (location, arg, lv_addressof)) return error_mark_node; @@ -4495,7 +4495,8 @@ build_unary_op (location_t location, if (TREE_CODE (arg) == C_MAYBE_CONST_EXPR) { tree inner = build_unary_op (location, code, - C_MAYBE_CONST_EXPR_EXPR (arg), flag); + C_MAYBE_CONST_EXPR_EXPR (arg), + noconvert); ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), C_MAYBE_CONST_EXPR_PRE (arg), inner); gcc_assert (!C_MAYBE_CONST_EXPR_INT_OPERANDS (arg));