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
=== modified file 'examples/basic.c'
--- examples/basic.c 2015-04-28 07:54:10 +0000
+++ examples/basic.c 2015-07-21 10:17:04 +0000
@@ -91,7 +91,7 @@
9191
92 ///\internal [connect_tag]92 ///\internal [connect_tag]
93 // Call mir_connect and wait for callback to complete.93 // Call mir_connect and wait for callback to complete.
94 mir_wait_for(mir_connect(server, __PRETTY_FUNCTION__, connection_callback, &mcd));94 mir_wait_for(mir_connect(server, __FILE__, connection_callback, &mcd));
95 puts("Connected");95 puts("Connected");
96 ///\internal [connect_tag]96 ///\internal [connect_tag]
9797
@@ -125,7 +125,7 @@
125 MirSurfaceSpec *spec =125 MirSurfaceSpec *spec =
126 mir_connection_create_spec_for_normal_surface(mcd.connection, 640, 480, pixel_format);126 mir_connection_create_spec_for_normal_surface(mcd.connection, 640, 480, pixel_format);
127 assert(spec != NULL);127 assert(spec != NULL);
128 mir_surface_spec_set_name(spec, __PRETTY_FUNCTION__);128 mir_surface_spec_set_name(spec, __FILE__);
129129
130 ///\internal [surface_create_tag]130 ///\internal [surface_create_tag]
131 // ...we create a surface using that format and wait for callback to complete.131 // ...we create a surface using that format and wait for callback to complete.
132132
=== modified file 'examples/flicker.c'
--- examples/flicker.c 2015-04-28 07:54:10 +0000
+++ examples/flicker.c 2015-07-21 10:17:04 +0000
@@ -129,7 +129,7 @@
129129
130 puts("Starting");130 puts("Starting");
131131
132 connection = mir_connect_sync(socket_file, __PRETTY_FUNCTION__);132 connection = mir_connect_sync(socket_file, __FILE__);
133 assert(connection != NULL);133 assert(connection != NULL);
134 assert(mir_connection_is_valid(connection));134 assert(mir_connection_is_valid(connection));
135 assert(strcmp(mir_connection_get_error_message(connection), "") == 0);135 assert(strcmp(mir_connection_get_error_message(connection), "") == 0);
@@ -144,7 +144,7 @@
144 MirSurfaceSpec *spec =144 MirSurfaceSpec *spec =
145 mir_connection_create_spec_for_normal_surface(connection, 640, 480, pixel_format);145 mir_connection_create_spec_for_normal_surface(connection, 640, 480, pixel_format);
146 assert(spec != NULL);146 assert(spec != NULL);
147 mir_surface_spec_set_name(spec, __PRETTY_FUNCTION__);147 mir_surface_spec_set_name(spec, __FILE__);
148 mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software);148 mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software);
149149
150 surface = mir_surface_create_sync(spec);150 surface = mir_surface_create_sync(spec);
151151
=== modified file 'src/client/rpc/mir_protobuf_rpc_channel.cpp'
--- src/client/rpc/mir_protobuf_rpc_channel.cpp 2015-07-16 07:03:19 +0000
+++ src/client/rpc/mir_protobuf_rpc_channel.cpp 2015-07-21 10:17:04 +0000
@@ -19,7 +19,6 @@
19#include "mir_protobuf_rpc_channel.h"19#include "mir_protobuf_rpc_channel.h"
20#include "rpc_report.h"20#include "rpc_report.h"
2121
22#include "mir/protobuf/google_protobuf_guard.h"
23#include "../surface_map.h"22#include "../surface_map.h"
24#include "../mir_surface.h"23#include "../mir_surface.h"
25#include "../display_configuration.h"24#include "../display_configuration.h"
2625
=== removed file 'src/include/common/mir/protobuf/google_protobuf_guard.h'
--- src/include/common/mir/protobuf/google_protobuf_guard.h 2015-02-22 07:46:25 +0000
+++ src/include/common/mir/protobuf/google_protobuf_guard.h 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
1/*
2 * Copyright © 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef MIR_PROTOBUF_GOOGLE_PROTOBUF_GUARD_H_
20#define MIR_PROTOBUF_GOOGLE_PROTOBUF_GUARD_H_
21
22namespace mir
23{
24
25/// subsystem dealing with Google protobuf protocol.
26namespace protobuf
27{
28void google_protobuf_guard();
29}
30}
31
32// Any translation unit that includes this header will get this as part
33// of its initialization, and, in turn, this ensures that protobuf gets
34// initialized (and cleaned up) in a sensible sequence.
35namespace
36{
37bool force_google_protobuf_init{(mir::protobuf::google_protobuf_guard(), true)};
38}
39
40#endif /* MIR_PROTOBUF_GOOGLE_PROTOBUF_GUARD_H_ */
410
=== modified file 'src/protobuf/google_protobuf_guard.cpp'
--- src/protobuf/google_protobuf_guard.cpp 2015-06-23 10:02:53 +0000
+++ src/protobuf/google_protobuf_guard.cpp 2015-07-21 10:17:04 +0000
@@ -16,20 +16,11 @@
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */17 */
1818
19#include "mir/protobuf/google_protobuf_guard.h"
20
21#include <google/protobuf/descriptor.h>19#include <google/protobuf/descriptor.h>
22#include <mutex>
23#include <dlfcn.h>20#include <dlfcn.h>
2421
25namespace mir22extern "C" int __attribute__((constructor))
26{23init_google_protobuf()
27namespace
28{
29std::once_flag init_flag;
30std::once_flag shutdown_flag;
31
32void init_google_protobuf()
33{24{
34 // Leak libmirprotobuf.so.X25 // Leak libmirprotobuf.so.X
35 // This will stop it getting unloaded/reloaded and work around LP: #139197626 // This will stop it getting unloaded/reloaded and work around LP: #1391976
@@ -40,24 +31,20 @@
40 }31 }
4132
42 GOOGLE_PROTOBUF_VERIFY_VERSION;33 GOOGLE_PROTOBUF_VERIFY_VERSION;
34
35 return 0;
43}36}
4437
45void shutdown_google_protobuf()38extern "C" int __attribute__((destructor))
39shutdown_google_protobuf()
46{40{
47 google::protobuf::ShutdownProtobufLibrary();41 google::protobuf::ShutdownProtobufLibrary();
42 return 0;
48}43}
4944
50// Too clever? The idea is to ensure protbuf version is verified once (on45// Preserve ABI
51// the first google_protobuf_guard() call) and memory is released on exit.46namespace mir { namespace protobuf { void google_protobuf_guard(); }}
52struct google_protobuf_guard_t
53{
54 google_protobuf_guard_t() { std::call_once(init_flag, init_google_protobuf); }
55 ~google_protobuf_guard_t() { std::call_once(shutdown_flag, shutdown_google_protobuf); }
56};
57}
58}
5947
60void mir::protobuf::google_protobuf_guard()48void mir::protobuf::google_protobuf_guard()
61{49{
62 static google_protobuf_guard_t guard;
63}50}
6451
=== modified file 'src/server/frontend/protobuf_connection_creator.cpp'
--- src/server/frontend/protobuf_connection_creator.cpp 2015-06-18 11:54:56 +0000
+++ src/server/frontend/protobuf_connection_creator.cpp 2015-07-21 10:17:04 +0000
@@ -27,7 +27,6 @@
2727
28#include "protobuf_ipc_factory.h"28#include "protobuf_ipc_factory.h"
29#include "mir/frontend/session_authorizer.h"29#include "mir/frontend/session_authorizer.h"
30#include "mir/protobuf/google_protobuf_guard.h"
3130
32namespace mf = mir::frontend;31namespace mf = mir::frontend;
33namespace mfd = mir::frontend::detail;32namespace mfd = mir::frontend::detail;
3433
=== modified file 'tests/unit-tests/android_input/property_map.cpp'
--- tests/unit-tests/android_input/property_map.cpp 2013-05-03 16:38:07 +0000
+++ tests/unit-tests/android_input/property_map.cpp 2015-07-21 10:17:04 +0000
@@ -36,7 +36,7 @@
3636
37 static void SetUpTestCase()37 static void SetUpTestCase()
38 {38 {
39 ASSERT_TRUE(std::ofstream(test_file) <<39 ASSERT_TRUE((std::ofstream(test_file) <<
40 "test.string=a_string\n"40 "test.string=a_string\n"
41 "#test.bool.true=true\n"41 "#test.bool.true=true\n"
42 "test.bool.true=1\n"42 "test.bool.true=1\n"
@@ -45,7 +45,7 @@
45 "# a comment\n"45 "# a comment\n"
46 "#test.int.ignored=1\n"46 "#test.int.ignored=1\n"
47 "test.int_32=123\n"47 "test.int_32=123\n"
48 "test.float=0.5\n");48 "test.float=0.5\n").good());
49 }49 }
5050
51 void SetUp()51 void SetUp()

Subscribers

People subscribed via source and target branches