diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index f73dac77ae003..28bbe4769076a 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -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 diff --git a/flow/layers/layer.h b/flow/layers/layer.h index b912207d003c4..c64f69633de95 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 f7c271401c2c9..ab3a6ba9eee5b 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -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", diff --git a/fml/compiler_specific.h b/fml/compiler_specific.h deleted file mode 100644 index 52c9e6c9a4d9f..0000000000000 --- 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 031266af0d065..2e7cc91cc23e9 100644 --- a/fml/platform/darwin/scoped_block.h +++ b/fml/platform/darwin/scoped_block.h @@ -7,7 +7,6 @@ #include -#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 86dd16481b587..b6540c4a94a0d 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 -#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 e4728d43cd0bb..bed7994487455 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 cf657d0b5d9e8..92120e18ebb31 100644 --- a/fml/platform/darwin/weak_nsobject.h +++ b/fml/platform/darwin/weak_nsobject.h @@ -11,7 +11,7 @@ #include #include -#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 1207f59a6f3d2..0bb17602867bc 100644 --- a/fml/synchronization/semaphore.h +++ b/fml/synchronization/semaphore.h @@ -7,7 +7,6 @@ #include -#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 8e119699f5390..2e44ecb853899 100644 --- a/fml/unique_object.h +++ b/fml/unique_object.h @@ -7,7 +7,6 @@ #include -#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 6a865a9eac8db..7c2d8365e6708 100644 --- a/impeller/base/base_unittests.cc +++ b/impeller/base/base_unittests.cc @@ -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. diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index e8facb468eb01..e22a0132c55df 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -12,7 +12,6 @@ #include #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 5078c28a78a83..a6fc32d4297af 100644 --- a/runtime/dart_service_isolate.h +++ b/runtime/dart_service_isolate.h @@ -10,7 +10,6 @@ #include #include -#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 955aaefe63f51..8461bf9e74f23 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -10,7 +10,6 @@ #include #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", }; diff --git a/runtime/service_protocol.h b/runtime/service_protocol.h index e3e9ffae0832f..4e8ddb467aaf1 100644 --- a/runtime/service_protocol.h +++ b/runtime/service_protocol.h @@ -10,7 +10,6 @@ #include #include -#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 dc404d4d293cb..eae1c055d3b24 100644 --- a/vulkan/vulkan_backbuffer.cc +++ b/vulkan/vulkan_backbuffer.cc @@ -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 { diff --git a/vulkan/vulkan_backbuffer.h b/vulkan/vulkan_backbuffer.h index e1585623cfd95..d27b76a318482 100644 --- a/vulkan/vulkan_backbuffer.h +++ b/vulkan/vulkan_backbuffer.h @@ -7,7 +7,6 @@ #include -#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 b19f485b900d1..cafe210a09d75 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 4f18f4a19a53a..71a18a5bf021c 100644 --- a/vulkan/vulkan_debug_report.cc +++ b/vulkan/vulkan_debug_report.cc @@ -8,16 +8,17 @@ #include #include -#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 d350438fdf6bc..383778dba65cf 100644 --- a/vulkan/vulkan_device.cc +++ b/vulkan/vulkan_device.cc @@ -174,7 +174,7 @@ bool VulkanDevice::InitializeCommandPool() { } 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 18065a05bc684..fb5b15730596d 100644 --- a/vulkan/vulkan_device.h +++ b/vulkan/vulkan_device.h @@ -7,7 +7,6 @@ #include -#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 21d4997018773..93087e47ab6d3 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 20e32121c31c9..08627fff4cc1d 100644 --- a/vulkan/vulkan_swapchain.cc +++ b/vulkan/vulkan_swapchain.cc @@ -155,7 +155,7 @@ VulkanSwapchain::VulkanSwapchain(const VulkanProcTable& p_vk, swapchain_ = VulkanHandle{ 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 5a16747665e25..4d832c9b01e57 100644 --- a/vulkan/vulkan_swapchain.h +++ b/vulkan/vulkan_swapchain.h @@ -9,7 +9,6 @@ #include #include -#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 7495af323dc14..d4d3c9cecd4ac 100644 --- a/vulkan/vulkan_window.h +++ b/vulkan/vulkan_window.h @@ -10,7 +10,6 @@ #include #include -#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"