[vtk-developers] dashboard warning from VS10 math.h

David Cole dlrdave at aol.com
Fri Mar 29 13:38:47 EDT 2013


More info about this... I can easily reproduce this warning without VTK 
using a main.cxx that looks like this:

    #ifdef _MSC_VER
    #pragma warning ( push, 4 )
    #endif

    #include <Python.h>

    int main(int, const char *[])
    {
      return 0;
    }

So it is clearly not anything *specific* to VTK. I'm a little confused 
about it, though, because my CMakeCache clearly shows a warning level 
of "/W3" passed in the compiler flags, so something must tweak that 
warning level when compiling the python wrapper files. Perhaps it's 
hiding in a CMakeLists file, or perhaps there's a #pragma warning 
changer in a header.

Whatever the cause, I am narrowing in on a patch to fix this.


David C.


-----Original Message-----
From: David Cole <dlrdave at aol.com>
To: david.gobbi <david.gobbi at gmail.com>
Cc: vtk-developers <vtk-developers at vtk.org>
Sent: Wed, Mar 27, 2013 7:34 am
Subject: Re: [vtk-developers] dashboard warning from VS10 math.h


This attempt did not pan out. This Experimental, submitted late
yesterday, had this exact code change in it, but still yielded the same
warnings.

    http://open.cdash.org/viewBuildError.php?type=1&buildid=2857170

I think the python headers are including math.h themselves before
returning from our include of the python headers... (pyfpe.h and
pyport.h both have include math.h in them)

I will try to get some time to figure out a different way to avoid this
warning when I get some chunk of time to spend on it. Or, if we get
sick of it before I can find the time, we can do a suppression for this
one.


David C.


-----Original Message-----
From: David Gobbi <david.gobbi at gmail.com>
To: David Cole <dlrdave at aol.com>
Cc: vtk-developers <vtk-developers at vtk.org>
Sent: Tue, Mar 26, 2013 11:31 am
Subject: Re: [vtk-developers] dashboard warning from VS10 math.h


Should be straightforward.  In Utilities/Python/vtkPython.h immediately
below "#include <Python.h>" add something like this:

// pyconfig.h defines "hypot", which conflicts with cmath header
#ifdef hypot
#undef hypot
#endif

 - David

On Tue, Mar 26, 2013 at 8:58 AM, David Cole <dlrdave at aol.com> wrote:
> Sure -- I'll give that a try tonight or tomorrow. Will submit a
gerrit patch
> if it works.
>
>
>
> -----Original Message-----
> From: David Gobbi <david.gobbi at gmail.com>
> To: David Cole <dlrdave at aol.com>
> Cc: vtk-developers <vtk-developers at vtk.org>
> Sent: Tue, Mar 26, 2013 10:51 am
> Subject: Re: [vtk-developers] dashboard warning from VS10 math.h
>
>
> Hey, I found this in pyconfig.h:
>
> #define hypot _hypot
>
> So if we add "#undef hypot" to vtkPython.h the warning should go
> away.  You want to give it a shot?
>
> - David
>
> On Tue, Mar 26, 2013 at 8:46 AM, David Gobbi <david.gobbi at gmail.com>
wrote:
>>
>> So it was already defined once as a library function, and then math.h
>> is redefining it as an inline. Could have something to do with the
>> complex release-versus-debug stuff in vtkPython.h.  Or it could be
>> that python defines its own hypot() function somewhere.  It's too bad
>> that VS10 isn't giving us the location of the previous definition,
>> that would make it a lot easier to track down the issue.
>>
>> I'd say suppress it, the python wrappers definitely don't use the
>> hypot() function anywhere, and it wouldn't matter if they used an
>> inline version instead of a library-based version anyway.
>>
>>  - David
>>
>> On Tue, Mar 26, 2013 at 8:33 AM, David Cole <dlrdave at aol.com> wrote:
>>>
>>> Ping on this one again.
>>>
>>> Anybody have any insight into whether this warning means we should
>
> change
>>>
>>> some code in VTK's python layer that includes math.h? Or should I
>
> suppress
>>>
>>> this warning as "hmmm, strange, not much we can do about it" ... ?
>>>
>>> Thanks,
>>> David C.
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: David Cole <dlrdave at aol.com>
>>> To: David Gobbi <david.gobbi at gmail.com>
>>> Cc: VTK Developers <vtk-developers at vtk.org>
>>> Sent: Thu, Mar 21, 2013 7:48 am
>>> Subject: RE: [vtk-developers] dashboard warning from VS10 math.h
>>>
>>>
>>>
>>> math.h, including line 162, on that machine has:
>>>
>>>
>>> 158:  /* hypot and hypotf are now part of the C99 Standard */
>>> 159:  #if !defined(RC_INVOKED) && !defined(__midl)
>>> 160:
>>> 161:  static __inline double __CRTDECL hypot(_In_ double _X, _In_
>
> double _Y)
>>>
>>> 162:  {
>>> 163:      return _hypot(_X, _Y);
>>> 164:  }
>>>
>>>
>>>
>>>
>>>                 From: David Gobbi
>>>                 Sent: March 20, 2013 10:05 PM
>>>                 To: David Cole
>>>                         CC: VTK Developers
>>>                 Subject: Re: [vtk-developers] dashboard warning from
>
> VS10
>>>
>>> math.h
>>>
>>>
>>>
>>>
>>> On Wed, Mar 20, 2013 at 7:40 PM, David Cole <dlrdave at aol.com> wrote:
>>>>
>>>>
>>>> After turning on python and Qt, I started getting warnings like
this
>>>
>>>
>>> on my
>>>>
>>>>
>>>> dashboard:
>>>>
>>>> [3933/8363] Building CXX object
>>>>
>>>
>
Wrapping\Python\CMakeFiles\vtkWrappingPython.dir\vtkPythonCommand.cxx.obj


>
>>>
>>>>
>>>> C:\Program Files\Microsoft Visual Studio
>
> 10.0\VC\INCLUDE\math.h(162) :
>>>>
>>>> warning C4211: nonstandard extension used : redefined extern to
stat
>>>>
>>>>
http://open.cdash.org/viewBuildError.php?type=1&buildid=2851369
>>>>
>>>> Should I suppress those in the CTestCustom file (in case somebody
>>>
>>>
>>> else runs
>>>>
>>>>
>>>> a similar dashboard eventually), or should I use “/wd4211” in my
>>>
>>>
>>> compiler
>>>>
>>>>
>>>> flags locally for this build, or ... something else?
>>>
>>>
>>>
>>> The first step is to find out what is causing the warning, the
>>> compiler gives the line number.  Is math.h redefining something
>>> that we have already defined in VTK?  If so, we want to know.
>>> The warning should only be hidden after it has been determined
>>> to be either harmless or unavoidable.
>>>
>>>  - David
>>>
>>>
>
>



  



More information about the vtk-developers mailing list