From patchwork Sat Jan 21 17:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 46845 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp808982wrn; Sat, 21 Jan 2023 09:13:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXs5QwzYqAeiW75hVBwqeJ/nriumi5Jp/j/X+su8L1U3stlu8XkuvlPoljcHfFufh3OrPbhY X-Received: by 2002:a05:6402:3709:b0:49e:baf:f6e9 with SMTP id ek9-20020a056402370900b0049e0baff6e9mr22138485edb.9.1674321186855; Sat, 21 Jan 2023 09:13:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674321186; cv=none; d=google.com; s=arc-20160816; b=d5ZhkKKKEaDbl1pLKvGQIiFPedcIqLqftr0kOossRPfdwnRGP/7qGNxYYNikW12oRq NFxPgTAXw6hv14QKXMoY7RO26aDt4Xqr5cqfeqZcszCjMvGujfxe25WJm941RJC/G6PD lFPCQ38C8VvURfCNs+LTV3qUkyqOMfNb2R/HswZ2aKG/mLmEWPny/8lVgwho0mDzIwKv aa8Akk6jkezBqSCB1kEaMgOoQ1pNpfMnsoeJe1LwAnKTW8qxavo8auw7BZ6jF3uicsD8 64loZP43qZHqLlBGhjZWB0L60gudaC8EI367hBM1jUOBAImfjbOpWe+LXHrzW8IoWkYX 9Qug== 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=GeYy738DgXBf6VryMA+x5TSnCdiRbWQCKQx8UWSVPxo=; b=wmtWKkylWyYbKU909olghadW0JcfZfI2IcatVuzYi4CRCAvoiGhIRZSD7uLSn8BgO7 DWHc5Ncz11gUMNqUswYcwx+IZpK09bxzFL6CTTFetu/IP3tj4dNCrIavSiA3XrLdXCPj 7JGs3vR3vE+iUkftkK+J5tsr0al5zUSGT+wkFX9afOjDp9Yc1IkisMjHbPl0x2xg89CU 8U6qCghQ2m385KfzGoCDHsu2b6i4jL3TI223A1SVaivTiNJI6VxIZf2IKigkiAY+YLkm 0+f5ubYHKbKDk+jScnIjnd0ZSznahMzJ4Pmytom2SrRL3ic8yxJCaXP1NaKBF6eONHZU AiYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=yMZfyFTp; 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 xg11-20020a170907320b00b00715867834e3si22222161ejb.506.2023.01.21.09.13.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 09:13:06 -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=@gcc.gnu.org header.s=default header.b=yMZfyFTp; 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 B45E73858D3C for ; Sat, 21 Jan 2023 17:13:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B45E73858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674321185; bh=GeYy738DgXBf6VryMA+x5TSnCdiRbWQCKQx8UWSVPxo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=yMZfyFTpUciTd6X2fECB2g1vnr0dzOWOfLgKApShZu7XFBeR3F2GUUR3UD0T6ft2Q 0AaoXrKY3hp1+QEjMBAAQ5WH8WJPAgtBzxOfQqbZJCIHokD9YBK8gS+gaMsnHU0Mw3 k8d7tbKaRKOR8Grf6XqGtgoFWFoQRnf9sHWFor0U= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 68C273858D32 for ; Sat, 21 Jan 2023 17:12:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 68C273858D32 Received: by mail-wm1-x32f.google.com with SMTP id g10so6209898wmo.1 for ; Sat, 21 Jan 2023 09:12:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=GeYy738DgXBf6VryMA+x5TSnCdiRbWQCKQx8UWSVPxo=; b=MCtUtdd1qawBv7GPQ/y1mUziA2E9n8TbY1rNsYDi8/SSm/xVoG/Dik8OmgSbxtYmqI CnoxywXKGwVuxL44G5BeTzvHlLWSGzK8tJ6pwa7qKP0b+rJSQKaItLR5SZZ+fuEMm5Ne ST0DDaBjmLeriwTCXv04Aey/QT2bCe4Ts+3QRwxErbdZf6ZTUh4PRqfA1r9CZS9JfCMq /DcF57RtnTrDV4hnqfz7QPyFXNS090D9WGGs3kf1ifVCAncTLc85QARm7td0XyB0OlXX YX4aUZtpZsMN/+jzZZ4HoUbap4Bs4t1yKMpj/aY+P3JwDeNXZlwOe+eRjOZkZrh1xELZ YE+A== X-Gm-Message-State: AFqh2kpnpqxf2jQaFAZXhmfQZLwqQ9WmbMQp2keVnEeMI6M3nytdqJYb y87mG8L47pTXLTBnAg0P1zLICFH4UoM= X-Received: by 2002:a05:600c:1c02:b0:3d9:f85c:97ff with SMTP id j2-20020a05600c1c0200b003d9f85c97ffmr18113932wms.16.1674321141187; Sat, 21 Jan 2023 09:12:21 -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 f22-20020a1cc916000000b003cfa81e2eb4sm5657922wmb.38.2023.01.21.09.12.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 21 Jan 2023 09:12:20 -0800 (PST) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [PATCH] Darwin, fixincludes: Handle Apple Blocks in objc/runtime.h. Date: Sat, 21 Jan 2023 17:12:20 +0000 Message-Id: <20230121171220.36495-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) 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 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?1755653013016202078?= X-GMAIL-MSGID: =?utf-8?q?1755653013016202078?= tested on i686-darwin9, x86_64-darwin19,20,21 x86_64-linux-gnu, pushed to trunk, thanks Iain --- 8< --- The macOS 13 SDK has unguarded Apple Blocks use in objc/runtime.h which causes most of the objective-c tests to fail. Signed-off-by: Iain Sandoe fixincludes/ChangeLog: * fixincl.x: Regenerate. * inclhack.def (darwin_objc_runtime_1): New hack. * tests/base/objc/runtime.h: New file. --- fixincludes/fixincl.x | 63 ++++++++++++++++++++++++--- fixincludes/inclhack.def | 35 +++++++++++++++ fixincludes/tests/base/objc/runtime.h | 24 ++++++++++ 3 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 fixincludes/tests/base/objc/runtime.h diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index ea879b73bad..b02dd8e0575 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1491,6 +1491,41 @@ fix = { test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);"; }; +/* + * macOSX 13.0 SDK objc/runtime.h uses Apple Blocks extension without a guard. + */ + +fix = { + hackname = darwin_objc_runtime_1; + mach = "*-*-darwin2*"; + files = objc/runtime.h; + select = <<- _EOSelect_ + OBJC_EXPORT void.* + objc_enumerateClasses.* + .* + .* + .* + .*void \(\^ _Nonnull block.* + .* + .* + .*OBJC_REFINED_FOR_SWIFT.* + _EOSelect_; + c_fix = format; + c_fix_arg = "#if __BLOCKS__\n%0\n#endif"; + test_text = <<- _OBJC_RUNTIME_1 +OBJC_EXPORT void +objc_enumerateClasses(const void * _Nullable image, + const char * _Nullable namePrefix, + Protocol * _Nullable conformingTo, + Class _Nullable subclassing, + void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop) + OBJC_NOESCAPE) +OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0) +OBJC_REFINED_FOR_SWIFT; +_OBJC_RUNTIME_1; +}; + + /* * In Mac OS X 10.1[012] , need to guard users of * os_trace_payload_t typedef, too. diff --git a/fixincludes/tests/base/objc/runtime.h b/fixincludes/tests/base/objc/runtime.h new file mode 100644 index 00000000000..8b4855bb8ab --- /dev/null +++ b/fixincludes/tests/base/objc/runtime.h @@ -0,0 +1,24 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/objc/runtime.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( DARWIN_OBJC_RUNTIME_1_CHECK ) +#if __BLOCKS__ +OBJC_EXPORT void +objc_enumerateClasses(const void * _Nullable image, + const char * _Nullable namePrefix, + Protocol * _Nullable conformingTo, + Class _Nullable subclassing, + void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop) + OBJC_NOESCAPE) +OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0) +OBJC_REFINED_FOR_SWIFT; +#endif +#endif /* DARWIN_OBJC_RUNTIME_1_CHECK */