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

David Gobbi david.gobbi at gmail.com
Tue Mar 26 11:31:20 EDT 2013


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