Skip to content

Commit cc1a131

Browse files
committed
playlist_manager: gate on HAVE_COCOATOUCH; don't pull into macOS build
GCC 4.0 (Xcode 3.1, PowerPC) reports: RetroArchPlaylistManager.h:14: error: syntax error before 'AT_NAME' token RetroArchPlaylistManager.h/.m uses three Xcode 7+ (2015) features: NS_ASSUME_NONNULL_BEGIN/END nullability macros, the 'nullable' / '_Nonnull' keywords, and Obj-C lightweight generics like NSArray<NSString *>. On Xcode 3.1 / 10.5, NS_ASSUME_NONNULL_BEGIN is an undefined identifier that expands to itself; GCC parses it at file scope, then chokes on the following @interface (reported as 'AT_NAME' in the diagnostic). The file is iOS/tvOS-only by design — its header comment says so, and its only consumer is cocoa_launch_game_by_filename() which is only called from ui_cocoatouch.m. But the griffin build pulled it in whenever HAVE_COCOA || HAVE_COCOATOUCH || HAVE_COCOA_METAL was set, which is too broad: plain HAVE_COCOA (macOS) doesn't need it. Narrow the gating to HAVE_COCOATOUCH, matching the idiom already used elsewhere in cocoa_common.m: - griffin/griffin_objc.m: wrap RetroArchPlaylistManager.m include - ui/drivers/cocoa/cocoa_common.m: wrap the header include and the entire cocoa_launch_game_by_filename() definition - ui/drivers/cocoa/cocoa_common.h: wrap the forward declaration iOS/tvOS builds are unaffected — they define HAVE_COCOATOUCH and pull everything in as before. macOS builds (HAVE_COCOA without HAVE_COCOATOUCH) lose cocoa_launch_game_by_filename(), which they never called anyway.
1 parent 6c37fb0 commit cc1a131

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

griffin/griffin_objc.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@
3232
#if defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL)
3333

3434
#include "../ui/drivers/cocoa/cocoa_common.m"
35+
#ifdef HAVE_COCOATOUCH
36+
/* RetroArchPlaylistManager is iOS/tvOS-only and uses Obj-C
37+
* lightweight generics + nullability macros (Xcode 7+, 2015).
38+
* Don't pull it into the macOS build - GCC 4.0 can't parse it. */
3539
#include "../ui/drivers/cocoa/RetroArchPlaylistManager.m"
40+
#endif
3641
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
3742
#include "../gfx/drivers_context/cocoa_gl_ctx.m"
3843
#endif

ui/drivers/cocoa/cocoa_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ void cocoa_show_mouse(void *data, bool state);
128128

129129
void *cocoa_screen_get_chosen(void);
130130

131+
#ifdef HAVE_COCOATOUCH
131132
bool cocoa_launch_game_by_filename(NSString *filename);
133+
#endif
132134

133135
#ifdef HAVE_COCOATOUCH
134136
float cocoa_screen_get_native_scale(void);

ui/drivers/cocoa/cocoa_common.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include "cocoa_common.h"
2424
#include "apple_platform.h"
2525
#include "../ui_cocoa.h"
26+
#ifdef HAVE_COCOATOUCH
2627
#include "RetroArchPlaylistManager.h"
28+
#endif
2729

2830
#ifdef HAVE_COCOATOUCH
2931
#import "../../pkg/apple/WebServer/GCDWebUploader/GCDWebUploader.h"
@@ -1180,6 +1182,7 @@ void cocoa_file_load_with_detect_core(const char *filename)
11801182
}
11811183
}
11821184

1185+
#ifdef HAVE_COCOATOUCH
11831186
bool cocoa_launch_game_by_filename(NSString *filename)
11841187
{
11851188
core_info_list_t *core_info_list = NULL;
@@ -1276,3 +1279,4 @@ bool cocoa_launch_game_by_filename(NSString *filename)
12761279
return task_push_load_content_with_new_core_from_companion_ui(
12771280
info->path, full_path, NULL, NULL, NULL, &content_info, NULL, NULL);
12781281
}
1282+
#endif /* HAVE_COCOATOUCH */

0 commit comments

Comments
 (0)