Delete //flutter/fml/compiler_specific.h (flutter/engine#54330)

There were two macros for doing identical things and you can do the thing using standard C++17.
This commit is contained in:
Chinmay Garde
2024-08-02 18:47:49 -07:00
committed by GitHub
parent ab4b4835be
commit e83e23a6c5
25 changed files with 13 additions and 62 deletions

View File

@@ -41749,7 +41749,6 @@ ORIGIN: ../../../flutter/fml/build_config.h + ../../../flutter/LICENSE
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/build_config.h
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

View File

@@ -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"

View File

@@ -18,7 +18,6 @@ source_set("fml") {
"base32.h",
"build_config.h",
"closure.h",
"compiler_specific.h",
"concurrent_message_loop.cc",
"concurrent_message_loop.h",
"container.h",

View File

@@ -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_

View File

@@ -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)

View File

@@ -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"

View File

@@ -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 {

View File

@@ -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"

View File

@@ -7,7 +7,6 @@
#include <memory>
#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
namespace fml {

View File

@@ -7,7 +7,6 @@
#include <utility>
#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/macros.h"

View File

@@ -59,8 +59,7 @@ TEST(ThreadTest, CanCreateRWMutex) {
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 @@ TEST(ThreadTest, CanCreateRWMutexLock) {
// 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.

View File

@@ -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"

View File

@@ -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 {

View File

@@ -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 @@ static const char* kSerialGCArgs[] = {
// 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 @@ static std::string DartFileRecorderArgs(const std::string& path) {
return oss.str();
}
FML_ALLOW_UNUSED_TYPE
[[maybe_unused]]
static const char* kDartDefaultTraceStreamsArgs[]{
"--timeline_streams=Dart,Embedder,GC",
};

View File

@@ -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"

View File

@@ -39,7 +39,7 @@ VulkanBackbuffer::VulkanBackbuffer(const VulkanProcTable& p_vk,
}
VulkanBackbuffer::~VulkanBackbuffer() {
FML_ALLOW_UNUSED_LOCAL(WaitFences());
[[maybe_unused]] auto result = WaitFences();
}
bool VulkanBackbuffer::IsValid() const {

View File

@@ -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"

View File

@@ -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"

View File

@@ -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() {

View File

@@ -174,7 +174,7 @@ bool VulkanDevice::InitializeCommandPool() {
}
VulkanDevice::~VulkanDevice() {
FML_ALLOW_UNUSED_LOCAL(WaitIdle());
[[maybe_unused]] auto result = WaitIdle();
}
bool VulkanDevice::IsValid() const {

View File

@@ -7,7 +7,6 @@
#include <vector>
#include "flutter/fml/compiler_specific.h"
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_handle.h"

View File

@@ -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"

View File

@@ -155,7 +155,7 @@ VulkanSwapchain::VulkanSwapchain(const VulkanProcTable& p_vk,
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);
}};

View File

@@ -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"

View File

@@ -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"