Skip to content

Commit

Permalink
Directly use the __DEPRECATED token to avoid warnings about
Browse files Browse the repository at this point in the history
deprecated headers coming from VTK.  This works for GCC, and
the __DEPRECATED token has been used at least as far back
as GCC 4.2.
  • Loading branch information
jwpeterson committed Feb 5, 2013
1 parent ea1c143 commit 0dd148f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/mesh/vtk_io.C
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@
#ifdef LIBMESH_HAVE_VTK

#include "libmesh/ignore_warnings.h"

// Hack to avoid warnings coming from stupid VTK files that include
// deprecated headers. We only do this for GCC >= 4.2, but it may
// work for other compilers as well. Note: technically it is
// illegal to mess with identifiers that have double leading
// underscores... but it is also technically super annoying to see
// this warning all the time.
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
#if __GNUC__ > 3 && __GNUC_MINOR__ > 1
#ifdef __DEPRECATED
#undef __DEPRECATED
#define LIBMESH_REDEFINE_DEPRECATED
#endif // if __DEPRECATED
#endif // if version
#endif // if gnu

#include "vtkXMLUnstructuredGridReader.h"
#include "vtkXMLUnstructuredGridWriter.h"
#include "vtkXMLPUnstructuredGridWriter.h"
Expand All @@ -48,6 +64,11 @@
#include "vtkPointData.h"
#include "vtkPoints.h"
#include "vtkSmartPointer.h"

#ifdef LIBMESH_REDEFINE_DEPRECATED
#define __DEPRECATED
#endif

#include "libmesh/restore_warnings.h"

// A convenient macro for comparing VTK versions. Returns 1 if the
Expand Down

3 comments on commit 0dd148f

@cato-
Copy link

@cato- cato- commented on 0dd148f Feb 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also just define "VTK_LEGACY_REMOVE" which should prevent vtk from using the old headers

@jwpeterson
Copy link
Member Author

@jwpeterson jwpeterson commented on 0dd148f Feb 7, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwpeterson
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed in ce703f9

Please sign in to comment.