[Libreoffice-commits] core.git: bridges/source include/formula include/o3tl sw/inc
Stephan Bergmann
sbergman at redhat.com
Fri Jun 26 08:31:28 PDT 2015
bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx | 2
bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx | 8
bridges/source/cpp_uno/mingw_intel/share.hxx | 13 -
bridges/source/cpp_uno/mingw_x86-64/share.hxx | 13 -
include/formula/tokenarray.hxx | 4
include/o3tl/typed_flags_set.hxx | 115 ++++------
include/o3tl/underlying_type.hxx | 32 --
sw/inc/ring.hxx | 6
8 files changed, 57 insertions(+), 136 deletions(-)
New commits:
commit 3a68a7dcf49f7be95086b747c8426aa310307e49
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 26 17:28:43 2015 +0200
Remove workarounds for no longer supported GCC 4.6
In bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx, the #if also covered
Clang, which actually needs these declarations (for now; the right fix will
probably be to #include <cxxabi.h>).
Change-Id: I1eebd59e2371f3498d740ab78244927358c4f23f
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
index 15b357b..af20806 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
@@ -58,7 +58,7 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
// unexpected size of int
assert(nStackLongs && pStackLongs); // no stack
-#if defined __clang__ || __GNUC__ == 4 && __GNUC_MINOR__ <= 6
+#if defined __clang__
if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
#endif
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
index 0185a2c..0c7bbbf 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
@@ -133,18 +133,10 @@ extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw(
namespace CPPU_CURRENT_NAMESPACE
{
-// The following are in cxxabi.h since GCC 4.7 (they are wrapped in
-// CPPU_CURRENT_NAMESPACE here as different GCC versions have slightly different
-// declarations for them, e.g., with or without throw() specification, so would
-// complain about redeclarations of these somewhat implicitly declared
-// functions):
-#if __GNUC__ == 4 && __GNUC_MINOR__ <= 6
extern "C" void *__cxa_allocate_exception(
std::size_t thrown_size ) throw();
extern "C" void __cxa_throw (
void *thrown_exception, void *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
-#endif
-
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
diff --git a/bridges/source/cpp_uno/mingw_intel/share.hxx b/bridges/source/cpp_uno/mingw_intel/share.hxx
index b39ed6b..0ce7423 100644
--- a/bridges/source/cpp_uno/mingw_intel/share.hxx
+++ b/bridges/source/cpp_uno/mingw_intel/share.hxx
@@ -84,19 +84,6 @@ extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw(
namespace CPPU_CURRENT_NAMESPACE
{
-// The following are in cxxabi.h since GCC 4.7 (they are wrapped in
-// CPPU_CURRENT_NAMESPACE here as different GCC versions have slightly different
-// declarations for them, e.g., with or without throw() specification, so would
-// complain about redeclarations of these somewhat implicitly declared
-// functions):
-#if __GNUC__ == 4 && __GNUC_MINOR__ <= 6
-extern "C" void *__cxa_allocate_exception(
- std::size_t thrown_size ) throw();
-extern "C" void __cxa_throw (
- void *thrown_exception, void *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
-#endif
-
-
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
diff --git a/bridges/source/cpp_uno/mingw_x86-64/share.hxx b/bridges/source/cpp_uno/mingw_x86-64/share.hxx
index 61d278d..8093820 100644
--- a/bridges/source/cpp_uno/mingw_x86-64/share.hxx
+++ b/bridges/source/cpp_uno/mingw_x86-64/share.hxx
@@ -79,19 +79,6 @@ extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw(
namespace CPPU_CURRENT_NAMESPACE
{
-// The following are in cxxabi.h since GCC 4.7 (they are wrapped in
-// CPPU_CURRENT_NAMESPACE here as different GCC versions have slightly different
-// declarations for them, e.g., with or without throw() specification, so would
-// complain about redeclarations of these somewhat implicitly declared
-// functions):
-#if __GNUC__ == 4 && __GNUC_MINOR__ <= 6
-extern "C" void *__cxa_allocate_exception(
- std::size_t thrown_size ) throw();
-extern "C" void __cxa_throw (
- void *thrown_exception, void *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
-#endif
-
-
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
index 58bb092..6d577ea 100644
--- a/include/formula/tokenarray.hxx
+++ b/include/formula/tokenarray.hxx
@@ -23,10 +23,10 @@
#include <com/sun/star/sheet/FormulaToken.hpp>
#include <formula/token.hxx>
#include <formula/ExternalReferenceHelper.hxx>
-#include <o3tl/underlying_type.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <limits.h>
+#include <type_traits>
#include <unordered_set>
namespace svl {
@@ -98,7 +98,7 @@ public:
static inline bool isRewriteNeeded( OpCode eOp );
};
-typedef std::unordered_set<OpCode, std::hash<o3tl::underlying_type<OpCode>::type> > unordered_opcode_set;
+typedef std::unordered_set<OpCode, std::hash<std::underlying_type<OpCode>::type> > unordered_opcode_set;
class FORMULA_DLLPUBLIC FormulaTokenArray
{
diff --git a/include/o3tl/typed_flags_set.hxx b/include/o3tl/typed_flags_set.hxx
index 01a4009..76cefc5 100644
--- a/include/o3tl/typed_flags_set.hxx
+++ b/include/o3tl/typed_flags_set.hxx
@@ -46,14 +46,6 @@ typename std::enable_if<std::is_unsigned<T>::value, bool>::type isNonNegative(T)
template<typename T> struct typed_flags {};
-#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 6 && \
- !defined __clang__
-// use largest sensible unsigned type as fallback
-#define O3TL_STD_UNDERLYING_TYPE_E unsigned long long
-#else
-#define O3TL_STD_UNDERLYING_TYPE_E typename std::underlying_type<E>::type
-#endif
-
/// Mark a (scoped) enumeration as a set of bit flags, with accompanying
/// operations.
///
@@ -67,7 +59,7 @@ template<typename T> struct typed_flags {};
///
/// \param E the enumeration type.
/// \param M the all-bits-set value for the bit flags.
-template<typename E, O3TL_STD_UNDERLYING_TYPE_E M>
+template<typename E, typename std::underlying_type<E>::type M>
struct is_typed_flags {
static_assert(
M >= 0, "is_typed_flags expects only non-negative bit values");
@@ -76,21 +68,22 @@ struct is_typed_flags {
class Wrap {
public:
- explicit Wrap(O3TL_STD_UNDERLYING_TYPE_E value):
+ explicit Wrap(typename std::underlying_type<E>::type value):
value_(value)
{ assert(detail::isNonNegative(value)); }
operator E() { return static_cast<E>(value_); }
- explicit operator O3TL_STD_UNDERLYING_TYPE_E() { return value_; }
+ explicit operator typename std::underlying_type<E>::type()
+ { return value_; }
explicit operator bool() { return value_ != 0; }
private:
- O3TL_STD_UNDERLYING_TYPE_E value_;
+ typename std::underlying_type<E>::type value_;
};
- static O3TL_STD_UNDERLYING_TYPE_E const mask = M;
+ static typename std::underlying_type<E>::type const mask = M;
};
}
@@ -99,10 +92,10 @@ template<typename E>
inline typename o3tl::typed_flags<E>::Wrap operator ~(E rhs) {
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
o3tl::typed_flags<E>::mask
- & ~static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ & ~static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -111,20 +104,20 @@ inline typename o3tl::typed_flags<E>::Wrap operator ~(
{
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
o3tl::typed_flags<E>::mask
- & ~static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ & ~static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
inline typename o3tl::typed_flags<E>::Wrap operator ^(E lhs, E rhs) {
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- ^ static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ ^ static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -133,10 +126,10 @@ inline typename o3tl::typed_flags<E>::Wrap operator ^(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- ^ static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ ^ static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -145,10 +138,10 @@ inline typename o3tl::typed_flags<E>::Wrap operator ^(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- ^ static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ ^ static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -157,21 +150,21 @@ inline typename o3tl::typed_flags<E>::Wrap operator ^(
typename o3tl::typed_flags<E>::Wrap rhs)
{
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- ^ static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ ^ static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
inline typename o3tl::typed_flags<E>::Wrap operator &(E lhs, E rhs) {
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- & static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ & static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -180,10 +173,10 @@ inline typename o3tl::typed_flags<E>::Wrap operator &(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- & static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ & static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -192,10 +185,10 @@ inline typename o3tl::typed_flags<E>::Wrap operator &(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- & static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ & static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -204,21 +197,21 @@ inline typename o3tl::typed_flags<E>::Wrap operator &(
typename o3tl::typed_flags<E>::Wrap rhs)
{
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- & static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ & static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
inline typename o3tl::typed_flags<E>::Wrap operator |(E lhs, E rhs) {
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- | static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ | static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -227,10 +220,10 @@ inline typename o3tl::typed_flags<E>::Wrap operator |(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- | static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ | static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -239,10 +232,10 @@ inline typename o3tl::typed_flags<E>::Wrap operator |(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- | static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ | static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
@@ -251,18 +244,18 @@ inline typename o3tl::typed_flags<E>::Wrap operator |(
typename o3tl::typed_flags<E>::Wrap rhs)
{
return static_cast<typename o3tl::typed_flags<E>::Wrap>(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)
- | static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs));
+ static_cast<typename std::underlying_type<E>::type>(lhs)
+ | static_cast<typename std::underlying_type<E>::type>(rhs));
}
template<typename E>
inline typename o3tl::typed_flags<E>::Self operator &=(E & lhs, E rhs) {
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
lhs = lhs & rhs;
return lhs;
}
@@ -273,7 +266,7 @@ inline typename o3tl::typed_flags<E>::Self operator &=(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
lhs = lhs & rhs;
return lhs;
}
@@ -282,10 +275,10 @@ template<typename E>
inline typename o3tl::typed_flags<E>::Self operator |=(E & lhs, E rhs) {
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
lhs = lhs | rhs;
return lhs;
}
@@ -296,7 +289,7 @@ inline typename o3tl::typed_flags<E>::Self operator |=(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
lhs = lhs | rhs;
return lhs;
}
@@ -305,10 +298,10 @@ template<typename E>
inline typename o3tl::typed_flags<E>::Self operator ^=(E & lhs, E rhs) {
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs)));
+ static_cast<typename std::underlying_type<E>::type>(rhs)));
lhs = lhs ^ rhs;
return lhs;
}
@@ -319,7 +312,7 @@ inline typename o3tl::typed_flags<E>::Self operator ^=(
{
assert(
o3tl::detail::isNonNegative(
- static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs)));
+ static_cast<typename std::underlying_type<E>::type>(lhs)));
lhs = lhs ^ rhs;
return lhs;
}
diff --git a/include/o3tl/underlying_type.hxx b/include/o3tl/underlying_type.hxx
deleted file mode 100644
index 4b2e077..0000000
--- a/include/o3tl/underlying_type.hxx
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_O3TL_UNDERLYING_TYPE_HXX
-#define INCLUDED_O3TL_UNDERLYING_TYPE_HXX
-
-#include <sal/config.h>
-
-#include <type_traits>
-
-namespace o3tl {
-
-template<typename T> struct underlying_type {
-#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 6 && \
- !defined __clang__
- typedef int type;
-#else
- typedef typename std::underlying_type<T>::type type;
-#endif
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index f6aac23..61423d0 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -109,18 +109,12 @@ namespace sw
static node_ptr get_previous(const_node_ptr n) { return const_cast<node_ptr>(n)->pPrev; };
static void set_previous(node_ptr n, node_ptr previous) { n->pPrev = previous; };
};
-#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 7)
- // gcc 4.6 backwards compat hack, remove ASAP when we drop support
- template<typename gcc_hack_value> friend class sw::RingContainer;
- template<typename gcc_hack_value> friend class sw::RingIterator;
-#else
friend ring_container;
friend const_ring_container;
friend typename ring_container::iterator;
friend typename ring_container::const_iterator;
friend typename const_ring_container::iterator;
friend typename const_ring_container::const_iterator;
-#endif
friend class boost::iterator_core_access;
typedef boost::intrusive::circular_list_algorithms<Ring_node_traits> algo;
Ring* pNext;
More information about the Libreoffice-commits
mailing list