From patchwork Sun Oct 11 13:42:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1380372 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C8NKF5HK2z9sSG for ; Mon, 12 Oct 2020 00:42:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B8DD3850405; Sun, 11 Oct 2020 13:42:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp1.wavenetuk.net (smtp.wavenetuk.net [195.26.36.10]) by sourceware.org (Postfix) with ESMTP id B34133857019 for ; Sun, 11 Oct 2020 13:42:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B34133857019 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=iain@sandoe.co.uk Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp1.wavenetuk.net (Postfix) with ESMTPA id 0D29E120121E for ; Sun, 11 Oct 2020 14:42:19 +0100 (BST) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [pushed] testsuite, Objective-C : Compatibility fixes. Message-Id: <8874B717-647E-44AF-AED5-A86C2060A750@sandoe.co.uk> Date: Sun, 11 Oct 2020 14:42:03 +0100 To: GCC Patches X-Mailer: Apple Mail (2.3273) X-Spam-Status: No, score=-16.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_COUK, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi Changes to deal with warnings and/or errors seen when compiling the tests with clang (allowing us to compare a sub-set of the tests between implementations). tested across the Darwin range, and on x86_64-linux pushed to master thanks Iain gcc/testsuite/ChangeLog: * objc-obj-c++-shared/TestsuiteObject.h: If the compiler supports objc_root_object attributes, then mark the testsuite object accordingly. * objc-obj-c++-shared/TestsuiteObject.m: Avoid direct access to isa, which is an error for modern Objective-C. * objc/execute/class-tests-1.h: Declare a string function we use locally (avoid pulling in the whole of string.h). --- gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h | 3 +++ gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m | 2 +- gcc/testsuite/objc/execute/class-tests-1.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h index 66b68c81ec9..0f139bc84b4 100644 --- a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h +++ b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h @@ -24,6 +24,9 @@ along with GCC; see the file COPYING3. If not see /* We use this root class instead of Object to keep the tests independent of the runtime being used. Keep it simple. */ +#if defined(__has_attribute) && __has_attribute(objc_root_class) +__attribute__((objc_root_class)) +#endif @interface TestsuiteObject { Class isa; diff --git a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m index 6bbe7d470e8..703827f8e61 100644 --- a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m +++ b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m @@ -64,6 +64,6 @@ along with GCC; see the file COPYING3. If not see } - (const char *)name { - return class_getName (isa); + return object_getClassName (self); } @end diff --git a/gcc/testsuite/objc/execute/class-tests-1.h b/gcc/testsuite/objc/execute/class-tests-1.h index cfdd72b4748..65f1f70234e 100644 --- a/gcc/testsuite/objc/execute/class-tests-1.h +++ b/gcc/testsuite/objc/execute/class-tests-1.h @@ -4,6 +4,8 @@ #include #include "../../objc-obj-c++-shared/runtime.h" +extern int strcmp(const char *, const char *); + /* * Standard Tests For Classes and Objects - abort upon failing; return * normally if all is well.