summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host/config_global.h.in1
-rw-r--r--configure.ac21
-rw-r--r--sdext/source/pdfimport/tree/drawtreevisiting.cxx4
-rw-r--r--sdext/source/pdfimport/tree/writertreevisiting.cxx3
4 files changed, 26 insertions, 3 deletions
diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in
index 807d599b8046..a029ff53c7e7 100644
--- a/config_host/config_global.h.in
+++ b/config_host/config_global.h.in
@@ -22,6 +22,7 @@ Any change in this header will cause a rebuild of almost everything.
#define HAVE_GCC_PRAGMA_OPERATOR 0
#define HAVE_GCC_DEPRECATED_MESSAGE 0
#define HAVE_THREADSAFE_STATICS 0
+#define HAVE_BROKEN_CONST_ITERATORS 0
#define HAVE_BROKEN_STATIC_INITILIZER_LIST 0
#define HAVE_SYSLOG_H 0
/* Compiler supports __attribute__((warn_unused)). */
diff --git a/configure.ac b/configure.ac
index 6a30d8ac4735..4afc1d413b31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12764,6 +12764,27 @@ if test "$build_os" = "cygwin"; then
AC_SUBST(ILIB)
fi
+AC_MSG_CHECKING(
+ [whether C++11 use of const_iterator in standard containers is broken])
+save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
+AC_LANG_PUSH([C++])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <list>
+ ]],[[
+ std::list<int> l;
+ l.erase(l.cbegin());
+ ]])],
+ [broken=no], [broken=yes])
+AC_LANG_POP([C++])
+LIBS=$save_LIBS
+CXXFLAGS=$save_CXXFLAGS
+AC_MSG_RESULT([$broken])
+if test "$broken" = yes; then
+ AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
+fi
+
+
AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
if test "$CROSS_COMPILING" = "TRUE"; then
broken='assuming not (cross-compiling)'
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 4d262ca23336..eb9780d55b77 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -28,7 +28,7 @@
#include "basegfx/polygon/b2dpolypolygontools.hxx"
#include "basegfx/range/b2drange.hxx"
-
+#include <config_global.h>
#include <osl/diagnose.h>
#include "com/sun/star/i18n/BreakIterator.hpp"
#include "com/sun/star/i18n/CharacterClassification.hpp"
@@ -452,7 +452,7 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >
elem.Children.splice( elem.Children.end(), pNext->Children );
// workaround older compilers that do not have std::list::erase(const_iterator)
-#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 8
+#if HAVE_BROKEN_CONST_ITERATORS
std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
elem.Parent->Children.erase(tmpIt);
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 82f8c38bc27e..93c917a475ad 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -28,6 +28,7 @@
#include "basegfx/polygon/b2dpolypolygontools.hxx"
#include "basegfx/range/b2drange.hxx"
+#include <config_global.h>
#include <osl/diagnose.h>
using namespace ::com::sun::star;
@@ -403,7 +404,7 @@ void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element*
elem.Children.splice( elem.Children.end(), pNext->Children );
// workaround older compilers that do not have std::list::erase(const_iterator)
-#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 8
+#if HAVE_BROKEN_CONST_ITERATORS
std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
elem.Parent->Children.erase(tmpIt);