Commit 51938fff authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

crdmg: Use __builtin_available/availability instead of -mmacosx-version-min.

We can't use @available in this file because that is only available
in Objective C.

Bug: 735328
Change-Id: I09ed1b2bcc46fceafc4bfb84800d18177fd4f4a3
Reviewed-on: https://chromium-review.googlesource.com/566956Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarJialiu Lin <jialiul@chromium.org>
Reviewed-by: default avatarSidney San Martin <sdy@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485783}
parent 7f1241d2
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/sysroot.gni")
import("//testing/libfuzzer/fuzzer_test.gni") import("//testing/libfuzzer/fuzzer_test.gni")
source_set("mac") { source_set("mac") {
...@@ -49,19 +48,6 @@ source_set("dmg_common") { ...@@ -49,19 +48,6 @@ source_set("dmg_common") {
public_configs = [ ":dmg_public_config" ] public_configs = [ ":dmg_public_config" ]
} }
config("10_10_config") {
cflags = [
"-isysroot",
sysroot,
"-mmacosx-version-min=10.10",
]
ldflags = [
"-isysroot",
sysroot,
"-mmacosx-version-min=10.10",
]
}
executable("crdmg") { executable("crdmg") {
sources = [ sources = [
"crdmg.cc", "crdmg.cc",
...@@ -72,9 +58,6 @@ executable("crdmg") { ...@@ -72,9 +58,6 @@ executable("crdmg") {
"//base", "//base",
"//sandbox/mac:seatbelt", "//sandbox/mac:seatbelt",
] ]
configs -= [ "//build/config/compiler:runtime_library" ]
configs += [ ":10_10_config" ]
} }
fuzzer_test("safe_browsing_dmg_fuzzer") { fuzzer_test("safe_browsing_dmg_fuzzer") {
......
...@@ -53,7 +53,7 @@ class SafeDMG { ...@@ -53,7 +53,7 @@ class SafeDMG {
bool EnableSandbox(); bool EnableSandbox();
// Performs the actual DMG operation. // Performs the actual DMG operation.
bool ParseDMG(); __attribute__((availability(macos, introduced = 10.10))) bool ParseDMG();
base::File dmg_file_; base::File dmg_file_;
...@@ -91,8 +91,13 @@ int SafeDMG::Main(int argc, const char* argv[]) { ...@@ -91,8 +91,13 @@ int SafeDMG::Main(int argc, const char* argv[]) {
if (!EnableSandbox()) if (!EnableSandbox())
return EXIT_FAILURE; return EXIT_FAILURE;
if (__builtin_available(macOS 10.10, *)) {
if (!ParseDMG()) if (!ParseDMG())
return EXIT_FAILURE; return EXIT_FAILURE;
} else {
LOG(ERROR) << "Requires 10.10 or higher";
return EXIT_FAILURE;
}
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment