[webkit-changes] [WebKit/WebKit] 22343e: Add support for suppressing clang static analyzer ...

Commit Queue noreply at github.com
Wed Jan 24 18:49:57 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 22343e69f00f3f26fc5df4016a301a654b1c0bc3
      https://github.com/WebKit/WebKit/commit/22343e69f00f3f26fc5df4016a301a654b1c0bc3
  Author: David Kilzer <ddkilzer at apple.com>
  Date:   2024-01-24 (Wed, 24 Jan 2024)

  Changed paths:
    M Source/WTF/wtf/Compiler.h
    M Tools/TestWebKitAPI/Tests/WTF/CheckedPtr.cpp
    M Tools/TestWebKitAPI/Tests/WTF/CompactPtr.cpp
    M Tools/TestWebKitAPI/Tests/WTF/CompactRefPtr.cpp
    M Tools/TestWebKitAPI/Tests/WTF/FixedVector.cpp
    M Tools/TestWebKitAPI/Tests/WTF/ListHashSet.cpp
    M Tools/TestWebKitAPI/Tests/WTF/NakedPtr.cpp
    M Tools/TestWebKitAPI/Tests/WTF/PackedRefPtr.cpp
    M Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp
    M Tools/TestWebKitAPI/Tests/WTF/URL.cpp
    M Tools/TestWebKitAPI/Tests/WTF/Vector.cpp
    M Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp
    M Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp
    M Tools/TestWebKitAPI/Tests/WTF/cocoa/TypeCastsCocoa.mm
    M Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm
    M Tools/TestWebKitAPI/Tests/WebKit/cocoa/WeakObjCPtr.mm

  Log Message:
  -----------
  Add support for suppressing clang static analyzer issues with [[clang::suppress]]
https://bugs.webkit.org/show_bug.cgi?id=267981
<rdar://121489134>

Reviewed by Alex Christensen and Darin Adler.

This adds support for the `[[clang::suppress]]` attribute in clang-17.

Currently there is no way to ignore specific analyzer warnings, but the
macros add support for documenting the warning(s) in case support is
added later.

The `[[clang::suppress]]` attribute can be applied to a single line of
code or to a block of code.

* Source/WTF/wtf/Compiler.h:
(COMPILER_HAS_ATTRIBUTE): Add.
- Define helper macro since __has_attribute() is used more than once.
(COMPILER_HAS_CLANG_FEATURE):
- Update documentation link to https.
(FALLTHROUGH):
(NOT_TAIL_CALLED):
- Use COMPILER_HAS_ATTRIBUTE().
(IGNORE_CLANG_STATIC_ANALYZER_WARNINGS_ATTRIBUTE): Add.
(IGNORE_CLANG_STATIC_ANALYZER_WARNINGS_BEGIN): Add.
(IGNORE_CLANG_STATIC_ANALYZER_WARNINGS_END): Add.
- Add support for the [[clang::suppress]] attribute.
(IGNORE_CLANG_STATIC_ANALYZER_USE_AFTER_MOVE_ATTRIBUTE): Add.
(TLS_MODEL_INITIAL_EXEC):
- Use COMPILER_HAS_ATTRIBUTE().

* Tools/TestWebKitAPI/Tests/WTF/CheckedPtr.cpp:
* Tools/TestWebKitAPI/Tests/WTF/CompactPtr.cpp:
* Tools/TestWebKitAPI/Tests/WTF/CompactRefPtr.cpp:
* Tools/TestWebKitAPI/Tests/WTF/FixedVector.cpp:
* Tools/TestWebKitAPI/Tests/WTF/ListHashSet.cpp:
* Tools/TestWebKitAPI/Tests/WTF/NakedPtr.cpp:
* Tools/TestWebKitAPI/Tests/WTF/PackedRefPtr.cpp:
* Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp:
* Tools/TestWebKitAPI/Tests/WTF/URL.cpp:
* Tools/TestWebKitAPI/Tests/WTF/Vector.cpp:
* Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp:
* Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp:
* Tools/TestWebKitAPI/Tests/WTF/cocoa/TypeCastsCocoa.mm:
* Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm:
* Tools/TestWebKitAPI/Tests/WebKit/cocoa/WeakObjCPtr.mm:
- Ignore expected cplusplus.Move warnings using
  IGNORE_CLANG_STATIC_ANALYZER_USE_AFTER_MOVE_ATTRIBUTE.

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




More information about the webkit-changes mailing list