From patchwork Thu May 2 21:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1930885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=CFRuyMfz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VVnQm5bg6z20fb for ; Fri, 3 May 2024 07:40:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E1BB3846070 for ; Thu, 2 May 2024 21:39:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 999EF384AB69 for ; Thu, 2 May 2024 21:39:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 999EF384AB69 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 999EF384AB69 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714685973; cv=none; b=uUAWwcfDJCGAHaB3LEChz4yKH5oOuP3tIZKDYNUO6xwFThG67iavkTczX9NuFe5Lvf/MZ/cbedjZ/E2sX9StXYz2V3k2qJP/N48NEJl9vHmjCT0DHGTzW5nuPUmFKiWh0BfqPtTDdCkWT/+5frvhdPKOQVGAu+so/59SnCbmF6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714685973; c=relaxed/simple; bh=TucGQFlMcO+AihQ/eAF1VQFD3ySWcZgSjBxC7SI4naI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZLdPrICyyMEe7OaRE0D6eMkxjX9VK5Xf2BcPrnqrFP4YoGMVMzsivYZD/YLMqTDZDaeibesYZkt0JwZSb4rnSGWFMH+hrz1GXYiRkN57F85VvaCzkDWfKncbWxjjMcCbOOutLKhr6tnZNR6hQoTzw9zs9iyRDLbKOKpvjARZZwQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 442LScvs010479 for ; Thu, 2 May 2024 21:39:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=Zb1PAaxPhDdXdCz4XKOINftLdVWDlVmeL0EDdi2xlZo=; b=CF RuyMfzC/AsLivwmACZA2Keul5KlOvAGiAh+bFop+QWd4REwmSYp9t9LYPiqB5qSX +skVkqsSAbldrxP/fIoEj0d0a5G2Sa01xMcPXILkNs6kd1l0rcLHW1H6w2gM5FJt ql1QThcpPKIhjNJ+5+vu2d144/j2i2r8L2jiSLQsl+Or0nbxP7/hYiasRk2en+Np AGc5ThvHjRU04XYHfZ1kYRQJ4TMse8zT4wCMPBtdzwUzQN4XytOM5DJpPIq5QvZq q6l3HEudW2x5HCeV4bcjaaDGffMjXbpKz+FQ4fQ0sS/Hkp+09UeMhBNTWwdtQ2KZ OpwjXC+lKqdM0fofZJaA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xurt736fa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 May 2024 21:39:31 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 442LdTHt028756 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 2 May 2024 21:39:29 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 2 May 2024 14:39:29 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 3/3] Add parentheses around DECL_INIT for .original [PR23872] Date: Thu, 2 May 2024 14:39:18 -0700 Message-ID: <20240502213918.2029860-3-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240502213918.2029860-1-quic_apinski@quicinc.com> References: <20240502213918.2029860-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: vxlG_Ocs7Sa1FXF16yVcgS7xP68DImPj X-Proofpoint-ORIG-GUID: vxlG_Ocs7Sa1FXF16yVcgS7xP68DImPj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-02_13,2024-05-02_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=678 clxscore=1015 suspectscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2405020143 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org When we have : `void f (int y, int z) { int x = ( z++,y); }` This would have printed the decl's initializer without parentheses which can confusion if you think that is defining another variable rather than the compound expression. This adds parenthese around DECL_INIT if it was a COMPOUND_EXPR. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-pretty-print.cc (print_declaration): Add parenthese around DECL_INIT if it was a COMPOUND_EXPR. Signed-off-by: Andrew Pinski --- gcc/tree-pretty-print.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc index 825ba74443b..8b766dcd2b8 100644 --- a/gcc/tree-pretty-print.cc +++ b/gcc/tree-pretty-print.cc @@ -4240,7 +4240,14 @@ print_declaration (pretty_printer *pp, tree t, int spc, dump_flags_t flags, bool pp_equal (pp); pp_space (pp); if (!(flags & TDF_SLIM)) - dump_generic_node (pp, DECL_INITIAL (t), spc, flags, false); + { + bool need_paren = TREE_CODE (DECL_INITIAL (t)) == COMPOUND_EXPR; + if (need_paren) + pp_left_paren (pp); + dump_generic_node (pp, DECL_INITIAL (t), spc, flags, false); + if (need_paren) + pp_right_paren (pp); + } else pp_string (pp, "<<< omitted >>>"); }