[Development] Cleaner code base patches

Thiago Macieira thiago.macieira at intel.com
Wed Jan 23 08:26:07 CET 2013


I've just pushed a set of patches for review that implement a more direct way 
of ensuring our codebase is cleaner (patches 45529 to 45533). You may have 
noticed, if I added you to one of my reviews in the past months, that I sent 
lots of fixes for warnings.

If you paid attention to them, you may have noticed that they were all 
compiled with -Werror.

Here's what my patches implement:

1) Qt library modules are compiled with -Werror (optional, via whitelist)

I've implemented support for -Werror for both GCC and for Clang. I've also 
cleaned up all the warnings that I could find and were fixable for GCC 4.7 and 
Apple Clang (current).

The idea is that we'll keep GCC 4.5 and up, Clang 3.1 and up, Apple Clang 4.0 
and up clean of warnings.

Modules declare that they are clean of warnings (and should be kept clean) by:
	CONFIG += qt_warnings_are_errors

Possibly qualified by a compiler:
	*-g++*: CONFIG += qt_warnings_are_errors

Additionally, it's possible to add some warning-disabling targets to the 
WERROR variable, for example:

	*-g++*|*-clang*: WERROR += -Wno-error=strict-aliasing

Current status is that all qtbase libraries, qtsvg, qtxmlpatterns, qtquick1, 
qttools and qtimageformats compile with -Werror. qtscript will never compile 
with -Werror, qtwebkit manages this setting on its own, qtdeclarative 
currently has major strict-aliasing issues.

2) Direct compilation of all headers (mandatory)

syncqt will generate a list of all public headers (not including the 
forwarding headers) and then we'll compile each header, directly, with -Werror 
and a few other settings, like QT_NO_KEYWORDS, QT_NO_CAST_FROM_ASCII, -
Woverloaded-virtual, etc.

This is a replacement for the existing tst_headers. Instead of compiling the 
headers all together, this will compile each header, one by one, and will 
catch mistakes like a header missing dependencies and or not compiling without 
precompiled headers.

This is implemented now for GCC, Clang and ICC. This increases the build time 
by about 20%. I've also tested all modules and the only missing fix is the 
binary-compatibility one for qtmultimedia.

Both features are enabled only if -developer-build is passed.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130122/7bf91e7c/attachment.sig>


More information about the Development mailing list