Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 221f446c995477d5ad4370bf381af7e9d58954d3
      
https://github.com/WebKit/WebKit/commit/221f446c995477d5ad4370bf381af7e9d58954d3
  Author: Gerald Squelart <[email protected]>
  Date:   2024-09-19 (Thu, 19 Sep 2024)

  Changed paths:
    M Source/WTF/wtf/Assertions.h
    M Source/WTF/wtf/ThreadSafeRefCounted.h

  Log Message:
  -----------
  Add STATIC_ASSERT_NOT_REACHED_FOR_{TYPE,VALUE}
https://bugs.webkit.org/show_bug.cgi?id=278821
rdar://problem/134888391

Reviewed by Geoffrey Garen.

This is the compile-time equivalent of RELEASE_ASSERT_NOT_REACHED.

It is necessary to provide a type or compile-time value, so that the
static_assert doesn't always trigger. See
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2593r0.html
for more information -- as part of a C++ proposal that would make
that parameter unnecessary.
That parameter will also helpfully be shown in compiler errors.

The Crash() is only there to remove warnings about missing return.

ThreadSafeRefCounted changes show how it can be used, in this case to
guard against enum changes.

* Source/WTF/wtf/Assertions.h:
* Source/WTF/wtf/ThreadSafeRefCounted.h:
(WTF::ThreadSafeRefCounted::deref const):
(WTF::ThreadSafeRefCounted::derefAllowingPartiallyDestroyed const):

Canonical link: https://commits.webkit.org/283957@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