Bug 251989 - Cocoa availability macros are not working for non-WebKit sources on buildbots
Summary: Cocoa availability macros are not working for non-WebKit sources on buildbots
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kimmo Kinnunen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-02-09 07:05 PST by Kimmo Kinnunen
Modified: 2023-02-09 07:28 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2023-02-09 07:05:28 PST
Cocoa availability macros are not working for non-WebKit sources on buildbots 

After running configure-xcode-for-embedded-development, the Cocoa WebKit OpenSource SDK is left in following state:
- Correct code does not build with the WebKit OpenSource SDK
- Incorrect code builds with the SDK, but does not build on real, unmodified SDK

This is because WebKit erases the availability macros from the SDK.

Consider case:
enum A {
  CommonOption,
  MacOSOption API_UNAVAILABLE(ios)
};

bool correctFunc(A a) {
  switch (a) {
  case CommonOption:
      return true;
#if defined(TARGET_OS_MAC)
  case MacOSOption:
      return false;
#endif
  } 
}

bool incorrectFunc(A a) {
  switch (a) {
  case CommonOption:
      return true;
  case MacOSOption:
      return false;
  } 
}

bool incorrectAndConfusingButCompilingFunc(A a) {
  switch (a) {
  case CommonOption:
      return true;
#if defined(TARGET_OS_MAC)
  case MacOSOption:
      return false;
#endif
  default:
      UNREACHABLE();
      return false;
  } 
}

 - correctFunc does not compile on WebKit SDK. This the bug we want to fix.
 - WebKit code needs to use incorrectFunc. This is the bug we want to fix.
 - incorrectFunc does not compile on unmodified SDK. This is the feature we want to preserve.


This becomes a problem when contributing to ANGLE:
 - If we contribute incorrect code to ANGLE, it doesn't compile for the rest of the world.
 - If we contribute correct code to ANGLE, it doesn't compile for WebKit.
 - Currently we have to use the workaround incorrectAndConfusingButCompilingFunc
Comment 1 Radar WebKit Bug Importer 2023-02-09 07:07:25 PST
<rdar://problem/105221617>
Comment 2 Kimmo Kinnunen 2023-02-09 07:28:05 PST
Pull request: https://github.com/WebKit/WebKit/pull/9869