Bug 267207 - Fix warnings found by compiling with -Wformat in open source clang-17
Summary: Fix warnings found by compiling with -Wformat in open source clang-17
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-01-07 09:00 PST by David Kilzer (:ddkilzer)
Modified: 2024-02-15 14:05 PST (History)
1 user (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-07 09:00:12 PST
Fix warnings found by compiling with -Wformat in open source clang-17.


Examples:


Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp:508:79: error: format specifies type 'unsigned char' but the argument has type 'ExceptionCode' [-Werror,-Wformat]
  508 |                 RELEASE_LOG_ERROR(WebRTC, "Adding ice candidate failed %hhu", result.exception().code());
      |                                                                        ~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                               static_cast<uint8_t>(    )


Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:174:168: error: format specifies type 'int' but the argument has type 'Profile' [-Werror,-Wformat]
  174 |         RELEASE_LOG_ERROR(MediaStream, "VideoSampleBufferCompressor VTSessionSetProperty kVTCompressionPropertyKey_ProfileLevel failed with %d for profile %d", error, m_profile);
      |                                                                                                                                                            ~~          ^~~~~~~~~
      |                                                                                                                                                                        static_cast<int>( )


Source/WebCore/workers/service/server/SWServer.cpp:1654:131: error: format specifies type 'unsigned char' but the argument has type 'ServiceWorkerState' [-Werror,-Wformat]
 1654 |     RELEASE_LOG(ServiceWorker, "SWServer::fireFunctionalEvent serviceWorkerID=%llu, state=%hhu", worker->identifier().toUInt64(), worker->state());
      |                                                                                           ~~~~                                    ^~~~~~~~~~~~~~~
      |                                                                                                                                   static_cast<uint8_t>( )


Source/WebCore/workers/service/ServiceWorker.cpp:72:85: error: format specifies type 'unsigned char' but the argument has type 'ServiceWorkerState' [-Werror,-Wformat]
   72 |     WORKER_RELEASE_LOG("serviceWorkerID=%llu, state=%hhu", identifier().toUInt64(), m_data.state);
      |                                                     ~~~~                            ^~~~~~~~~~~~
      |                                                                                     static_cast<uint8_t>( )

Source/WebCore/workers/service/ServiceWorker.cpp:83:139: error: format specifies type 'unsigned char' but the argument has type 'ServiceWorkerState' [-Werror,-Wformat]
   83 |     WORKER_RELEASE_LOG("updateState: Updating service worker %llu state from %hhu to %hhu. registrationID=%llu", identifier().toUInt64(), m_data.state, state, registrationIdentifier().toUInt64());
      |                                                                              ~~~~                                                         ^~~~~~~~~~~~
      |                                                                                                                                           static_cast<uint8_t>( )

Source/WebCore/workers/service/ServiceWorker.cpp:83:153: error: format specifies type 'unsigned char' but the argument has type 'State' (aka 'WebCore::ServiceWorkerState') [-Werror,-Wformat]
   83 |     WORKER_RELEASE_LOG("updateState: Updating service worker %llu state from %hhu to %hhu. registrationID=%llu", identifier().toUInt64(), m_data.state, state, registrationIdentifier().toUInt64());
      |                                                                                      ~~~~                                                               ^~~~~
      |                                                                                                                                                         static_cast<uint8_t>( )


Source/WebCore/platform/graphics/cocoa/IOSurface.mm:252:128: error: format specifies type 'int' but the argument has type 'Format' [-Werror,-Wformat]
  252 |         RELEASE_LOG_ERROR(Layers, "IOSurface creation failed for size: (%d %d) and format: (%d)", size.width(), size.height(), format);
      |                                                                                             ~~                                 ^~~~~~
      |                                                                                                                                static_cast<int>( )
Comment 1 Radar WebKit Bug Importer 2024-01-07 09:00:49 PST
<rdar://problem/120610377>
Comment 2 David Kilzer (:ddkilzer) 2024-01-07 09:04:04 PST
Pull request: https://github.com/WebKit/WebKit/pull/22489
Comment 3 EWS 2024-01-07 12:51:36 PST
Committed 272748@main (a221cbe6bf04): <https://commits.webkit.org/272748@main>

Reviewed commits have been landed. Closing PR #22489 and removing active labels.
Comment 4 David Kilzer (:ddkilzer) 2024-01-09 12:42:16 PST
Re-opening for pull request https://github.com/WebKit/WebKit/pull/22551
Comment 5 EWS 2024-01-09 13:35:25 PST
Committed 272826@main (d0259b024eaa): <https://commits.webkit.org/272826@main>

Reviewed commits have been landed. Closing PR #22551 and removing active labels.