Skip to content

Commit

Permalink
GCC and MSVC fixes.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 462270835
  • Loading branch information
kyessenov committed Jul 21, 2022
1 parent f6cff9f commit 557e813
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions base/internal/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ enum class DataLocality {
// at least `sizeof(void*)`.
class Data {};

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"

// Empty base class indicating class must be stored directly in the handle and
// not allocated separately on the heap.
//
Expand Down Expand Up @@ -162,6 +165,8 @@ class HeapData /* : public Data */ {
0;
};

#pragma GCC diagnostic pop

// Provides introspection for `Data`.
class Metadata final {
public:
Expand Down
4 changes: 2 additions & 2 deletions base/memory_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ std::optional<ArenaBlock> ArenaBlockAllocate(size_t size,
pointer = VirtualAlloc(hint, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
if (ABSL_PREDICT_FALSE(pointer == nullptr)) {
if (hint == nullptr) {
return absl::nullopt;
return std::nullopt;
}
// Try again, without the hint.
pointer =
VirtualAlloc(nullptr, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
if (pointer == nullptr) {
return absl::nullopt;
return std::nullopt;
}
}
#endif
Expand Down

0 comments on commit 557e813

Please sign in to comment.