[Development] QT_DEPRECATED_SINCE and QT_DISABLE_DEPRECATED_BEFORE
Olivier Goffart
olivier at woboq.com
Wed Oct 26 23:28:53 CEST 2011
Hi,
First, let me re-introduce (for those that did not know) QT_DEPRECATED_SINCE:
It was added in the commit 6618dd877f83be56d140882a2f6c3fa5a985c2d2
The goal of this macro is to "versionize" when a a function is deprecated.
Then, one can define in his project QT_DISABLE_DEPRECATED_BEFORE to control
which function to enable/disable.
The goals are:
- let the developpers of application hide the deprecated symbols while
compiling their application, forcing compile error in order to avoid using
them by mistake
- "Customer" that build Qt and do not need binary compatibility could compile
Qt without the deprecated functions.
The idea was that QT_DISABLE_DEPRECATED_BEFORE would be defined to 5.0 by
default (that would not change for all the Qt 5.x series)
Meaning that, by default, all the API deprecated in 5.0 would not be avaliabe
unless one define in his .pro file QT_DISABLE_DEPRECATED_BEFORE to a version
lower than 4.x (to enable all the compatibility with qt4)
Also, all the code within QT_DEPRECATED_SINCE(5,0) need to be inline so it is
bnary compatible to enable or disable those function.
(Of course, it is not binary comatible to change it to 5.1)
Anyway, one of the problem that we saw is that the code within
QT_DEPRECATED_SINCE(5,0) tend not to compile[1]
That could be fixed by the compilerwarning test in qt-qa which test that all
our headers compile without warnings (or errors) with different flags.
But the other problem is that it is hard to deprecate function that are used
by other module, as putting them inside QT_DEPRECATED_SINCE break the
compilation.
After a small talk with David Faure, we came to the conclusion that maybe it
would be a good temporary solution to define QT_DISABLE_DEPRECATED_BEFORE to
4.9 to re-enable (temporarely) all the deprecated function, untill the feature
freeze. So others module have time to adapt to the deprecation warnings.
The change is there: http://codereview.qt-project.org/#change,7494
Comments?
--
Olivier
[1] (cf e19292120b33f55a10f233bdaab7030f4299db66 or
http://codereview.qt-project.org/7493
More information about the Development
mailing list