Delete //flutter/fml/compiler_specific.h (#54330)
There were two macros for doing identical things and you can do the thing using standard C++17.
diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
index f73dac7..28bbe47 100644
--- a/ci/licenses_golden/licenses_flutter
+++ b/ci/licenses_golden/licenses_flutter
@@ -41749,7 +41749,6 @@
ORIGIN: ../../../flutter/fml/closure.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/command_line.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/command_line.h + ../../../flutter/LICENSE
-ORIGIN: ../../../flutter/fml/compiler_specific.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/concurrent_message_loop.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/concurrent_message_loop.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/concurrent_message_loop_factory.cc + ../../../flutter/LICENSE
@@ -44634,7 +44633,6 @@
FILE: ../../../flutter/fml/closure.h
FILE: ../../../flutter/fml/command_line.cc
FILE: ../../../flutter/fml/command_line.h
-FILE: ../../../flutter/fml/compiler_specific.h
FILE: ../../../flutter/fml/concurrent_message_loop.cc
FILE: ../../../flutter/fml/concurrent_message_loop.h
FILE: ../../../flutter/fml/concurrent_message_loop_factory.cc
diff --git a/flow/layers/layer.h b/flow/layers/layer.h
index b912207..c64f696 100644
--- a/flow/layers/layer.h
+++ b/flow/layers/layer.h
@@ -19,7 +19,6 @@
#include "flutter/flow/raster_cache.h"
#include "flutter/flow/stopwatch.h"
#include "flutter/fml/build_config.h"
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/trace_event.h"
diff --git a/fml/BUILD.gn b/fml/BUILD.gn
index f7c2714..ab3a6ba 100644
--- a/fml/BUILD.gn
+++ b/fml/BUILD.gn
@@ -18,7 +18,6 @@
"base32.h",
"build_config.h",
"closure.h",
- "compiler_specific.h",
"concurrent_message_loop.cc",
"concurrent_message_loop.h",
"container.h",
diff --git a/fml/compiler_specific.h b/fml/compiler_specific.h
deleted file mode 100644
index 52c9e6c..0000000
--- a/fml/compiler_specific.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 The Flutter Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef FLUTTER_FML_COMPILER_SPECIFIC_H_
-#define FLUTTER_FML_COMPILER_SPECIFIC_H_
-
-#if !defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)
-#error Unsupported compiler.
-#endif
-
-// Annotate a variable indicating it's ok if the variable is not used.
-// (Typically used to silence a compiler warning when the assignment
-// is important for some other reason.)
-// Use like:
-// int x = ...;
-// FML_ALLOW_UNUSED_LOCAL(x);
-#define FML_ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
-
-// Annotate a typedef or function indicating it's ok if it's not used.
-// Use like:
-// typedef Foo Bar ALLOW_UNUSED_TYPE;
-#if defined(__GNUC__) || defined(__clang__)
-#define FML_ALLOW_UNUSED_TYPE __attribute__((unused))
-#else
-#define FML_ALLOW_UNUSED_TYPE
-#endif
-
-#endif // FLUTTER_FML_COMPILER_SPECIFIC_H_
diff --git a/fml/platform/darwin/scoped_block.h b/fml/platform/darwin/scoped_block.h
index 031266a..2e7cc91 100644
--- a/fml/platform/darwin/scoped_block.h
+++ b/fml/platform/darwin/scoped_block.h
@@ -7,7 +7,6 @@
#include <Block.h>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/platform/darwin/scoped_typeref.h"
#if defined(__has_feature) && __has_feature(objc_arc)
diff --git a/fml/platform/darwin/scoped_nsobject.h b/fml/platform/darwin/scoped_nsobject.h
index 86dd164..b6540c4 100644
--- a/fml/platform/darwin/scoped_nsobject.h
+++ b/fml/platform/darwin/scoped_nsobject.h
@@ -13,7 +13,6 @@
// singled out because it is most typically included from other header files.
#import <Foundation/NSObject.h>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/platform/darwin/scoped_typeref.h"
diff --git a/fml/platform/darwin/scoped_typeref.h b/fml/platform/darwin/scoped_typeref.h
index e4728d4..bed7994 100644
--- a/fml/platform/darwin/scoped_typeref.h
+++ b/fml/platform/darwin/scoped_typeref.h
@@ -5,7 +5,6 @@
#ifndef FLUTTER_FML_PLATFORM_DARWIN_SCOPED_TYPEREF_H_
#define FLUTTER_FML_PLATFORM_DARWIN_SCOPED_TYPEREF_H_
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/platform/darwin/scoped_policy.h"
namespace fml {
diff --git a/fml/platform/darwin/weak_nsobject.h b/fml/platform/darwin/weak_nsobject.h
index cf657d0..92120e1 100644
--- a/fml/platform/darwin/weak_nsobject.h
+++ b/fml/platform/darwin/weak_nsobject.h
@@ -11,7 +11,7 @@
#include <stdlib.h>
#include <utility>
-#include "flutter/fml/compiler_specific.h"
+
#include "flutter/fml/logging.h"
#include "flutter/fml/memory/ref_counted.h"
#include "flutter/fml/memory/ref_ptr.h"
diff --git a/fml/synchronization/semaphore.h b/fml/synchronization/semaphore.h
index 1207f59..0bb1760 100644
--- a/fml/synchronization/semaphore.h
+++ b/fml/synchronization/semaphore.h
@@ -7,7 +7,6 @@
#include <memory>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
namespace fml {
diff --git a/fml/unique_object.h b/fml/unique_object.h
index 8e11969..2e44ecb 100644
--- a/fml/unique_object.h
+++ b/fml/unique_object.h
@@ -7,7 +7,6 @@
#include <utility>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/macros.h"
diff --git a/impeller/base/base_unittests.cc b/impeller/base/base_unittests.cc
index 6a865a9..7c2d836 100644
--- a/impeller/base/base_unittests.cc
+++ b/impeller/base/base_unittests.cc
@@ -59,8 +59,7 @@
f.mtx.UnlockWriter();
// int b = f.a; <--- Static analysis error.
f.mtx.LockReader();
- int b = f.a; // NOLINT(clang-analyzer-deadcode.DeadStores)
- FML_ALLOW_UNUSED_LOCAL(b);
+ [[maybe_unused]] int b = f.a; // NOLINT(clang-analyzer-deadcode.DeadStores)
f.mtx.UnlockReader();
}
@@ -76,8 +75,7 @@
// int b = f.a; <--- Static analysis error.
{
auto read_lock = ReaderLock(f.mtx);
- int b = f.a; // NOLINT(clang-analyzer-deadcode.DeadStores)
- FML_ALLOW_UNUSED_LOCAL(b);
+ [[maybe_unused]] int b = f.a; // NOLINT(clang-analyzer-deadcode.DeadStores)
}
// f.mtx.UnlockReader(); <--- Static analysis error.
diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
index e8facb4..e22a013 100644
--- a/runtime/dart_isolate.h
+++ b/runtime/dart_isolate.h
@@ -12,7 +12,6 @@
#include <unordered_set>
#include "flutter/common/task_runners.h"
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/mapping.h"
#include "flutter/lib/ui/io_manager.h"
diff --git a/runtime/dart_service_isolate.h b/runtime/dart_service_isolate.h
index 5078c28..a6fc32d 100644
--- a/runtime/dart_service_isolate.h
+++ b/runtime/dart_service_isolate.h
@@ -10,7 +10,6 @@
#include <set>
#include <string>
-#include "flutter/fml/compiler_specific.h"
#include "third_party/dart/runtime/include/dart_api.h"
namespace flutter {
diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc
index 955aaef..8461bf9 100644
--- a/runtime/dart_vm.cc
+++ b/runtime/dart_vm.cc
@@ -10,7 +10,6 @@
#include <vector>
#include "flutter/common/settings.h"
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/cpu_affinity.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/mapping.h"
@@ -71,12 +70,12 @@
// clang-format on
};
-FML_ALLOW_UNUSED_TYPE
+[[maybe_unused]]
static const char* kDartWriteProtectCodeArgs[] = {
"--no_write_protect_code",
};
-FML_ALLOW_UNUSED_TYPE
+[[maybe_unused]]
static const char* kDartDisableIntegerDivisionArgs[] = {
"--no_use_integer_division",
};
@@ -105,7 +104,7 @@
return oss.str();
}
-FML_ALLOW_UNUSED_TYPE
+[[maybe_unused]]
static const char* kDartDefaultTraceStreamsArgs[]{
"--timeline_streams=Dart,Embedder,GC",
};
diff --git a/runtime/service_protocol.h b/runtime/service_protocol.h
index e3e9ffa..4e8ddb4 100644
--- a/runtime/service_protocol.h
+++ b/runtime/service_protocol.h
@@ -10,7 +10,6 @@
#include <string>
#include <string_view>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/synchronization/atomic_object.h"
#include "flutter/fml/synchronization/shared_mutex.h"
diff --git a/vulkan/vulkan_backbuffer.cc b/vulkan/vulkan_backbuffer.cc
index dc404d4..eae1c05 100644
--- a/vulkan/vulkan_backbuffer.cc
+++ b/vulkan/vulkan_backbuffer.cc
@@ -39,7 +39,7 @@
}
VulkanBackbuffer::~VulkanBackbuffer() {
- FML_ALLOW_UNUSED_LOCAL(WaitFences());
+ [[maybe_unused]] auto result = WaitFences();
}
bool VulkanBackbuffer::IsValid() const {
diff --git a/vulkan/vulkan_backbuffer.h b/vulkan/vulkan_backbuffer.h
index e158562..d27b76a 100644
--- a/vulkan/vulkan_backbuffer.h
+++ b/vulkan/vulkan_backbuffer.h
@@ -7,7 +7,6 @@
#include <array>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_handle.h"
#include "third_party/skia/include/core/SkSize.h"
diff --git a/vulkan/vulkan_command_buffer.h b/vulkan/vulkan_command_buffer.h
index b19f485..cafe210 100644
--- a/vulkan/vulkan_command_buffer.h
+++ b/vulkan/vulkan_command_buffer.h
@@ -5,7 +5,6 @@
#ifndef FLUTTER_VULKAN_VULKAN_COMMAND_BUFFER_H_
#define FLUTTER_VULKAN_VULKAN_COMMAND_BUFFER_H_
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_handle.h"
diff --git a/vulkan/vulkan_debug_report.cc b/vulkan/vulkan_debug_report.cc
index 4f18f4a..71a18a5 100644
--- a/vulkan/vulkan_debug_report.cc
+++ b/vulkan/vulkan_debug_report.cc
@@ -8,16 +8,17 @@
#include <iomanip>
#include <vector>
-#include "flutter/fml/compiler_specific.h"
#include "vulkan_utilities.h"
namespace vulkan {
-static const VkDebugReportFlagsEXT kVulkanErrorFlags FML_ALLOW_UNUSED_TYPE =
+[[maybe_unused]]
+static const VkDebugReportFlagsEXT kVulkanErrorFlags =
VK_DEBUG_REPORT_WARNING_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT | VK_DEBUG_REPORT_ERROR_BIT_EXT;
-static const VkDebugReportFlagsEXT kVulkanInfoFlags FML_ALLOW_UNUSED_TYPE =
+[[maybe_unused]]
+static const VkDebugReportFlagsEXT kVulkanInfoFlags =
VK_DEBUG_REPORT_INFORMATION_BIT_EXT | VK_DEBUG_REPORT_DEBUG_BIT_EXT;
std::string VulkanDebugReport::DebugExtensionName() {
diff --git a/vulkan/vulkan_device.cc b/vulkan/vulkan_device.cc
index d350438..383778d 100644
--- a/vulkan/vulkan_device.cc
+++ b/vulkan/vulkan_device.cc
@@ -174,7 +174,7 @@
}
VulkanDevice::~VulkanDevice() {
- FML_ALLOW_UNUSED_LOCAL(WaitIdle());
+ [[maybe_unused]] auto result = WaitIdle();
}
bool VulkanDevice::IsValid() const {
diff --git a/vulkan/vulkan_device.h b/vulkan/vulkan_device.h
index 18065a0..fb5b1573 100644
--- a/vulkan/vulkan_device.h
+++ b/vulkan/vulkan_device.h
@@ -7,7 +7,6 @@
#include <vector>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_handle.h"
diff --git a/vulkan/vulkan_image.h b/vulkan/vulkan_image.h
index 21d4997..93087e4 100644
--- a/vulkan/vulkan_image.h
+++ b/vulkan/vulkan_image.h
@@ -5,7 +5,6 @@
#ifndef FLUTTER_VULKAN_VULKAN_IMAGE_H_
#define FLUTTER_VULKAN_VULKAN_IMAGE_H_
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_handle.h"
diff --git a/vulkan/vulkan_swapchain.cc b/vulkan/vulkan_swapchain.cc
index 20e3212..08627ff 100644
--- a/vulkan/vulkan_swapchain.cc
+++ b/vulkan/vulkan_swapchain.cc
@@ -155,7 +155,7 @@
swapchain_ = VulkanHandle<VkSwapchainKHR>{
swapchain, [this](VkSwapchainKHR swapchain) {
- FML_ALLOW_UNUSED_LOCAL(device_.WaitIdle());
+ [[maybe_unused]] auto result = device_.WaitIdle();
vk.DestroySwapchainKHR(device_.GetHandle(), swapchain, nullptr);
}};
diff --git a/vulkan/vulkan_swapchain.h b/vulkan/vulkan_swapchain.h
index 5a16747..4d832c9 100644
--- a/vulkan/vulkan_swapchain.h
+++ b/vulkan/vulkan_swapchain.h
@@ -9,7 +9,6 @@
#include <utility>
#include <vector>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_handle.h"
#include "third_party/skia/include/core/SkSize.h"
diff --git a/vulkan/vulkan_window.h b/vulkan/vulkan_window.h
index 7495af3..d4d3c9c 100644
--- a/vulkan/vulkan_window.h
+++ b/vulkan/vulkan_window.h
@@ -10,7 +10,6 @@
#include <utility>
#include <vector>
-#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_proc_table.h"
#include "third_party/skia/include/core/SkRefCnt.h"