Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 44aa509992c1d3961636c42252d073972a2b2394
      
https://github.com/WebKit/WebKit/commit/44aa509992c1d3961636c42252d073972a2b2394
  Author: Bartosz Moczulski <[email protected]>
  Date:   2024-11-06 (Wed, 06 Nov 2024)

  Changed paths:
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp

  Log Message:
  -----------
  Make const maxTitleLength function-local to avoid redefinition
https://bugs.webkit.org/show_bug.cgi?id=282039

Reviewed by Elliott Williams.

With UnifiedSources `--max-bundle-size` set to 16 it is possible for
WebLocalFrameLoaderClient.cpp and WebChromeClient.cpp to end up in a
single compilation unit. The fact that they both contain a static
`maxTitleLength` constant in `WebKit` namespace results in an ODR
violation during an attempt to compile them both together.

The constants are moved into respective functions where they are
actually used, similarly to how the same constant is already placed in
SessionStateConversion.cpp.

Error:

    In file included from 
[...]/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-12.cpp:15:
    
[...]/Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:579:27:
 error: redefinition of ‘constexpr const unsigned int WebKit::maxTitleLength’
      579 | static constexpr unsigned maxTitleLength = 1000; // Closest power 
of 10 above the W3C recommendation for Title length.
          |                           ^~~~~~~~~~~~~~
    In file included from 
[...]/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-12.cpp:3:
    [...]/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:827:27: 
note: ‘constexpr const unsigned int WebKit::maxTitleLength’ previously defined 
here
      827 | static constexpr unsigned maxTitleLength = 1000; // Closest power 
of 10 above the W3C recommendation for Title length.
          |                           ^~~~~~~~~~~~~~

* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::print):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::dispatchDidReceiveTitle):

Canonical link: https://commits.webkit.org/286230@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to