From patchwork Mon May 22 21:47:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 97635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1737262vqo; Mon, 22 May 2023 14:48:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6yhCMxlruWm2a48GYoWl7bz3TKjQu+vHFRx2SkA0Y2s4IvdUFwKXkJoZxLgSTSY6QG4ntR X-Received: by 2002:a17:906:a855:b0:961:800b:3f1e with SMTP id dx21-20020a170906a85500b00961800b3f1emr8685117ejb.73.1684792113466; Mon, 22 May 2023 14:48:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684792113; cv=none; d=google.com; s=arc-20160816; b=AICKA/e4iFXGaOzXczhLZoM35zQU4IJOk9ISieDQK7oK3xzabROFIE3KKJtdjhTcGz 6+L/jSRSamNw7obTllj3O7BW7VcodBU7q6xEMlSkXDO1o9Q30EYD7v2OuRGImSZa4RI4 T2o/rKu2xq6H6OfuLEesFN4BTswJEWxHcMBtpNjk/pRVYrXmGMF4USfE3D+K96XrUJMl ZsT5P02DnxrR+FhwVLQtj8vL3IcdlQS6EcsMmbAw0agrYD03nWjJ/stp3QGHEKeaJnqW SIEZw9o0wn98Gt4U70bIOOFydVgIAKnQmP4oa8VsFeGrMsa5GR/tcu7F4Y4IJJZnGOkU bP+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=o2vJdBphUhwKZbw2+GbADolMmUsBkbu+ZXmdN61yPUE=; b=U2CUo8nE6q/J58Sr/cih24rcIU9UhPyyJ+p4tlYZG7lXsegIoU9pyYk+IdOvzV+U6j CrqONd/wxo18Lmn2t3blY1xkbuxvlu1lbMEDmau1CryezVRqSN5Gsi6Oh2OvVAAbiMBg nlUWPYNiYITEW1yFJ1hJ0Ru0v1Ygc3G2uRPDlpYUnnp11ktsUu6uWKnZbrp7w/h3LGob 6rKAmSDxAqbGDpXn3B0fr9jfiDI+zFn5aGNMuVb+Duq5OGvMnCMDoP3R9DXQulZup/qw RkLTpA4KQl9H87w26YTzGO1e97tAljEoaLfuQavEnbMDJAKmWWkk3lHkl/zTsyq/9Rzn 78iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=NLrq2Hfv; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g6-20020aa7d1c6000000b0050bf5a17164si1210254edp.400.2023.05.22.14.48.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 14:48:33 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=NLrq2Hfv; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3AE853858413 for ; Mon, 22 May 2023 21:48:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AE853858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684792112; bh=o2vJdBphUhwKZbw2+GbADolMmUsBkbu+ZXmdN61yPUE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=NLrq2HfvRDJjc4fuk+99hvQuk97ve/4Cy/uK/F2UL5UijhA1juBw8tqmgAUFPm8wb cTVrccAqsnzj3v8haFoqNyhTx8dRUyAclc4cWTE1oSGOA3YJzTAUZsq7jNL9wN58i9 humQyTYzIZyw7yE2R++D4TpCDMYfza2mjlyu1BPE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 2B28D3858D38 for ; Mon, 22 May 2023 21:47:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B28D3858D38 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-309438004a6so4139044f8f.2 for ; Mon, 22 May 2023 14:47:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684792066; x=1687384066; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=o2vJdBphUhwKZbw2+GbADolMmUsBkbu+ZXmdN61yPUE=; b=Wp/zbsmll7KMWnBXtSz18+rpV5biej32ierioyZ6zu374g3lw2Xft4gurfuNNfWtZj E3CcjcDBxi/i8e1a10kHCMEyveGqtLppyGzvff6d63dY4+tJhEvMdUwUJ9AHD/Jq9d8E 5PYtoQ9k31AWL0rb9XB55vwOgw0myW2/XLDTzsN59H+3SbrP1UrJnXYqbnggn5438eVy xY4wnXCKZRhYcUItJJDsT4eEd5mcqQ7S5xSZMeSw0WyptVbHp0ZbGS5RAoml1HRqQNOl gFlqlFpDUgni/GCg79ZNXF/SRfB7H7WbfyPVm59WgCGclSi8sLAhYhmfk3wIec/WxqcC 4gnQ== X-Gm-Message-State: AC+VfDy2SCtjp+J7MjdMKOqNPLG/i2xuzaG2C18GmbBotLX1jOBpLw2K 0pP3IOeqlkZqrih5HBA/i6c3TLftLcg= X-Received: by 2002:a5d:4a12:0:b0:306:f6c:1063 with SMTP id m18-20020a5d4a12000000b003060f6c1063mr9465690wrq.38.1684792065601; Mon, 22 May 2023 14:47:45 -0700 (PDT) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id f5-20020a5d4dc5000000b0030644bdefd8sm8938625wru.52.2023.05.22.14.47.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 22 May 2023 14:47:45 -0700 (PDT) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [pushed] libobjc: Add local macros to support encode generation [P109913]. Date: Mon, 22 May 2023 22:47:44 +0100 Message-Id: <20230522214744.15211-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Sandoe via Gcc-patches From: Iain Sandoe Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766632575194272854?= X-GMAIL-MSGID: =?utf-8?q?1766632575194272854?= This fixes bootstrap on powerpc-darwin, and was tested there for both GNU and NeXT Objective-C testsuite. Approved in the PR by Andrew, pushed to trunk, thanks, Iain --- 8< --- r14-976-g9907413a3a6aa3 alters code to use the preferred _P-style macros rather than direct comparisons of (for example) tree codes. In the context of libobjc this does not work, since we do not include the relevant headers; the encoding implementation contains a local emulation of the target type layouts. The fix here provides relevant macros local to the use. Signed-off-by: Iain Sandoe PR libobjc/109913 libobjc/ChangeLog: * encoding.c (RECORD_OR_UNION_TYPE_P, VECTOR_TYPE_P): New. Co-authored-by: Andrew Pinski --- libobjc/encoding.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libobjc/encoding.c b/libobjc/encoding.c index 9bd261c52bd..f1bbd6bf6ee 100644 --- a/libobjc/encoding.c +++ b/libobjc/encoding.c @@ -67,6 +67,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define UNION_TYPE _C_UNION_B #define QUAL_UNION_TYPE _C_UNION_B #define ARRAY_TYPE _C_ARY_B +#define RECORD_OR_UNION_TYPE_P(TYPE) \ + ((TREE_CODE (TYPE) == RECORD_TYPE) \ + || (TREE_CODE (TYPE) == UNION_TYPE) \ + || (TREE_CODE (TYPE) == QUAL_UNION_TYPE)) +#define VECTOR_TYPE_P(TYPE) (TREE_CODE (TYPE) == VECTOR_TYPE) #define REAL_TYPE _C_DBL