aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2020-05-09 21:47:06 +0200
committerFriedrich W. H. Kossebau <kossebau@kde.org>2020-05-13 18:07:08 +0200
commitcc8bccadcdb9a0b823673ab412bb0a13ef35d3ee (patch)
tree7940899cdfc50cace589c3094f5e4f5608e1f950 /modules
parenta70e9a0162f7814b33af0cfe6d7f67731ba7cce4 (diff)
downloadextra-cmake-modules-cc8bccadcdb9a0b823673ab412bb0a13ef35d3ee.tar.gz
extra-cmake-modules-cc8bccadcdb9a0b823673ab412bb0a13ef35d3ee.tar.bz2
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
Diffstat (limited to 'modules')
-rw-r--r--modules/ECMGenerateExportHeader.cmake15
1 files changed, 15 insertions, 0 deletions
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 "<major>.<minor>" format in
# which API was declared deprecated. Any version used with the generated
# macro ``<prefix_name><base_name>_DEPRECATED_VERSION(major, minor, text)``
+# or ``<prefix_name><base_name>_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)
#
+# ``<prefix_name><uppercase_base_name>_DEPRECATED_VERSION_BELATED(major, minor, textmajor, textminor, text)``
+# to use to conditionally set a
+# ``<prefix_name><uppercase_base_name>_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.
+#
# ``<prefix_name><uppercase_base_name>_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
@@ -684,6 +695,10 @@ function(ecm_generate_export_header target)
"#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()
if (ARGS_CUSTOM_CONTENT_FROM_VARIABLE)
string(APPEND _output "${ARGS_CUSTOM_CONTENT_FROM_VARIABLE}\n")