mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Silence false positive -Warray-bounds warning
This regression has been reported to GCC's Bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109727 The formatting change looks like a clang-format 15 bug :(
This commit is contained in:
parent
fc003cd248
commit
8df5bd53da
Notes:
sideshowbarker
2024-07-17 05:00:08 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/8df5bd53da Pull-request: https://github.com/SerenityOS/serenity/pull/18766 Reviewed-by: https://github.com/ADKaster
1 changed files with 16 additions and 2 deletions
|
@ -117,10 +117,24 @@ public:
|
|||
[[nodiscard]] bool is_empty() const { return m_size == 0; }
|
||||
[[nodiscard]] size_t size() const { return m_size; }
|
||||
|
||||
[[nodiscard]] u8* data() { return m_inline ? m_inline_buffer : m_outline_buffer; }
|
||||
#ifdef AK_COMPILER_GCC
|
||||
# pragma GCC diagnostic push
|
||||
// Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109727
|
||||
# pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
#endif
|
||||
[[nodiscard]] u8* data()
|
||||
{
|
||||
return m_inline ? m_inline_buffer : m_outline_buffer;
|
||||
}
|
||||
[[nodiscard]] u8 const* data() const { return m_inline ? m_inline_buffer : m_outline_buffer; }
|
||||
#ifdef AK_COMPILER_GCC
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
[[nodiscard]] Bytes bytes() { return { data(), size() }; }
|
||||
[[nodiscard]] Bytes bytes()
|
||||
{
|
||||
return { data(), size() };
|
||||
}
|
||||
[[nodiscard]] ReadonlyBytes bytes() const { return { data(), size() }; }
|
||||
|
||||
[[nodiscard]] AK::Bytes span() { return { data(), size() }; }
|
||||
|
|
Loading…
Reference in a new issue