Use ECMGenerateExportHeader to manage deprecated API better
ClosedPublic

Authored by kossebau on Oct 16 2019, 7:06 AM.

Details

Summary

Allows

  • projects linking to KIO to hide deprecated API up to a given version or silence deprecation warnings after a given version, using
    • -DKIOCORE_DISABLE_DEPRECATED_BEFORE_AND_AT
    • -DKIOCORE_NO_DEPRECATED
    • -DKIOCORE_DEPRECATED_WARNINGS_SINCE
    • -DKIOCORE_NO_DEPRECATED_WARNINGS
    • -DKIOFILEWIDGETS_DISABLE_DEPRECATED_BEFORE_AND_AT
    • -DKIOFILEWIDGETS_NO_DEPRECATED
    • -DKIOFILEWIDGETS_DEPRECATED_WARNINGS_SINCE
    • -DKIOFILEWIDGETS_NO_DEPRECATED_WARNINGS
    • -DKIOWIDGETS_DISABLE_DEPRECATED_BEFORE_AND_AT
    • -DKIOWIDGETS_NO_DEPRECATED
    • -DKIOWIDGETS_DEPRECATED_WARNINGS_SINCE
    • -DKIOWIDGETS_NO_DEPRECATED_WARNINGS

      or (once enabled when all KF modules are done)
    • -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT
    • -DKF_NO_DEPRECATED
    • -DKF_DEPRECATED_WARNINGS_SINCE
    • -DKF_NO_DEPRECATED_WARNINGS

No support for "EXCLUDE_DEPRECATED_BEFORE_AND_AT" yet, some
undeprecated API is implemented by deprecated API still, at least for
some deprecation versions. This needs separate work.

Diff Detail

Repository
R241 KIO
Branch
useECMGenerateExportHeader
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 17740
Build 17758: arc lint + arc unit
kossebau created this revision.Oct 16 2019, 7:06 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptOct 16 2019, 7:06 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
kossebau requested review of this revision.Oct 16 2019, 7:06 AM

No support for EXCLUDE_DEPRECATED_BEFORE_AND_AT here as well, that needs another round of work. Thus the removal of all the KIOWIDGETS_NO_DEPRECATED from the source files, no *_BUILD_DEPRECATED_SINCE there to properly replace them for now.

So patch solely concentrating on visibility of deprecated API to consumers of KIO.

kossebau updated this revision to Diff 68021.Oct 16 2019, 7:31 AM

update to latest master

The commit log talks about KCalendarCore instead of KIO :)

kossebau edited the summary of this revision. (Show Details)Oct 16 2019, 1:48 PM
kossebau updated this revision to Diff 68210.Oct 18 2019, 5:24 AM

update to latest master and new deprecated API

Ping... would be happy if this one could get reviewed ASAP, so we have the patches for all of KF modules in and can enable the group KF_* macros, so people can conveniently use -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0Xxxxxxx in their projects :)

The commit log says KIOKIOFILEWIDGETS with KIO duplicated, that's a typo in the commit log, but only there, right?

dfaure added inline comments.Oct 18 2019, 1:42 PM
src/core/global.cpp
99

Isn't some ifdef still needed for this deprecated method?

src/core/global.h
105

LOL 3.4 was long ago ;)

good find :)

src/core/kfileitem.cpp
1242

I'm confused, isn't this what *_BUILD_DEPRECATED_SINCE is for?

[repeats]

kossebau edited the summary of this revision. (Show Details)Oct 18 2019, 2:00 PM

The commit log says KIOKIOFILEWIDGETS with KIO duplicated, that's a typo in the commit log, but only there, right?

Typo indeed, fixed.

src/core/global.cpp
99

I forgot to explicitly mention this in the commit message: no support for EXCLUDE_DEPRECATED_BEFORE_AND_AT for KIO here yet, as version-level-based disabling of API needs some work first, as some undeprecated API is implemented in terms of deprecated still, as I found when testing that support.
The currently existing #ifndef KIOCORE_NO_DEPRECATED in the source files thus got only removed.

Gzess that should get an explicit TODO comment, e.g. near the ecm_generate_export_header marcos?

src/core/kfileitem.cpp
1242

See other comment.

kossebau edited the summary of this revision. (Show Details)Oct 18 2019, 2:18 PM
kossebau added inline comments.Oct 18 2019, 2:26 PM
src/core/global.h
105

Thankfully phabricator and its locate-file, go-to-version-before-commit & tags listing for commit was helpful here to good degrees, so that usually tool < 1 min to find where the deprecation happened.
So the temptation to just say "since 5.0" and spare the digging work was not big enough compared to effort needed to be able to have correct history notes :)

https://phabricator.kde.org/source/kdelibs/repository/frameworks/ is currently still highranked by my firefox ;)

dfaure accepted this revision.Oct 18 2019, 3:14 PM

OK it's very likely that KIOCORE_NO_DEPRECATED didn't work anyway, as I found out in other frameworks where I tried enabling this kind of thing.

This revision is now accepted and ready to land.Oct 18 2019, 3:14 PM
This revision was automatically updated to reflect the committed changes.