Commit 96ca3e6f authored by Max Smolens's avatar Max Smolens Committed by David Gobbi

Fix HAVE_ROUND-related build warnings in Visual Studio 2013

When built with certain versions of Python, a VTK build with
VTK_WRAP_PYTHON enabled results in many build warnings. For example:

Python 2.7.10:

    c:\python27\include\pyconfig.h(444): warning C4005: 'HAVE_ROUND' : macro redefinition
              C:\dev\VTK\Utilities\Python\vtkPython.h(77) : see previous definition of 'HAVE_ROUND'

This warning occurs because both vtkPython.h and Python.h define the
HAVE_ROUND macro, but the definitions don't match. Python 2.7.9+ and
Python 3.4.2+ define HAVE_ROUND when compiling with Visual Studio 2013+
(see http://bugs.python.org/issue21958).

Python 3.4.1:

    c:\python34\include\pymath.h(22): warning C4273: 'round' : inconsistent dll linkage
              C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(516) : see previous definition of 'round'
    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtgmath.h(206): warning C4273: 'round' : inconsistent dll linkage
              C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(516) : see previous definition of 'round'

This warning occurs because neither Python.h nor vtkPython.h define HAVE_ROUND.

This commit removes the build warnings by:
- changing the HAVE_ROUND macro definition to match Python's definition
- removing the Python version check
parent d3529f54
......@@ -73,18 +73,14 @@ they are system headers. Do NOT add any #undef lines here. */
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1800
#if VTK_PYTHON_VERSION_HEX < 0x03040000
#define HAVE_ROUND
#endif
#define HAVE_ROUND 1
#endif
#include <Python.h>
#if defined(_MSC_VER) && _MSC_VER >= 1800
#if VTK_PYTHON_VERSION_HEX < 0x03040000
#undef HAVE_ROUND
#endif
#endif
#if defined(_MSC_VER)
# pragma warning (pop)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment