Mir

Merge lp:~alan-griffiths/mir/fix-1475994-g++-5 into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 2764
Proposed branch: lp:~alan-griffiths/mir/fix-1475994-g++-5
Merge into: lp:mir
Diff against target: 193 lines (+15/-70)
7 files modified
examples/basic.c (+2/-2)
examples/flicker.c (+2/-2)
src/client/rpc/mir_protobuf_rpc_channel.cpp (+0/-1)
src/include/common/mir/protobuf/google_protobuf_guard.h (+0/-40)
src/protobuf/google_protobuf_guard.cpp (+9/-22)
src/server/frontend/protobuf_connection_creator.cpp (+0/-1)
tests/unit-tests/android_input/property_map.cpp (+2/-2)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1475994-g++-5
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Daniel van Vugt Approve
Andreas Pokorny (community) Approve
Review via email: mp+265279@code.launchpad.net

Commit message

Rework code that didn't compile with gcc-5.0

Description of the change

Rework code that didn't compile with gcc-5.0

To post a comment you must log in.
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

Hmm I believe .good() tests more.. I think static_cast<bool> would do too - but the extra check for eof should not matter.

We could also use __func__ which ould be closer to __FRETTY_FUNCTION__ or __FUNCTION__.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Works for me on desktop (wily + gcc5). Approved pending Jenkins...

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> ERROR: Throw location unknown (consider using BOOST_THROW_EXCEPTION)
> Dynamic exception type: N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6system12system_errorEEEEE
> std::exception::what: bind: No such file or directory

Yikes!

Looks like we have two sets of boost RTTI in the address space. (Presumably somewhere we're loading both 4.9 and 5.0 versions.)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Probably some android ABI we failed to bump and it's loading the old version via that system-installed android driver.

Actually anpok just landed a potential fix for that on lp:mir/0.14 so try resubmitting -- it might be resolved already.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Probably some android ABI we failed to bump and it's loading the old version
> via that system-installed android driver.
>
> Actually anpok just landed a potential fix for that on lp:mir/0.14 so try
> resubmitting -- it might be resolved already.

I don't think landings on 0.14 affect trunk. We'd need to port that fix.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> > try resubmitting -- it might be resolved already.
>
> I don't think landings on 0.14 affect trunk. We'd need to port that fix.

...and those ABIs are bumped already.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OTOH I think this may go away after 0.14 hits archive/overlay: The modules in 0.14 no longer use the ensure_loaded_with_rtld_global() hack to force RTLD_GLOBAL (and we have fixed the link dependencies to avoid various infelicities).

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> > ERROR: Throw location unknown (consider using BOOST_THROW_EXCEPTION)
> > Dynamic exception type: N5boost16exception_detail10clone_implINS0_19error_in
> fo_injectorINS_6system12system_errorEEEEE
> > std::exception::what: bind: No such file or directory
>
> Yikes!
>
> Looks like we have two sets of boost RTTI in the address space. (Presumably
> somewhere we're loading both 4.9 and 5.0 versions.)

Thinko: we're not building with 5.0

Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/basic.c'
2--- examples/basic.c 2015-04-28 07:54:10 +0000
3+++ examples/basic.c 2015-07-21 10:17:04 +0000
4@@ -91,7 +91,7 @@
5
6 ///\internal [connect_tag]
7 // Call mir_connect and wait for callback to complete.
8- mir_wait_for(mir_connect(server, __PRETTY_FUNCTION__, connection_callback, &mcd));
9+ mir_wait_for(mir_connect(server, __FILE__, connection_callback, &mcd));
10 puts("Connected");
11 ///\internal [connect_tag]
12
13@@ -125,7 +125,7 @@
14 MirSurfaceSpec *spec =
15 mir_connection_create_spec_for_normal_surface(mcd.connection, 640, 480, pixel_format);
16 assert(spec != NULL);
17- mir_surface_spec_set_name(spec, __PRETTY_FUNCTION__);
18+ mir_surface_spec_set_name(spec, __FILE__);
19
20 ///\internal [surface_create_tag]
21 // ...we create a surface using that format and wait for callback to complete.
22
23=== modified file 'examples/flicker.c'
24--- examples/flicker.c 2015-04-28 07:54:10 +0000
25+++ examples/flicker.c 2015-07-21 10:17:04 +0000
26@@ -129,7 +129,7 @@
27
28 puts("Starting");
29
30- connection = mir_connect_sync(socket_file, __PRETTY_FUNCTION__);
31+ connection = mir_connect_sync(socket_file, __FILE__);
32 assert(connection != NULL);
33 assert(mir_connection_is_valid(connection));
34 assert(strcmp(mir_connection_get_error_message(connection), "") == 0);
35@@ -144,7 +144,7 @@
36 MirSurfaceSpec *spec =
37 mir_connection_create_spec_for_normal_surface(connection, 640, 480, pixel_format);
38 assert(spec != NULL);
39- mir_surface_spec_set_name(spec, __PRETTY_FUNCTION__);
40+ mir_surface_spec_set_name(spec, __FILE__);
41 mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software);
42
43 surface = mir_surface_create_sync(spec);
44
45=== modified file 'src/client/rpc/mir_protobuf_rpc_channel.cpp'
46--- src/client/rpc/mir_protobuf_rpc_channel.cpp 2015-07-16 07:03:19 +0000
47+++ src/client/rpc/mir_protobuf_rpc_channel.cpp 2015-07-21 10:17:04 +0000
48@@ -19,7 +19,6 @@
49 #include "mir_protobuf_rpc_channel.h"
50 #include "rpc_report.h"
51
52-#include "mir/protobuf/google_protobuf_guard.h"
53 #include "../surface_map.h"
54 #include "../mir_surface.h"
55 #include "../display_configuration.h"
56
57=== removed file 'src/include/common/mir/protobuf/google_protobuf_guard.h'
58--- src/include/common/mir/protobuf/google_protobuf_guard.h 2015-02-22 07:46:25 +0000
59+++ src/include/common/mir/protobuf/google_protobuf_guard.h 1970-01-01 00:00:00 +0000
60@@ -1,40 +0,0 @@
61-/*
62- * Copyright © 2012 Canonical Ltd.
63- *
64- * This program is free software: you can redistribute it and/or modify it
65- * under the terms of the GNU Lesser General Public License version 3,
66- * as published by the Free Software Foundation.
67- *
68- * This program is distributed in the hope that it will be useful,
69- * but WITHOUT ANY WARRANTY; without even the implied warranty of
70- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71- * GNU Lesser General Public License for more details.
72- *
73- * You should have received a copy of the GNU Lesser General Public License
74- * along with this program. If not, see <http://www.gnu.org/licenses/>.
75- *
76- * Authored by: Alan Griffiths <alan@octopull.co.uk>
77- */
78-
79-#ifndef MIR_PROTOBUF_GOOGLE_PROTOBUF_GUARD_H_
80-#define MIR_PROTOBUF_GOOGLE_PROTOBUF_GUARD_H_
81-
82-namespace mir
83-{
84-
85-/// subsystem dealing with Google protobuf protocol.
86-namespace protobuf
87-{
88-void google_protobuf_guard();
89-}
90-}
91-
92-// Any translation unit that includes this header will get this as part
93-// of its initialization, and, in turn, this ensures that protobuf gets
94-// initialized (and cleaned up) in a sensible sequence.
95-namespace
96-{
97-bool force_google_protobuf_init{(mir::protobuf::google_protobuf_guard(), true)};
98-}
99-
100-#endif /* MIR_PROTOBUF_GOOGLE_PROTOBUF_GUARD_H_ */
101
102=== modified file 'src/protobuf/google_protobuf_guard.cpp'
103--- src/protobuf/google_protobuf_guard.cpp 2015-06-23 10:02:53 +0000
104+++ src/protobuf/google_protobuf_guard.cpp 2015-07-21 10:17:04 +0000
105@@ -16,20 +16,11 @@
106 * Authored by: Alan Griffiths <alan@octopull.co.uk>
107 */
108
109-#include "mir/protobuf/google_protobuf_guard.h"
110-
111 #include <google/protobuf/descriptor.h>
112-#include <mutex>
113 #include <dlfcn.h>
114
115-namespace mir
116-{
117-namespace
118-{
119-std::once_flag init_flag;
120-std::once_flag shutdown_flag;
121-
122-void init_google_protobuf()
123+extern "C" int __attribute__((constructor))
124+init_google_protobuf()
125 {
126 // Leak libmirprotobuf.so.X
127 // This will stop it getting unloaded/reloaded and work around LP: #1391976
128@@ -40,24 +31,20 @@
129 }
130
131 GOOGLE_PROTOBUF_VERIFY_VERSION;
132+
133+ return 0;
134 }
135
136-void shutdown_google_protobuf()
137+extern "C" int __attribute__((destructor))
138+shutdown_google_protobuf()
139 {
140 google::protobuf::ShutdownProtobufLibrary();
141+ return 0;
142 }
143
144-// Too clever? The idea is to ensure protbuf version is verified once (on
145-// the first google_protobuf_guard() call) and memory is released on exit.
146-struct google_protobuf_guard_t
147-{
148- google_protobuf_guard_t() { std::call_once(init_flag, init_google_protobuf); }
149- ~google_protobuf_guard_t() { std::call_once(shutdown_flag, shutdown_google_protobuf); }
150-};
151-}
152-}
153+// Preserve ABI
154+namespace mir { namespace protobuf { void google_protobuf_guard(); }}
155
156 void mir::protobuf::google_protobuf_guard()
157 {
158- static google_protobuf_guard_t guard;
159 }
160
161=== modified file 'src/server/frontend/protobuf_connection_creator.cpp'
162--- src/server/frontend/protobuf_connection_creator.cpp 2015-06-18 11:54:56 +0000
163+++ src/server/frontend/protobuf_connection_creator.cpp 2015-07-21 10:17:04 +0000
164@@ -27,7 +27,6 @@
165
166 #include "protobuf_ipc_factory.h"
167 #include "mir/frontend/session_authorizer.h"
168-#include "mir/protobuf/google_protobuf_guard.h"
169
170 namespace mf = mir::frontend;
171 namespace mfd = mir::frontend::detail;
172
173=== modified file 'tests/unit-tests/android_input/property_map.cpp'
174--- tests/unit-tests/android_input/property_map.cpp 2013-05-03 16:38:07 +0000
175+++ tests/unit-tests/android_input/property_map.cpp 2015-07-21 10:17:04 +0000
176@@ -36,7 +36,7 @@
177
178 static void SetUpTestCase()
179 {
180- ASSERT_TRUE(std::ofstream(test_file) <<
181+ ASSERT_TRUE((std::ofstream(test_file) <<
182 "test.string=a_string\n"
183 "#test.bool.true=true\n"
184 "test.bool.true=1\n"
185@@ -45,7 +45,7 @@
186 "# a comment\n"
187 "#test.int.ignored=1\n"
188 "test.int_32=123\n"
189- "test.float=0.5\n");
190+ "test.float=0.5\n").good());
191 }
192
193 void SetUp()

Subscribers

People subscribed via source and target branches