Skip to content

Commit 218e32d

Browse files
tsepezcopybara-github
authored andcommitted
Remove file-wide unsafe buffer pragamas in partition alloc.
Automated using tools/clang/unsafe_pragam_rewriter scripts. The previous bulk edit modified all files, even those that might have been compliant, so many of these will be no-op changes. Change-Id: Ie0614a41d0162adc9f5bea8b8d74d1726bc87055 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6819800 Commit-Queue: Tom Sepez <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Cr-Commit-Position: refs/heads/main@{#1496646} NOKEYCHECK=True GitOrigin-RevId: 91729f29e9465cd45335c5cbb3970adeac7a0619
1 parent a25ec88 commit 218e32d

31 files changed

+92
-207
lines changed

src/partition_alloc/dangling_raw_ptr_checks.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include "partition_alloc/dangling_raw_ptr_checks.h"
116

127
#include "partition_alloc/partition_alloc_base/component_export.h"

src/partition_alloc/internal_allocator.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include "partition_alloc/internal_allocator.h"
116

127
namespace partition_alloc::internal {

src/partition_alloc/oom_callback.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include "partition_alloc/oom_callback.h"
116

127
#include "partition_alloc/partition_alloc_check.h"

src/partition_alloc/partition_alloc_base/compiler_specific.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
495495

496496
// Annotates code indicating that it should be permanently exempted from
497497
// `-Wunsafe-buffer-usage`. For temporary cases such as migrating callers to
498-
// safer patterns, use `UNSAFE_TODO()` instead;
498+
// safer patterns, use `PA_UNSAFE_TODO()` instead;
499499
#if defined(__clang__)
500500
// Disabling `clang-format` allows each `_Pragma` to be on its own line, as
501501
// recommended by https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html.

src/partition_alloc/partition_alloc_base/containers/flat_map_pa_unittest.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include <string>
116
#include <string_view>
127
#include <type_traits>

src/partition_alloc/partition_alloc_base/containers/flat_tree_pa_unittest.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include "partition_alloc/partition_alloc_base/containers/flat_tree.h"
116
#include "partition_alloc/partition_alloc_base/cxx20_identity.h"
127

@@ -70,7 +65,7 @@ class InputIterator {
7065
pointer operator->() const { return it_; }
7166

7267
InputIterator& operator++() {
73-
++it_;
68+
PA_UNSAFE_TODO(++it_);
7469
return *this;
7570
}
7671
InputIterator operator++(int) {

src/partition_alloc/partition_alloc_base/debug/alias.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include "partition_alloc/partition_alloc_base/debug/alias.h"
116

127
#include "partition_alloc/partition_alloc_base/compiler_specific.h"

src/partition_alloc/partition_alloc_base/files/file_util_posix.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include "partition_alloc/partition_alloc_base/files/file_util.h"
116

7+
#include "partition_alloc/partition_alloc_base/compiler_specific.h"
128
#include "partition_alloc/partition_alloc_base/posix/eintr_wrapper.h"
139

1410
namespace partition_alloc::internal::base {
1511

1612
bool ReadFromFD(int fd, char* buffer, size_t bytes) {
1713
size_t total_read = 0;
1814
while (total_read < bytes) {
19-
ssize_t bytes_read =
20-
WrapEINTR(read)(fd, buffer + total_read, bytes - total_read);
15+
ssize_t bytes_read = WrapEINTR(read)(
16+
fd, PA_UNSAFE_TODO(buffer + total_read), bytes - total_read);
2117
if (bytes_read <= 0) {
2218
break;
2319
}

src/partition_alloc/partition_alloc_base/no_destructor_pa_unittest.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include <vector>
116

127
#include "partition_alloc/partition_alloc_base/compiler_specific.h"

src/partition_alloc/partition_alloc_base/process/process_handle_posix.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifdef UNSAFE_BUFFERS_BUILD
6-
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7-
#pragma allow_unsafe_buffers
8-
#endif
9-
105
#include "partition_alloc/partition_alloc_base/process/process_handle.h"
116

127
#include <unistd.h>

0 commit comments

Comments
 (0)