Posted by
Matthew Tibbits on
May 25, 2007; 5:23pm
URL: http://quantlib.414.s1.nabble.com/disabling-compilation-warnings-tp9510p9514.html
Hi,
Yes they work within macros - only if the macro is defined (You'll see
a check for windows in the example below). But you might want to use
something a little more fine grain. When you just outright disable
the warning, you can miss valuable information in other files that
include the offending header only through some odd hierarchy.
You can disable a warning around a specific function (or line in your
code or include statement):
/* Disable "Unreferenced Formal Parameter Warning" */
#ifdef WIN32
#pragma warning( push )
#pragma warning( disable: 4100 )
#endif
I've got a specialized template function right here that doesn't use
one of the more general parameters, but -- to keep the interface the
same -- I've left the parameter in, ignore it, & I deem it ok to turn
off the warning for this function. After the offending function you
can then re-enable the warning:
/* Re-Enable "Unreferenced Formal Parameter Warning" */
#ifdef WIN32
#pragma warning( pop )
#endif
In this way, only the warnings that you specifically comment on are
disabled at the exact location in question. And notice I've used a
check for WIN32 - I don't yet do any development in cygwin or Mingw w/
gcc so perhaps those could be replaced with a check for visual studio.
- Matt
Ps. I realize this isn't the forum to ask - but has anyone here tried
using the visual studio compiler with eclipse?? I'd like to use
MSBuild instead of Mingw so that I can move to eclipse & transparently
use the solution/project files that the rest of the team depends on in
Visual Studio.
On 5/25/07, Luigi Ballabio <
[hidden email]> wrote:
> On Fri, 2007-05-25 at 17:43 +0200, DU VIGNAUD DE VILLEFORT FRANCOIS
> GASAPRD PHI wrote:
> > Ok thks, what about the #4180 ?
>
> It could be dealt with in the same way. What is the warning about?
>
> Later,
> Luigi
>
> P.S. About your suggestion of a macro such as:
>
> #define QL_SAFE_BOOST_FUNCTION_INCLUDE \
> #pragma warning (disable: 4224) \
> etc.
>
> I am not sure how the preprocessor works. If a pragma is inside a macro
> definition, does it get executed when the preprocessor reads it (i.e.,
> when the macro is defined, which doesn't make us any good) or when the
> macro is expanded?
>
>
> > -----Original Message-----
> > From: Luigi Ballabio [mailto:
[hidden email]]
> > Sent: Friday, May 25, 2007 3:47 PM
> > To: DU VIGNAUD DE VILLEFORT FRANCOIS GASAPRD PHI
> > Cc:
[hidden email]
> > Subject: Re: [Quantlib-dev] disabling compilation warnings
> >
> > On Fri, 2007-05-25 at 12:56 +0200, DU VIGNAUD DE VILLEFORT FRANCOIS
> > GASAPRD PHI wrote:
> > > I have just disabled the compilation warning #4224 for VC2005 by
> > > adding the corresponding preprocessor command in ql/config.msvc.hpp.
> > > I'm wondering if disabling uncommon compilation warning at a more
> > > local level would'nt be more appropriated.
> >
> > True--in fact, I did it locally in the 0.8.0 branch. It will appear in
> > the trunk when we merge it.
> >
> > Later,
> > Luigi
> >
> >
> > ----------------------------------------
> >
> > Dealing with failure is easy: work hard to improve. Success is also
> > easy to handle: you've solved the wrong problem. Work hard to improve.
> > -- Alan Perlis
> >
> >
>
> ----------------------------------------
>
> Testing can never demonstrate the absence of errors in software, only
> their presence.
> -- W.E. Dijkstra
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
>
http://sourceforge.net/powerbar/db2/> _______________________________________________
> QuantLib-dev mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev