config_host/config_global.h.in | 1 + configure.ac | 21 +++++++++++++++++++++ sdext/source/pdfimport/tree/drawtreevisiting.cxx | 4 ++-- sdext/source/pdfimport/tree/writertreevisiting.cxx | 3 ++- 4 files changed, 26 insertions(+), 3 deletions(-)
New commits: commit 0032fc0385679d15992fb1a2e8dc0ff1c228c911 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Jun 19 15:21:27 2015 +0200 Fix check for broken standard library The compiler's __GNUC__ etc. need not match the libstdc++ version used (esp. when using Clang as compiler), and libstdc++'s __GLIBCXX__ macro doesn't inrease monotonically with version numbers, so resort to a configure check. Change-Id: I06de6b68324169863f6f5c31ae5d855e8b04cd6b diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in index 807d599..a029ff5 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 6a30d8a..4afc1d4 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 4d262ca..eb9780d 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 82f8c38..93c917a 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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits