[Development] moc 4.8.6 & macros

Thiago Macieira thiago.macieira at intel.com
Wed Sep 17 18:01:21 CEST 2014


On Wednesday 17 September 2014 17:42:40 Samuel Gaist wrote:
> On 17 sept. 2014, at 17:20, Olivier Goffart <olivier at woboq.com> wrote:
> > On Tuesday 16 September 2014 23:52:36 Thiago Macieira wrote:
> >> On Tuesday 16 September 2014 23:00:06 Samuel Gaist wrote:
> >>> Good question, I'll have to check.
> >>> If that where not the case, what should I write to give additional
> >>> include
> >>> paths to moc ?
> >> 
> >> Replace QT_DEPRECATED_SINCE with the actual contents of the macro. Also
> >> expand QT_VERSION_CHECK.
> >> 
> >> Qt 4 moc does not expand macros.
> > 
> > Qt 4 moc does expand macros in #if directive.
> > 
> > (and QT_DEPRECATED_SINCE is defined to 1 for Qt4 in qtserialportglobal.h)
> 
> Indeed it's defined, but it looks like moc doesn't handle the case when the
> macro has one or more parameter(s) even if defined in the same file

Right, so let me be clearer: moc in Qt 4 does not expand macro calls.

$ cat foo.cpp
#define FOO(x) x
#if FOO(1)
class Foo : public QObject { Q_OBJECT };
#endif

$ moc -qt4.8 foo.cpp > /dev/null
foo.cpp:0: Note: No relevant classes found. No output generated.

$ moc -qt5 foo.cpp > /dev/null

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list