[Development] Q_DECLARE_TYPEINFO compile time checks

Marc Mutz marc.mutz at kdab.com
Mon Jul 27 17:59:24 CEST 2015


On Monday 27 July 2015 15:12:03 Curtis Mitch wrote:
> Hmmm, I don't think that helps with
> https://codereview.qt-project.org/#/c/122268/, for example.
> 
> Oh well.

We could have syncqt.pl check for Q_DECLARE_TYPEINFO(T, X) for any T it 
generates a header for, but that doesn't work for several reasons:

1. It doesn't catch nested types
2. It doesn't work when the typeinfo is declared without the macro, e.g. with
    QTypeInfoMerger.
3. It doesn't catch private types (both in _p.h and .cpp)
4. It doesn't catch enums (Q_RELOCATABLE_TYPE will be set for enums, but in
    private API, we still want to manually set Q_PRIMITIVE_TYPE).

Of course, one could use some GCC or Clang output to get a list of all 

I doubt there's a better way currently than manually marking all types. That's 
why it's important to insisit on it in reviews.

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list