D23789: RFC: Add ECMGenerateExportHeaders, for improved handling of deprecated API
Friedrich W. H. Kossebau
noreply at phabricator.kde.org
Wed Sep 11 14:33:30 BST 2019
kossebau added a comment.
@dfaure Thanks for first in-detail feedback, good to get a feeling this is not totally insane over-engineered stuff to other people'e eyes :)
In D23789#528994 <https://phabricator.kde.org/D23789#528994>, @dfaure wrote:
> Great work. Not really easy to grasp at first sight (because it handles BC for no-compat builds of the lib itself, which we never did before) but this is certainly quite comprehensive.
It's basically trying to solve 2 problems at the same time, as they both would be solved by the same macro techniques:
a) allow control over warnings and API visibility to people building against the library (incl. 2 level settings by additional library group level)
b) allow building of the library itself with legacy code stripped
If there are suggestions for better wording of variables/arguments, or improved ordering/threading of the documentation, all eager to hear. Myself still too much into thinking about details to be able to simulate a first-contact experience again, where ideas are taken from docs and term semantics :)
> Since we don't yet have any source compat to worry about for these macros (unlike Qt, which needed _X variants for that), how about simply adding a third argument to FOO_DEPRECATED_VERSION right away, to allow specifying a hint in the compiler warning, provided the compiler supports C++14?
>
> kio's src/core/job_base.h:77 would become
>
> KIOCORE_DEPRECATED_VERSION(5, 0, "use uiDelegate()") KJobUiDelegate *ui() const;
>
>
> If your first version just ignores the argument, at least we'll start writing those hints and we can work on making cmake's GenerateExportHeaders support that, or fork it here to support it.
As there might not be always a simple hint text, I would still like to also keep the just-version variant of that macro. So if we overload the macro name to support both 2 (major, minor) and 3 (major, minor, message) arguments, any simple way to do default argument value with C++ preprocessor macros? Never wrote such code myself, all things I just found do complicated dances around __VA_ARGS__ of which I none could resolve to a simple application for our single-parameter default value yet.
So, any C++ macro magicians around to be able to tell how to support both
KIOCORE_DEPRECATED_VERSION(5, 0)
KIOCORE_DEPRECATED_VERSION(5, 0, "use uiDelegate()")
while also making sure there is only one argument, and not many? (at least that would be my ambition here to catch this ourselves, instead of just taking __VA_ARGS__ and pass it on, to fail later if >1 args are used.
REPOSITORY
R240 Extra CMake Modules
REVISION DETAIL
https://phabricator.kde.org/D23789
To: kossebau
Cc: dfaure, cgiboudeaux, kde-frameworks-devel, kde-buildsystem, LeGast00n, GB_2, bencreasy, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190911/87b0d8cd/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list