From c3abb29f196be2e49235d7143ae47e44cc78349b Mon Sep 17 00:00:00 2001 From: Dave MacLachlan Date: Wed, 3 Sep 2025 13:23:40 -0700 Subject: [PATCH] Fix up compiler errors --- .../Shimulator/TestCrashShim/TestCrashShim.m | 2 +- .../Shimulator/TestLoadingShim/FBXCTestMain.m | 8 +++--- .../TestReporterShim/XCTestReporterShim.m | 25 ++++++------------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/Shims/Shimulator/TestCrashShim/TestCrashShim.m b/Shims/Shimulator/TestCrashShim/TestCrashShim.m index ac1c19307..d26a30942 100644 --- a/Shims/Shimulator/TestCrashShim/TestCrashShim.m +++ b/Shims/Shimulator/TestCrashShim/TestCrashShim.m @@ -42,7 +42,7 @@ static void PrintProcessInfo(void) FBDebugLog(@"Environment %@", processInfo.environment); } -__attribute__((constructor)) static void EntryPoint() +__attribute__((constructor)) static void EntryPoint(void) { NSLog(@"Start of Shimulator"); diff --git a/Shims/Shimulator/TestLoadingShim/FBXCTestMain.m b/Shims/Shimulator/TestLoadingShim/FBXCTestMain.m index 1d3b76f47..6b6c8401d 100644 --- a/Shims/Shimulator/TestLoadingShim/FBXCTestMain.m +++ b/Shims/Shimulator/TestLoadingShim/FBXCTestMain.m @@ -26,7 +26,7 @@ #import #endif -__attribute__((constructor)) static void XCTestMainEntryPoint() +__attribute__((constructor)) static void XCTestMainEntryPoint(void) { FBDebugLog(@"[XCTestMainEntryPoint] Running inside: %@", [[NSBundle mainBundle] bundleIdentifier]); if (!NSProcessInfo.processInfo.environment[kEnv_ShimStartXCTest]) { @@ -45,7 +45,7 @@ FBDebugLog(@"[XCTestMainEntryPoint] End of XCTestMainEntryPoint"); } -BOOL FBLoadXCTestIfNeeded() +BOOL FBLoadXCTestIfNeeded(void) { FBDebugLog(@"Env: %@", [NSProcessInfo processInfo].environment); @@ -84,7 +84,7 @@ BOOL FBLoadXCTestIfNeeded() return NO; } -void FBDeployBlockWhenAppLoads(void(^mainBlock)()) { +void FBDeployBlockWhenAppLoads(void(^mainBlock)(void)) { #if TARGET_OS_IPHONE NSString *notification = UIApplicationDidFinishLaunchingNotification; #elif TARGET_OS_MAC @@ -113,7 +113,7 @@ static id XCTestCase__xctTestIdentifier(id self, SEL sel) return [[XCTTestIdentifier_class alloc] initWithStringRepresentation:[NSString stringWithFormat:@"%@/%@", classNameOut, methodNameOut] preserveModulePrefix:YES]; } -BOOL FBXCTestMain() +BOOL FBXCTestMain(void) { if (!FBLoadXCTestIfNeeded()) { exit(TestShimExitCodeXCTestFailedLoading); diff --git a/Shims/Shimulator/TestReporterShim/XCTestReporterShim.m b/Shims/Shimulator/TestReporterShim/XCTestReporterShim.m index dae0a211f..5a04f801e 100644 --- a/Shims/Shimulator/TestReporterShim/XCTestReporterShim.m +++ b/Shims/Shimulator/TestReporterShim/XCTestReporterShim.m @@ -21,7 +21,6 @@ static NSString *const XCTestFilterArg = @"XCTest"; static NSString *const XCTestFrameworkName = @"XCTest"; -static NSString *const XCTestProbeClassName = @"XCTestProbe"; static NSString *const XCTestSuiteClassName = @"XCTestSuite"; static FILE *__stdout; @@ -64,16 +63,6 @@ return tests; } -// Key used by objc_setAssociatedObject -static int TestDescriptionKey; - -static NSString *TestCase_nameOrDescription(id self, SEL cmd) -{ - id description = objc_getAssociatedObject(self, &TestDescriptionKey); - NSCAssert(description != nil, @"Value for `TestNameKey` wasn't set."); - return description; -} - static char *const kEventQueueLabel = "xctool.events"; @interface XCToolAssertionHandler : NSAssertionHandler @@ -98,7 +87,7 @@ - (void)handleFailureInFunction:(NSString *)functionName @end -static dispatch_queue_t EventQueue() +static dispatch_queue_t EventQueue(void) { static dispatch_queue_t eventQueue = {0}; static dispatch_once_t onceToken; @@ -355,7 +344,7 @@ static void XCPerformTestWithSuppressedExpectedAssertionFailures(id self, SEL or [currentThreadDict removeObjectForKey:NSAssertionHandlerKey]; } -static void XCWaitForDebuggerIfNeeded() +static void XCWaitForDebuggerIfNeeded(void) { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ @@ -428,7 +417,7 @@ static BOOL XCTestCase__enableSymbolication(id self, SEL sel) * to the pipe reader. Printing "\n" should be safe because reader is skipping * empty lines. */ -static void PrintNewlineAndCloseFDs() +static void PrintNewlineAndCloseFDs(void) { if (__stdout == NULL) { return; @@ -440,7 +429,7 @@ static void PrintNewlineAndCloseFDs() #pragma mark - Entry -static void SwizzleXCTestMethodsIfAvailable() +static void SwizzleXCTestMethodsIfAvailable(void) { if ([[[NSBundle mainBundle] bundleIdentifier] hasPrefix:@"com.apple.dt.xctest"]) { // Start from Xcode 11.1, XCTest will try to connect to testmanagerd service @@ -685,7 +674,7 @@ static id SimServiceContext_deviceSetWithPath_error(id cls, SEL sel, NSString *p return msgsend(cls, originalSelector, simDeviceSetPath, error); } -static void SwizzleXcodebuildMethods() +static void SwizzleXcodebuildMethods(void) { static dispatch_once_t token; dispatch_once(&token, ^{ @@ -706,7 +695,7 @@ static void SwizzleXcodebuildMethods() }); } -__attribute__((constructor)) static void EntryPoint() +__attribute__((constructor)) static void EntryPoint(void) { // Unset so we don't cascade into any other process that might be spawned. unsetenv("DYLD_INSERT_LIBRARIES"); @@ -753,7 +742,7 @@ static void SwizzleXcodebuildMethods() } } -__attribute__((destructor)) static void ExitPoint() +__attribute__((destructor)) static void ExitPoint(void) { PrintNewlineAndCloseFDs(); }