Skip to content
Snippets Groups Projects
Commit c0f64bbb authored by Sean McBride's avatar Sean McBride
Browse files

Restored support for Apple gcc 4.2

Partially reverted 9285a6b1
to restore support for Apple fork of gcc 4.2.
The comment said the workaround was for older than
gcc 4.1, but the comment was either wrong, or Apple’s
fork of gcc was special.  Updated comment.
parent 18348a6d
No related branches found
No related tags found
No related merge requests found
......@@ -296,6 +296,22 @@ CHECK_CXX_SOURCE_RUNS("${VTK_REQUIRE_LARGE_FILE_SUPPORT_FILE}"
CMAKE_REQUIRE_LARGE_FILE_SUPPORT "Support for 64 bit file systems")
SET(VTK_REQUIRE_LARGE_FILE_SUPPORT ${CMAKE_REQUIRE_LARGE_FILE_SUPPORT})
#-----------------------------------------------------------------------------
# Does the const_reverse_iterator have the comparison operators? They were not
# present in older versions of gcc (ex: Apple fork of gcc 4.2).
include(CheckCXXSourceCompiles)
set(VTK_CONST_REVERSE_ITERATOR_COMPARISON_FILE
"#include <vector>
int main()
{
std::vector<int> test;
std::vector<int>::const_reverse_iterator it = test.rbegin();
it != test.rend();
return 0;
}")
check_cxx_source_compiles("${VTK_CONST_REVERSE_ITERATOR_COMPARISON_FILE}"
VTK_CONST_REVERSE_ITERATOR_COMPARISON)
#-----------------------------------------------------------------------------
# Provide compatibility options.
option(VTK_LEGACY_REMOVE "Remove all legacy code completely." OFF)
......
......@@ -111,6 +111,9 @@
/* Whether we require large files support. */
#cmakedefine VTK_REQUIRE_LARGE_FILE_SUPPORT
/* Whether reverse const iterator's have comparison operators. */
#cmakedefine VTK_CONST_REVERSE_ITERATOR_COMPARISON
/*--------------------------------------------------------------------------*/
/* VTK Platform Configuration */
......
......@@ -56,8 +56,16 @@ public:
typedef std::vector<vtkAbstractContextItem*>::const_iterator
const_iterator;
typedef std::vector<vtkAbstractContextItem*>::iterator iterator;
// Older versions of GCC did not implement comparison operators for the
// const_reverse_operator, the simplest thing to do is not use the const
// form of the operator.
#ifdef VTK_CONST_REVERSE_ITERATOR_COMPARISON
typedef std::vector<vtkAbstractContextItem*>::const_reverse_iterator
const_reverse_iterator;
#else
typedef std::vector<vtkAbstractContextItem*>::reverse_iterator
const_reverse_iterator;
#endif
typedef std::vector<vtkAbstractContextItem*>::reverse_iterator
reverse_iterator;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment