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: 84348 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4FFDD385842D for ; Thu, 18 Jan 2024 14:36:46 +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-Google-Smtp-Source: AGHT+IHl98xU5O34+COFer7EjbOVknS34+fB79iBHP1lnbEeHMzERug5ZO4whJZ73q821QcJttXEMA== 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+patchwork=sourceware.org@gcc.gnu.org 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)