Avoid use of a Linux-only header in cross-platform code

Change-Id: I358ee1d7e09868e64df1f1dc6c0f49e40099ff16
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2259336
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Eric Astor 2020-06-23 10:03:31 -04:00
parent d9c3e7cb36
commit f4b906c79c
3 changed files with 40 additions and 1 deletions

View File

@ -18,9 +18,14 @@
#include "build/build_config.h"
#include "client/crashpad_info.h"
#include "util/linux/traits.h"
#include "util/misc/as_underlying_type.h"
#if defined(OS_WINDOWS)
#include "util/win/traits.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID)
#include "util/linux/traits.h"
#endif
namespace crashpad {
namespace {

View File

@ -491,11 +491,13 @@ static_library("util") {
"win/scoped_local_alloc.h",
"win/scoped_process_suspend.cc",
"win/scoped_process_suspend.h",
"win/scoped_registry_key.h",
"win/scoped_set_event.cc",
"win/scoped_set_event.h",
"win/session_end_watcher.cc",
"win/session_end_watcher.h",
"win/termination_codes.h",
"win/traits.h",
"win/xp_compat.h",
]

32
util/win/traits.h Normal file
View File

@ -0,0 +1,32 @@
// Copyright 2020 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_UTIL_WIN_TRAITS_H_
#define CRASHPAD_UTIL_WIN_TRAITS_H_
#include <stdint.h>
namespace crashpad {
struct Traits32 {
using Address = DWORD;
};
struct Traits64 {
using Address = DWORD64;
};
} // namespace crashpad
#endif // CRASHPAD_UTIL_WIN_TRAITS_H_