[Development] Development Digest, Vol 32, Issue 29
achartier at fastmail.fm
achartier at fastmail.fm
Wed May 14 22:52:05 CEST 2014
> Em ter 13 maio 2014, ?s 12:28:11, achartier at fastmail.fm escreveu:
> > Hi all,
> >
> > I would like to enable the -Weverything and -Werror Clang compiler flags
> > for my application code to treat all warnings as errors.
>
> Please note that Qt compiles mostly cleanly with -Wall -Wextra -Werror.
> We do
> not support -Weverything, since it produces warnings that are, well,
> stupid.
>
> > Unfortunately,
> > Qt itself generates a large number of warnings. I would like to suppress
> > the warnings generated for Qt code but have Clang report all the
> > warnings (errors) in my application code.
> >
> > I have searched a lot on this subject and have not found a solution that
> > really works. The proper way to do this is to use the -isystem flag and
> > specify the Qt include directories so they may be treated as system
> > headers, however qmake seems to always pass the Qt include directories
> > with the -I argument no matter what I do (I even tried INCLUDEPATH -=
> > <Qt_include_dirs> to no avail).
>
> Make sure you're using 5.3. If so, qmake will automatically use -isystem
> for
> all system header paths.
>
> Note: *system* header paths. You need to install Qt in one of the system
> header paths for that to take effect. That is, /usr/include or
> /usr/local/include or one of the rest listed in:
>
> $ grep DEFAULT_INCDIRS mkspecs/qconfig.pri
> QMAKE_DEFAULT_INCDIRS = /usr/include/c++/4.8
> /usr/include/c++/4.8/x86_64-
> suse-linux /usr/include/c++/4.8/backward /usr/lib64/gcc/x86_64-suse-
> linux/4.8/include /usr/local/include /usr/lib64/gcc/x86_64-suse-
> linux/4.8/include-fixed /usr/x86_64-suse-linux/include /usr/include
>
>
> > The only approach that has worked so far is to use the -Wno flag to
> > disable certain warnings. This is far from desirable, as then the
> > warning checking in my application code is tied to the quality of the Qt
> > codebase.
>
> We only need -Wno-error=deprecated-register and that's because of a macro
> from
> glibc (Linux). No other flags are necessary with -Wall -Wextra.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
Thanks Thiago, I'm glad to hear -isystem is supported. I'll give this a
try with the Qt 5.3 release.
Regarding QMAKE_DEFAULT_INCDIRS: is it possible to append additional
paths to this variable from within project files?
Thanks again!
Alfonso
More information about the Development
mailing list