From cc8bccadcdb9a0b823673ab412bb0a13ef35d3ee Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Sat, 9 May 2020 21:47:06 +0200 Subject: ECMGenerateExportHeader: add generation of *_DEPRECATED_VERSION_BELATED() Summary: Now and then tagging some API as deprecated for the compiler is forgotten. Doing this retractivitly in newer versions but using the official version might break build setups configured to only show warnings up to a certain version and otherwise fail a build, using -Werror=deprecated-declarations. To allow retroactive tagging of API for compiler warnings, and showing the official version in the warniung message, while reacting only to warning controls for the current version where the tag is added, avoids any such annoying experiences, without wrong version info at the same time. Reviewers: #frameworks, #build_system, dfaure Reviewed By: dfaure Subscribers: kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D29573 --- modules/ECMGenerateExportHeader.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'modules') diff --git a/modules/ECMGenerateExportHeader.cmake b/modules/ECMGenerateExportHeader.cmake index 52dd29d4..5b34b53e 100644 --- a/modules/ECMGenerateExportHeader.cmake +++ b/modules/ECMGenerateExportHeader.cmake @@ -51,6 +51,7 @@ # ``DEPRECATION_VERSIONS`` specifies versions in "." format in # which API was declared deprecated. Any version used with the generated # macro ``_DEPRECATED_VERSION(major, minor, text)`` +# or ``_DEPRECATED_VERSION_BELATED(major, minor, textmajor, textminor, text)`` # needs to be listed here, otherwise the macro will fail to work. # # ``EXCLUDE_DEPRECATED_BEFORE_AND_AT`` specifies the version for which all API @@ -94,6 +95,16 @@ # or function (other elements to be supported in future versions), depending # on the visibility macro flags set (see below) # +# ``_DEPRECATED_VERSION_BELATED(major, minor, textmajor, textminor, text)`` +# to use to conditionally set a +# ``_DEPRECATED`` macro for a class, struct +# or function (other elements to be supported in future versions), depending +# on the visibility macro flags set (see below), with ``major`` & ``minor`` +# applied for the logic and ``textmajor`` & ``textminor`` for the warnings message. +# Useful for retroactive tagging of API for the compiler without injecting the +# API into the compiler warning conditions of already released versions. +# Since 5.71. +# # ``_ENABLE_DEPRECATED_SINCE(major, minor)`` # evaluates to ``TRUE`` or ``FALSE`` depending on the visibility macro flags # set (see below). To be used mainly with ``#if``/``#endif`` to mark sections @@ -682,6 +693,10 @@ function(ecm_generate_export_header target) string(APPEND _output "#define ${_macro_base_name}_DEPRECATED_VERSION(major, minor, text) ${_macro_base_name}_DEPRECATED_VERSION_##major(minor, \"Since \"#major\".\"#minor\". \" text) +" + ) + string(APPEND _output +"#define ${_macro_base_name}_DEPRECATED_VERSION_BELATED(major, minor, textmajor, textminor, text) ${_macro_base_name}_DEPRECATED_VERSION_##major(minor, \"Since \"#textmajor\".\"#textminor\". \" text) " ) endif() -- cgit v1.2.1