summaryrefslogtreecommitdiff
path: root/external/liborcus/0001-Blind-fix-attempt-for-older-macOS-builds.patch
blob: a25a42fd2549d3a42f56c41bc08bb0c59b93a7e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
From a0d47fff81ac100192ada343574da75d992dd00d Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Fri, 23 Aug 2019 10:26:51 +0200
Subject: [PATCH] Blind fix attempt for older macOS builds

...like <https://ci.libreoffice.org/job/gerrit_mac/40711/> (which builds with
MacOSX10.13.sdk, but not sure with what Clang and libc++ versions):

> In file included from xml_map_tree.cpp:8:
> In file included from ./xml_map_tree.hpp:11:
> In file included from ../../include/orcus/pstring.hpp:14:
> In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
> In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:169:
> In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
> In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:643:
> In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:653:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/tuple:227:10: error: static_assert failed "Attempted to construct a reference element in a tuple with an rvalue"
>         {static_assert(__can_bind_reference<_Tp>(),
>          ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/tuple:385:13: note: in instantiation of function template specialization 'std::__1::__tuple_leaf<2, const orcus::pstring &, false>::__tuple_leaf<orcus::pstring, void>' requested here
>             __tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))...,
>             ^
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/tuple:738:15: note: in instantiation of function template specialization 'std::__1::__tuple_impl<std::__1::__tuple_indices<0, 1, 2, 3, 4>, orcus::xml_map_tree &, const char *, const orcus::pstring &, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type>::__tuple_impl<0, 1, 2, 3, 4, orcus::xml_map_tree &, const char *, const orcus::pstring &, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type, orcus::xml_map_tree &, const char *&, orcus::pstring, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type>' requested here
>             : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
>               ^
> xml_map_tree.cpp:216:13: note: in instantiation of function template specialization 'std::__1::tuple<orcus::xml_map_tree &, const char *, const orcus::pstring &, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type>::tuple<orcus::xml_map_tree &, const char *&, orcus::pstring, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type, false, false>' requested here
>             element::args_type(
>             ^
> 1 error generated.
> Makefile:1804: recipe for target 'liborcus_0.15_la-xml_map_tree.lo' failed
> make[5]: *** [liborcus_0.15_la-xml_map_tree.lo] Error 1

(while building orcus as part of LibreOffice).

(Using "nm" instead of a more descriptive variable name "name" to avoid
-Wshadow warnings like

> xml_map_tree.cpp: In member function ‘orcus::xml_map_tree::element* orcus::xml_map_tree::element::get_or_create_child(orcus::xml_map_tree&, orcus::xmlns_id_t, const orcus::pstring&)’:
> xml_map_tree.cpp:214:16: warning: declaration of ‘name’ shadows a member of ‘orcus::xml_map_tree::element’ [-Wshadow]
>   214 |     auto const name = sp.intern(_name.get(), _name.size()).first;
>       |                ^~~~
> In file included from xml_map_tree.cpp:8:
> xml_map_tree.hpp:126:17: note: shadowed declaration is here
>   126 |         pstring name;
>       |                 ^~~~

)
---
 src/liborcus/xml_map_tree.cpp | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/liborcus/xml_map_tree.cpp b/src/liborcus/xml_map_tree.cpp
index 8338b930..1a9251c8 100644
--- a/src/liborcus/xml_map_tree.cpp
+++ b/src/liborcus/xml_map_tree.cpp
@@ -211,12 +211,13 @@ xml_map_tree::element* xml_map_tree::element::get_or_create_child(
     string_pool& sp = parent.m_names;
 
     // Insert a new element of this name.
+    auto const nm = sp.intern(_name.get(), _name.size()).first;
     child_elements->push_back(
         parent.m_element_pool.construct(
             element::args_type(
                 parent,
                 _ns,
-                sp.intern(_name.get(), _name.size()).first,
+                nm,
                 element_unlinked,
                 reference_unknown
             )
@@ -251,12 +252,13 @@ xml_map_tree::element* xml_map_tree::element::get_or_create_linked_child(
     string_pool& sp = parent.m_names;
 
     // Insert a new linked element of this name.
+    auto const nm = sp.intern(_name.get(), _name.size()).first;
     child_elements->push_back(
         parent.m_element_pool.construct(
             element::args_type(
                 parent,
                 _ns,
-                sp.intern(_name.get(), _name.size()).first,
+                nm,
                 element_linked,
                 _ref_type
             )
@@ -699,11 +701,12 @@ xml_map_tree::linked_node_type xml_map_tree::get_linked_node(const pstring& xpat
         if (token.attribute)
             throw xpath_error("root element cannot be an attribute.");
 
+        auto const nm = m_names.intern(token.name).first;
         mp_root = m_element_pool.construct(
             element::args_type(
                 *this,
                 token.ns,
-                m_names.intern(token.name).first,
+                nm,
                 element_unlinked,
                 reference_unknown
             )
@@ -748,11 +751,12 @@ xml_map_tree::linked_node_type xml_map_tree::get_linked_node(const pstring& xpat
         if (it != attrs.end())
             throw xpath_error("This attribute is already linked.  You can't link the same attribute twice.");
 
+        auto const nm = m_names.intern(token.name.get(), token.name.size()).first;
         attribute* p = m_attribute_pool.construct(
             attribute::args_type(
                 *this,
                 token.ns,
-                m_names.intern(token.name.get(), token.name.size()).first,
+                nm,
                 ref_type
             )
         );
@@ -789,11 +793,12 @@ xml_map_tree::element* xml_map_tree::get_element(const pstring& xpath)
         if (token.attribute)
             throw xpath_error("root element cannot be an attribute.");
 
+        auto const nm = m_names.intern(token.name).first;
         mp_root = m_element_pool.construct(
             element::args_type(
                 *this,
                 token.ns,
-                m_names.intern(token.name).first,
+                nm,
                 element_unlinked,
                 reference_unknown
             )
-- 
2.21.0