Bug 267269 - Add -Wno-availability to WARNING_FLAGS when building with clang static analyzer
Summary: Add -Wno-availability to WARNING_FLAGS when building with clang static analyzer
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-01-09 07:45 PST by David Kilzer (:ddkilzer)
Modified: 2024-01-23 17:18 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2024-01-09 07:45:52 PST
Add -Wno-availability to WARNING_FLAGS when building with clang static analyzer.

The clang static analyzer from open source clang-17 doesn't know about the iosmac platform, so we get a stream of warnings-as-errors with -Wavailability checks.

Example:

WebKitBuild/Release/usr/local/include/pal/spi/cocoa/AVFoundationSPI.h:440:94: error: unknown platform 'iosmac' in availability macro [-Werror,-Wavailability]
  440 | - (instancetype)initWithAssumedIdentity:(tcc_identity_t)tccIdentity SPI_AVAILABLE(ios(15.0)) API_UNAVAILABLE(macos, macCatalyst, watchos, tvos);
      |                                                                                              ^
In file included from Source/WebCore/PAL/pal/avfoundation/OutputDevice.mm:26:
In file included from Source/WebCore/PAL/config.h:36:
In file included from WebKitBuild/Release/usr/local/include/wtf/FastMalloc.h:26:
In file included from WebKitBuild/Release/usr/local/include/wtf/StdLibExtras.h:34:
In file included from WebKitBuild/Release/usr/local/include/wtf/Assertions.h:55:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.Internal.sdk/usr/include/os/log.h:11:
/Applications/Xcode2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.Internal.sdk/usr/include/os/availability.h:154:169: note: expanded from macro 'API_UNAVAILABLE'
  154 |     #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE8,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1,__API_UNAVAILABLE0,0)(__VA_ARGS__)
      |                                                                                                                                                                         ^
1 error generated.
Comment 1 Radar WebKit Bug Importer 2024-01-09 07:46:07 PST
<rdar://problem/120711320>
Comment 2 David Kilzer (:ddkilzer) 2024-01-09 12:25:53 PST
Pull request: https://github.com/WebKit/WebKit/pull/22550
Comment 3 Elliott Williams 2024-01-10 11:45:20 PST
> WebKitBuild/Release/usr/local/include/pal/spi/cocoa/AVFoundationSPI.h:440:94: error: unknown platform 'iosmac' in availability macro [-Werror,-Wavailability]
>   440 | - (instancetype)initWithAssumedIdentity:(tcc_identity_t)tccIdentity SPI_AVAILABLE(ios(15.0)) API_UNAVAILABLE(macos, macCatalyst, watchos, tvos);
>       |                                                                                              ^

It's weird that this is complaining about "iosmac" when the declaration says "macCatalyst".

Upstream clang does appear to know about "maccatalyst": https://github.com/llvm/llvm-project/blob/a1dc813f759955ddbcf9b12ed052dfc8a07fdf4a/clang/include/clang/Basic/Attr.td#L974C29-L974C29
Comment 4 Elliott Williams 2024-01-10 12:05:31 PST
Ah, usr/include/AvailabilityInternal.h is rewrites "macCatalyst" to "iosmac" in the internal SDK only. I've filed rdar://120799823 with more information.
Comment 5 Elliott Williams 2024-01-10 12:06:47 PST
(Re-posting <rdar://problem/120711320> to make the bug importer happy.)
Comment 6 David Kilzer (:ddkilzer) 2024-01-10 18:02:46 PST
Not going to land this fix.  See the PR for details (this is not a supported configuration):

<https://github.com/WebKit/WebKit/pull/22550#issuecomment-1886077808>