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.
This commit is contained in:
U-DESKTOP-SPFP6AQ\twistedtechre committed 2026-04-21 02:12:57 +02:00
1 parent 6c37fb0da1
commit cc1a131860
3 files changed
+11

No files matched your search

+5
View File
@@ -32,7 +32,12 @@
#if defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL)
#include "../ui/drivers/cocoa/cocoa_common.m"
#ifdef HAVE_COCOATOUCH
/* RetroArchPlaylistManager is iOS/tvOS-only and uses Obj-C
* lightweight generics + nullability macros (Xcode 7+, 2015).
* Don't pull it into the macOS build - GCC 4.0 can't parse it. */
#include "../ui/drivers/cocoa/RetroArchPlaylistManager.m"
#endif
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
#include "../gfx/drivers_context/cocoa_gl_ctx.m"
#endif
+2
View File
@@ -128,7 +128,9 @@ void cocoa_show_mouse(void *data, bool state);
void *cocoa_screen_get_chosen(void);
#ifdef HAVE_COCOATOUCH
bool cocoa_launch_game_by_filename(NSString *filename);
#endif
#ifdef HAVE_COCOATOUCH
float cocoa_screen_get_native_scale(void);
+4
View File
@@ -23,7 +23,9 @@
#include "cocoa_common.h"
#include "apple_platform.h"
#include "../ui_cocoa.h"
#ifdef HAVE_COCOATOUCH
#include "RetroArchPlaylistManager.h"
#endif
#ifdef HAVE_COCOATOUCH
#import "../../pkg/apple/WebServer/GCDWebUploader/GCDWebUploader.h"
@@ -1180,6 +1182,7 @@ void cocoa_file_load_with_detect_core(const char *filename)
}
}
#ifdef HAVE_COCOATOUCH
bool cocoa_launch_game_by_filename(NSString *filename)
{
core_info_list_t *core_info_list = NULL;
@@ -1276,3 +1279,4 @@ bool cocoa_launch_game_by_filename(NSString *filename)
return task_push_load_content_with_new_core_from_companion_ui(
info->path, full_path, NULL, NULL, NULL, &content_info, NULL, NULL);
}
#endif /* HAVE_COCOATOUCH */