woboq / verdigris

Qt without moc: set of macros to use Qt without needing moc
https://woboq.com/blog/verdigris-qt-without-moc.html
GNU Lesser General Public License v3.0
643 stars 60 forks source link

Static analysis tools and W_OBJECT macro #13

Closed rakhimov closed 6 years ago

rakhimov commented 6 years ago

This is probably not a major issue, but it is interesting to know which tools start failing due to missing Q_OBJECT. For example, lupdate is giving a warning. Not sure about klazy or clazy.

ogoffart commented 6 years ago

What's the lupdate warning?

rakhimov commented 6 years ago

Class '...' lacks Q_OBJECT macro

ogoffart commented 6 years ago

We could teach lupdate to recognize the W_OBJECT macro

Otherwise , we need a workaround. Since lupdate does not do the preprocessor, something like this should be added to every classes.

#if 0
    Q_OBJECT
#endif

Or

#define IGNORE(...)
...
  IGNORE(Q_OBJECT)

maybe i could add a W_IGNORE macro in the wobjectdefs.h header

rakhimov commented 6 years ago

So far, this is a minor annoyance resulting in false positives at worst, but there doesn't seem to be a tool that completely breaks when Q_Object is absent. Reopen if you find one.