[umbrello-devel] [PATCH 1/3] kdevcppparser: Always define the `identity' unary function.
Raphael Kubo da Costa
rakuco at FreeBSD.org
Sun Nov 3 13:12:18 UTC 2013
_Identity is an internal, libstdc++-specific struct that is not to be relied
upon by external code.
preprocesslexer.cpp used to assume GCC (with libstdc++) and MSVC were the
only compilers available, and defined its own _Identity implementation for
the latter. It breaks things if any other compiler or STL implementation
(such as clang with libc++) is used.
The easiest fix is to just unconditionally define the `identity' unary
function and use it regardless of whether _Identity is defined or not.
---
umbrello/codeimport/kdevcppparser/preprocesslexer.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/umbrello/codeimport/kdevcppparser/preprocesslexer.cpp b/umbrello/codeimport/kdevcppparser/preprocesslexer.cpp
index 8c26d94..e488e4c 100644
--- a/umbrello/codeimport/kdevcppparser/preprocesslexer.cpp
+++ b/umbrello/codeimport/kdevcppparser/preprocesslexer.cpp
@@ -41,13 +41,11 @@
#define PREPROCESSLEXER_DEBUG
-#ifdef Q_CC_MSVC
template <class _Tp>
-struct _Identity : public std::unary_function<_Tp, _Tp> {
+struct identity : public std::unary_function<_Tp, _Tp> {
_Tp& operator()(_Tp& __x) const { return __x; }
const _Tp& operator()(const _Tp& __x) const { return __x; }
};
-#endif
template <class _Tp>
struct tilde : public std::unary_function<_Tp, _Tp> {
@@ -839,7 +837,7 @@ int PreprocessLexer::macroPrimary()
if (!l_hit)
result = 0;
} else {
- boost::function < int (int) > l_op = _Identity<int>();
+ boost::function < int (int) > l_op = identity<int>();
if (m_source.parse(ch_p('+')
| ch_p('-')[var(l_op) = std::negate<int>()]
| ch_p('!')[var(l_op) = std::logical_not<int>()]
--
1.8.4.2
More information about the umbrello-devel
mailing list