Add FLUTTER_DEPRECATED macro and flutter_macros.h (flutter/engine#35293)

Adds a new header, flutter_macros.h which includes a FLUTTER_DEPRECATED
macro that can be used to mark deprecated API as such, with a
hopefully-informative message, ideally describing the expected removal
version and any migration tips.

This will need to be #included in flutter_windows.h and flutter_linux.h,
but prior to doing so, we'll need to update the engine recipe to bundle
the new header, here:
https://flutter.googlesource.com/recipes/+/refs/heads/main/recipes/engine/engine.py#1457

No tests since this adds a compiler macro that will be used for future
C/C++ API deprecation once the above recipe change has landed;
specifically: FlutterDesktopEngineProcessMessages.

Related: https://github.com/flutter/flutter/issues/93537
This commit is contained in:
Chris Bracken 2022-08-10 09:23:09 -07:00 committed by GitHub
parent 41609b4521
commit 9215e15d91
3 changed files with 26 additions and 0 deletions

View File

@ -1675,6 +1675,7 @@ FILE: ../../../flutter/shell/platform/common/path_utils.h
FILE: ../../../flutter/shell/platform/common/path_utils_unittests.cc
FILE: ../../../flutter/shell/platform/common/platform_provided_menu.h
FILE: ../../../flutter/shell/platform/common/public/flutter_export.h
FILE: ../../../flutter/shell/platform/common/public/flutter_macros.h
FILE: ../../../flutter/shell/platform/common/public/flutter_messenger.h
FILE: ../../../flutter/shell/platform/common/public/flutter_plugin_registrar.h
FILE: ../../../flutter/shell/platform/common/public/flutter_texture_registrar.h

View File

@ -11,6 +11,7 @@ config("desktop_library_implementation") {
_public_headers = [
"public/flutter_export.h",
"public/flutter_macros.h",
"public/flutter_messenger.h",
"public/flutter_plugin_registrar.h",
"public/flutter_texture_registrar.h",

View File

@ -0,0 +1,24 @@
// 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_SHELL_PLATFORM_COMMON_PUBLIC_FLUTTER_MACROS_H_
#define FLUTTER_SHELL_PLATFORM_COMMON_PUBLIC_FLUTTER_MACROS_H_
#ifdef FLUTTER_DESKTOP_LIBRARY
// Do not add deprecation annotations when building the library.
#define FLUTTER_DEPRECATED(message)
#else // FLUTTER_DESKTOP_LIBRARY
// Add deprecation warning for users of the library.
#ifdef _WIN32
#define FLUTTER_DEPRECATED(message) __declspec(deprecated(message))
#else
#define FLUTTER_DEPRECATED(message) __attribute__((deprecated(message)))
#endif
#endif // FLUTTER_DESKTOP_LIBRARY
#endif // FLUTTER_SHELL_PLATFORM_COMMON_PUBLIC_FLUTTER_MACROS_H_