From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x32f.google.com with SMTP id g10so6209898wmo.1 for ; Sat, 21 Jan 2023 09:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=GeYy738DgXBf6VryMA+x5TSnCdiRbWQCKQx8UWSVPxo=; b=cIgzRsX0555dldJiHe0oqLnu1vQ7g4KtJcJkN6UTqTMzSYxZqmMei4K0zanYhHBnux iZ9kcxpXYLYUuKn6czvmxkgIbp5/eIAmU9J+6LSIOGwmH4w7uVh5k+Os3IXmFKWQyCPI KZgspQgQpJpM8OmnGuxNrrpUPlPkdrn1piD5pmJrB2lcYSvCAI9fbBbk3wCl98tXYugs 0E2epNBTl6b6USU3hKuJGNyF++VnUiZNeYJu5ip8vFaLAmjI39af8Cvdvi7vj0vdqfRH OWlw7GvZwsUI7vH4al6/+FkN7kGdS4xvgH3E/iBdUEG75R71CovafwpSkIV8QG9fzXSO EAnw== 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-Google-Smtp-Source: AMrXdXtO8XtjJb724R6rAgE+09FUpGZAOnCz1fGRUMpLHS5H+GUUdFEjdkrcZoSeQzkURzci8+TyUw== 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) From: Iain Sandoe 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) Reply-To: iain@sandoe.co.uk MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: 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 */ -- 2.37.1 (Apple Git-137.1)