Skip to content

Commit

Permalink
Hide the unsafe buffers pragmas if there's no unsafe buffers attribute
Browse files Browse the repository at this point in the history
Clang doesn't have a way to query if a pragma exists, so assume the
pragmas are present if the attribute is present, and not otherwise.

This avoids -Werror=unknown-pragmas on older/system clang.

[email protected]

Bug: 40284755
Change-Id: I3254640c7561e5adaabbe89fdb46619dddf53ece
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/5440553
Reviewed-by: Mark Mentovai <[email protected]>
  • Loading branch information
danakj authored and markmentovai committed Apr 9, 2024
1 parent 2eee431 commit dd821d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler_specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
// explanation requires cooperation of code that is not fully encapsulated close
// to the UNSAFE_BUFFERS() usage, it should be rejected and replaced with safer
// coding patterns or stronger guarantees.
#if defined(__clang__)
#if defined(__clang__) && HAS_ATTRIBUTE(unsafe_buffer_usage)
// clang-format off
// Formatting is off so that we can put each _Pragma on its own line, as
// recommended by the gcc docs.
Expand Down

0 comments on commit dd821d3

Please sign in to comment.