How to lower warning level? [header wrappers, GCC]

  • Thread starter Maciej Pilichowski
  • Start date
M

Maciej Pilichowski

Hello there,

The short version -- how to set warning level just for one specific
file, or more exactly how to relax warning level for it?

The long version -- I try to work at maximum warning level
/including -Werror/ but lately I have to work with QT and this library
generates a lot of warnings. I have read on
http://www.artima.com/cppsource/ C++ Coding Standards and tried to do
something similar -- i.e. write a wrapper for all QT included headers.

I would be nice if this has actually worked out:

// my project -- top level of warnings

#pragma warnings_off
#include qt_headers
#pragma warnings_on

// my project -- top level of warnings

But I couldn't find anything like this above in GCC. All I found is:

#pragma GCC system_header

which should ignore any warnings. Maybe it is QT, maybe it is GCC --
anyway, it doesn't help -- I have still a lot of warnings from QT.
So... how to get rid of QT warnings, but maintain top warn-level for
the rest of the project.

Thanks in advance for your help.

have a nice day
bye bye
 
V

Victor Bazarov

Maciej Pilichowski said:
The short version -- how to set warning level just for one specific
file, or more exactly how to relax warning level for it?
[...]

There is no such concept in C++ _language_ as "warning level". Please
post your compiler-specific question to the compiler-dedicated forum.
In your case I suggest gnu.g++.* hierarchy.

V
 
A

Alf P. Steinbach

* Victor Bazarov:
Maciej Pilichowski said:
The short version -- how to set warning level just for one specific
file, or more exactly how to relax warning level for it?
[...]

There is no such concept in C++ _language_ as "warning level". Please
post your compiler-specific question to the compiler-dedicated forum.
In your case I suggest gnu.g++.* hierarchy.

Well, one possible non-tool-specific answer could be to use the PIMPL
idiom.

But in code that uses QT things all over that's perhaps not practical.

Anyway it's work work work when the point of using a library like QT is
(or should be) to avoid the work work work...
 
D

Duane Hebert

Maciej Pilichowski said:
Hello there,

The short version -- how to set warning level just for one specific
file, or more exactly how to relax warning level for it?

The long version -- I try to work at maximum warning level
/including -Werror/ but lately I have to work with QT and this library
generates a lot of warnings. I have read on
http://www.artima.com/cppsource/ C++ Coding Standards and tried to do
something similar -- i.e. write a wrapper for all QT included headers.

Which version of GCC? Which version of Qt?
With VC7.1/Qt3.3 at warning level 4, there are
no Qt warnings. I've ported some of my stuff to
GCC with no problems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top