Skip to content

Commit

Permalink
courgette: Use BUILDFLAG for OS checking
Browse files Browse the repository at this point in the history
Use BUILDFLAG(IS_XXX) instead of defined(OS_XXX).

Generated by `os_buildflag_migration.py` (https://crrev.com/c/3311983).

R=thakis@chromium.org

Bug: 1234043
Test: No functionality change
Change-Id: Iafa31a6b9efa9cf94ad0930f83eedac5152fc762
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3373751
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#956759}
  • Loading branch information
xhwang-chromium authored and Chromium LUCI CQ committed Jan 8, 2022
1 parent ea7363b commit 9a8720c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion courgette/courgette_minimal_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <string>

#include "build/build_config.h"
#include "courgette/courgette.h"
#include "courgette/streams.h"
#include "courgette/third_party/bsdiff/bsdiff.h"
Expand All @@ -31,7 +32,7 @@ void Problem(const char* message) {
exit(1);
}

#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
int wmain(int argc, const wchar_t* argv[]) {
#else
int main(int argc, const char* argv[]) {
Expand Down
3 changes: 2 additions & 1 deletion courgette/ensemble_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "build/build_config.h"
#include "courgette/base_test_unittest.h"
#include "courgette/courgette.h"
#include "courgette/streams.h"

#if defined(OS_WIN) && !defined(NDEBUG)
#if BUILDFLAG(IS_WIN) && !defined(NDEBUG)
// Ensemble tests still take too long on Debug Windows so disabling for now
// TODO(dgarrett) http://code.google.com/p/chromium/issues/detail?id=101614
#define MAYBE_PE DISABLED_PE
Expand Down
3 changes: 2 additions & 1 deletion courgette/memory_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
#include <map>

#include "base/files/file_util.h"
#include "build/build_config.h"

#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)

#include <windows.h>

Expand Down
3 changes: 2 additions & 1 deletion courgette/memory_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/process/memory.h"
#include "build/build_config.h"

#ifndef NDEBUG

Expand Down Expand Up @@ -86,7 +87,7 @@ struct UncheckedDeleter {
inline void operator()(T* ptr) const { UncheckedDelete(ptr); }
};

#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)

// Manages a read/write virtual mapping of a physical file.
class FileMapping {
Expand Down
5 changes: 3 additions & 2 deletions courgette/third_party/bsdiff/paged_array_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
#include <random>
#include <vector>

#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

#if !defined(ADDRESS_SANITIZER) || !defined(OS_WIN)
#if !defined(ADDRESS_SANITIZER) || !BUILDFLAG(IS_WIN)
// Total allocation of 4GB will fail in 32 bit programs if allocations are
// leaked.
const int kIterations = 20;
Expand Down Expand Up @@ -136,7 +137,7 @@ class PagedArrayTest : public testing::Test {

// AddressSanitizer on Windows adds additional memory overhead, which
// causes these tests to go OOM and fail.
#if !defined(ADDRESS_SANITIZER) || !defined(OS_WIN)
#if !defined(ADDRESS_SANITIZER) || !BUILDFLAG(IS_WIN)
TEST_F(PagedArrayTest, TestManyAllocationsDestructorFree) {
for (int i = 0; i < kIterations; ++i) {
courgette::PagedArray<int> a;
Expand Down

0 comments on commit 9a8720c

Please sign in to comment.