From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) by sourceware.org (Postfix) with ESMTPS id CE9633858C83 for ; Sun, 27 Nov 2022 17:40:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CE9633858C83 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=synopsys.com Received: from pps.filterd (m0098571.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AR3HE4k000524; Sun, 27 Nov 2022 09:39:59 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pfptdkimsnps; bh=twkXLuXpGi9lPSb69jVVJQor4U+M89o04NzMdTQ13L4=; b=tvokcS29hIXsaMeBqYE26lSIq/2AzYyFUFpT1hGN67OR7W8lJSvmPInprZ4BuqKjWGHS UPEreGlLdH8W0BLJkjAhhDdgbfs/D89i3MjRT1jj3/g2RsVr6qPRDO+fMXcikMILPIHT +LZmFer+JOXwQlDCk9MXciViY7RTFF6M0LMY6G7xwcAIwqTeEpsJVGHau4oyz3XjOdyl maY/uqFkFXumg88At/W/edXfiDM74PY01V1EYKbg9u4jMtgAaS690Cw2o4+CA1fC1nne 0o9GwU8NIB7WxiB/yivbaHpejUPb7xCmWTdQxRgjMNR7bzClsq12Ui5wxyAzr/7U9Oz2 4w== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 3m3jpt3f6d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 27 Nov 2022 09:39:59 -0800 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id D6AD5C00FD; Sun, 27 Nov 2022 17:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1669570798; bh=doUGINLdcxLksfDMcXWIBRhwtHnFZgBtIOeZ4aMORBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DIoDaLSSZCxldvM0gNIFbQ08d+QUXGcmhnQx2f6DBKjULYIG62kjuo5qW3xJn5smy wxqVJMYC+jsfdkWmmmaUDUf5lB/g/MeGsactOAckBM9DuXUGDaVJII6ffi1sTiB2p+ cIseUJC4ikVNPV/FJ9WfwFKyrARDmp1nVJJXBfuL1QHR6DrtXO2vOS2OxuwG9U7Gkq MhqL03RipB2dEMPlqNWzlapLO7jP0+cY314FXFS9B+J27NyEb1Kdlodt00NaWoFB4M gig2I8xha3+zBkkh1zUaBhnFt3oDlYnv4IV46tFKk7c4R5DpOv2CT8qoPz3r4/fbkS 8sQFbFMSQK9eQ== Received: from atlantis.internal.synopsys.com (unknown [10.225.29.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client did not present a certificate) by mailhost.synopsys.com (Postfix) with ESMTPSA id B2280A005E; Sun, 27 Nov 2022 17:39:54 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Shahab Vahedi To: libc-alpha@sourceware.org Cc: Shahab Vahedi , Florian Weimer , Claudiu Zissulescu , arcml Subject: [PATCH v3 1/2] scripts: Add "|" operator support to glibcpp's parsing Date: Sun, 27 Nov 2022 18:38:24 +0100 Message-Id: <20221127173825.3106-2-shahab@synopsys.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221127173825.3106-1-shahab@synopsys.com> References: <20221118131542.23188-1-shahab@synopsys.com> <20221127173825.3106-1-shahab@synopsys.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: Rb-JVnB1tyM7jcOck2Umr2G_CPqWknQT X-Proofpoint-GUID: Rb-JVnB1tyM7jcOck2Umr2G_CPqWknQT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-27_08,2022-11-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 spamscore=0 adultscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211270147 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_NONE,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 List-Id: >From the tests point of view, this is a necessary step for another patch [1] and allows parsing macros such as "#define A | B". Without it, a few tests [2] choke when the other patch [1] is applied: /src/glibc/scripts/../elf/elf.h:4167: error: uninterpretable macro token sequence: ( EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK ) Traceback (most recent call last): File "/src/glibc/elf/tst-glibcelf.py", line 23, in import glibcelf File "/src/glibc/scripts/glibcelf.py", line 226, in _elf_h = _parse_elf_h() ^^^^^^^^^^^^^^ File "/src/glibc/scripts/glibcelf.py", line 223, in _parse_elf_h raise IOError('parse error in elf.h') OSError: parse error in elf.h [1] ARC: update definitions in elf/elf.h https://sourceware.org/pipermail/libc-alpha/2022-November/143503.html [2] tst-glibcelf, tst-relro-ldso, and tst-relro-libc Signed-off-by: Shahab Vahedi --- scripts/glibcpp.py | 1 + support/tst-glibcpp.py | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/glibcpp.py b/scripts/glibcpp.py index 455459a609..2f39979894 100644 --- a/scripts/glibcpp.py +++ b/scripts/glibcpp.py @@ -346,6 +346,7 @@ RE_SPLIT_INTEGER_SUFFIX = re.compile(r'([^ullULL]+)([ullULL]*)') BINARY_OPERATORS = { '+': operator.add, '<<': operator.lshift, + '|': operator.or_, } # Use the general-purpose dict type if it is order-preserving. diff --git a/support/tst-glibcpp.py b/support/tst-glibcpp.py index a2db1916cc..cca8bd6c44 100644 --- a/support/tst-glibcpp.py +++ b/support/tst-glibcpp.py @@ -131,6 +131,7 @@ check_macro_eval('#define A 1', {'A': 1}) check_macro_eval('#define A (1)', {'A': 1}) check_macro_eval('#define A (1 + 1)', {'A': 2}) check_macro_eval('#define A (1U << 31)', {'A': 1 << 31}) +check_macro_eval('#define A (1 | 2)', {'A': 1 | 2}) check_macro_eval('''\ #define A (B + 1) #define B 10 -- 2.38.1