enable-final and QT_DECLARE_METATYPE

Will Stephenson wstephenson at kde.org
Mon Dec 6 09:55:27 GMT 2010


There have been a couple of enable-final breakages while preparing 4.6beta1 
and now beta2 tarballs that keep coming up, so I'd like to remind you about 
enable-final (now in the KDE 4 epoch -DKDE4_ENABLE_FINAL). 

This makes the build system concatenate source files in the same subdirectory 
together for faster compilation as a single unit.  It fails when this single 
unit contains duplicated names.  Usually this happens when several files 
declare the same global variable or helper function.

What I'm seeing more of at the moment is multiple files using the same 
QT_DECLARE_METATYPE() macro that results in duplication with enable-final. 

The fix I'm using is to move the metatype declaration into a separate header 
with inclusion guards.  Please help save the release team's sleep and hair and 
do this when you first write the code :).

foo/types.h
#ifndef FOO_TYPES
#define FOO_TYPES
Q_DECLARE_METATYPE(Foo)
#endif

foo/bar.cpp
#include "types.h"

foo/baz.cpp
#include "types.h"

Will





More information about the kde-core-devel mailing list