From patchwork Thu Jan 18 14:36:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 189225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp382988dyb; Thu, 18 Jan 2024 06:37:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvf6EKxfSxhmZBSgNCgDntOcVm94KAhGTqgT6rQqoatZXdbG8iPIhXHN+mkoFhgQugHNH9 X-Received: by 2002:ac8:7c49:0:b0:429:bc00:ef25 with SMTP id o9-20020ac87c49000000b00429bc00ef25mr942354qtv.122.1705588621205; Thu, 18 Jan 2024 06:37:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705588621; cv=pass; d=google.com; s=arc-20160816; b=SNr8cE93wvtAozhNTLdNY22p0ZYijKx5QPRuZyWHANW83kja4TmKiMnlG9/O0fSC+w e331/86Qqb9lZw8P8ABi7pi5kxg4meS28wIaD2JP0+EOjcf7n5qmmUjNHH2Tn/ohDBJz nVjM+wxWTTWyHFlAsJritjW81Mutp6FWN0LIakpEHcKXyrROTYP+sFBabRO66BT3t/gU A27D7ghU5nUSQbZsQ9ZXphj13FVDZ7ZSTRI8TJm58PxEdQUNJUOdeXqFyEexLC5CAWEQ r+KSXnAPQpDTwqNoGzjw70A2okRnIoUAtZH+C3h0vvar2CuN9hVjc4/IGdYrhhvqfKBu uliA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=fLd1l0EvbQBWdNvmJd37WQnzyhIT8t+NFcpjObGB/pg=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=pg2/Rnjmu7l8qX6ahQUgNyjflgLoDKzMWgPQkLv0dZuICHHLwr5ReUTWHJza7mKoni ZZEjfbubTYyM77e6TA3W4g8jnK5bvIpcAi3CkGROE1m5wyKRHezLJ3e7YaSnqn/fuyuc Vw2Bmr3zpPltO57r02B2ogPseBTjHu8jGI9is9BPpFmVCAJkNSesqTqPpr67Uxl6St1W tPkEZhUYbGC9T8nWQdDxU1Ghjw7EpNuXZKnnKRmqRTydpNrOXBEQMkAUrQ0K06kLYLon 9fvdU0dpfMTYjzEmx1ZFFbUNG0Hd1oCJK6OtIk5KAtNglzXH7mezq1XSM/cAh8vD456T KZFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=g8cFY4Oc; arc=pass (i=1); 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id c18-20020ac87d92000000b00429fee348c2si6076607qtd.644.2024.01.18.06.37.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 06:37:01 -0800 (PST) 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=@gmail.com header.s=20230601 header.b=g8cFY4Oc; arc=pass (i=1); 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E259C3858434 for ; Thu, 18 Jan 2024 14:37:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id D7E323858D38 for ; Thu, 18 Jan 2024 14:36:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7E323858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D7E323858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705588578; cv=none; b=Xxj+EPm0VR/fZlkPScHqggH478M9+OzDbVi4VnKFlA1ZN6iQbtrO3M7U6cJRiBx05SAKt9eet2XjdCvsICThVD540PcEMc76B6OYZuZG7xI6coTE5BkujgNDkf2R8v1Xtg7aAuFdwD3dLHiS48L+yqwPkPOjxAF5BUIaMOw1wgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705588578; c=relaxed/simple; bh=DMtMqiY8H8vRoIialHqWRyIMQmCMyEEBnaXzoGrcYVA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=q6fg6Ns06WUzJxzN3DT5Gou5eJ3C7joOfKc5dunkjsCLygYuiU8+pJXC1ujwJ51OskiaYiCerB0vSk7RdM9zWIETRBMTcJDtvkVjmbexN9TMXgPy2mHLyaQo4LlrIjhHGiExHJ2KqhGePLiFSBGACFjlgFHv/Hhdt1kNHs5lP14= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-337b583453bso2626813f8f.2 for ; Thu, 18 Jan 2024 06:36:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705588574; x=1706193374; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=fLd1l0EvbQBWdNvmJd37WQnzyhIT8t+NFcpjObGB/pg=; b=g8cFY4Oc121ZLKhG8TqcJBPdLG6Y45NVC7swDyTAaNs1eW3MCdzG40+ezK0ZB97L1h 51ZPTQSJnqmWqHfJtV7MzjweE8/RaQvTTSyyRHmfWSwSx6YFMpqe5w6x+ZOcoslZsJO7 qR1jksls20ulgDV9vU4gkLi1OTONg4a5scdRIYKphjBCJN2ez0lT6JzVUXQDPp7Fa+xx YhZxqN2ahvcvOFqJJqrNf+G1zn9XdJ615Y9m7p5whpGqPiLrPt21zbTi6g7SyyOTCLIZ mktU4dPl1B7qFgM9Iyc/ZODigmOp+f0ij9y4iixnr6mNJcPh7H+HlEI2KzdccvyhTxO1 EVZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705588574; x=1706193374; 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=fLd1l0EvbQBWdNvmJd37WQnzyhIT8t+NFcpjObGB/pg=; b=EwJyoBDWwUxu8s2u703WwsV18x1YR08EzIkY0t26AiJUjAeibN6JTQqmvxXx3ASw0D bkOqWUSP42/3PO/4tl/dZm/2QxGKdLVnVW4dpmJMjFb71hfBtewp+IZfEUMyum+y/CBr ErgAN5ANarHS27fnBm3rBFMnR+E57ckYVZFuCw3+3grXwzVfitjpxW6nBajPSHdm8ZI1 +bM4Wvi3pnc4ew7uXGMvUywoBKVuY9gy8+Gkxl188r+E2gr7nKLca9AAjQb0T+XYzNiO 0zBcdnQZostaF703Tam0zpzWlcBX3qGiWh2MSOKsw3oh+OLqG7/ZPjJF8tZDyvbDf6h9 N+zQ== X-Gm-Message-State: AOJu0YwSFdg4LlWHzuW/YWqcYgRU36J9Ey8kVLd+NxYErJOlKLSLVf/M fxNZ/wciMtrrYuCu/pUQ9NR1HQrB2nUJ3mzmTEHfGv1vkjA+RP9v64o7/XRv X-Received: by 2002:a5d:4051:0:b0:337:9a6f:85e3 with SMTP id w17-20020a5d4051000000b003379a6f85e3mr407009wrp.168.1705588574565; Thu, 18 Jan 2024 06:36:14 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id c12-20020a056000104c00b00337c0f35497sm4218222wrx.79.2024.01.18.06.36.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 18 Jan 2024 06:36:14 -0800 (PST) From: Iain Sandoe X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [pushed] Objective-C/C++: Ensure sufficient setup for the preprocessor. Date: Thu, 18 Jan 2024 14:36:13 +0000 Message-Id: <20240118143613.24772-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.5 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: iain@sandoe.co.uk Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788439293683650237 X-GMAIL-MSGID: 1788439293683650237 This is a regression fix where non-trivial Objective-C parses would ICE when given -save-temps (ICE in the lexer). This is a short-term fix for stage-4. ISTM that we should not really be making use of these functions in lexing and hopefully in GCC-15 we can take a look at moving the functionality to a later phase. Tested on i686, powerpc, x86_64 Darwin, x86_64 Linux, pushed to trunk, thanks Iain --- 8< --- The tokenizer makes use of functions that determine if identifiers are interface or class names, and those functions need a hash map to be set up. This ensures that these are initialized before pre-process-only jobs are run. gcc/objc/ChangeLog: * objc-act.cc (objc_init): Initialize interface and class name hash maps before the preprocessor uses them. Signed-off-by: Iain Sandoe --- gcc/objc/objc-act.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/objc/objc-act.cc b/gcc/objc/objc-act.cc index 143134832ff..cec64c4bfbd 100644 --- a/gcc/objc/objc-act.cc +++ b/gcc/objc/objc-act.cc @@ -345,6 +345,11 @@ bool objc_init (void) { bool ok; + + /* Set up stuff used by the preprocessor as well as FE parser. */ + interface_hash_init (); + hash_init (); + #ifdef OBJCPLUS if (cxx_init () == false) #else @@ -374,8 +379,6 @@ objc_init (void) /* Set up stuff used by FE parser and all runtimes. */ errbuf = XNEWVEC (char, 1024 * 10); - interface_hash_init (); - hash_init (); objc_encoding_init (); /* ... and then check flags and set-up for the selected runtime ... */ if (flag_next_runtime && flag_objc_abi >= 2)