[Development] Q_OBJECT and "override"
Bornemann Joerg
Joerg.Bornemann at theqtcompany.com
Thu Jun 4 14:41:23 CEST 2015
> 1) Add "override" (or rather Q_DECL_OVERRIDE) to the definition of
> Q_OBJECT *and* all QObject-derived classes in Qt.
[...]
> 2) Remove "override" from all QObject-derived classes in Qt.
[...]
> 3) Explicitly disable the warning in the clang mkspecs.
[...]
> 4) Let users deal with the problem by making them turn the warning off.
[...]
1) is the thing to do, but OTOH it's a lot of work with questionable gain.
2) and 4) are very wrong. IMO, we shouldn't do this.
3) could be a good compromise. There's a variant of this solution by turning the warning off
at the beginning of every header and turning it on again at the end.
We once had the QT_{BEGIN|END}_HEADER macros which could expand to
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wannoyingwarning"
and repectively
#pragma clang diagnostic pop
This way the warning can be turned on for user code.
BR,
Joerg
More information about the Development
mailing list