Merge lp:~alan-griffiths/miral/fix-for-clang into lp:miral

Proposed by Alan Griffiths on 2016-08-22
Status: Merged
Approved by: Gerry Boland on 2016-08-22
Approved revision: 294
Merged at revision: 292
Proposed branch: lp:~alan-griffiths/miral/fix-for-clang
Merge into: lp:miral
Diff against target: 63 lines (+30/-1)
2 files modified
CMakeLists.txt (+8/-1)
test/CMakeLists.txt (+22/-0)
To merge this branch: bzr merge lp:~alan-griffiths/miral/fix-for-clang
Reviewer Review Type Date Requested Status
Gerry Boland 2016-08-22 Approve on 2016-08-22
Review via email: mp+303535@code.launchpad.net

Commit Message

Fix build with clang++

To post a comment you must log in.
291. By Alan Griffiths on 2016-08-22

Link workaround to Mir bug (lp:1615587)

Gerry Boland (gerboland) wrote :

Failed here in xenial+overlay:

[80/235] Building CXX object test/CMakeFiles/miral-test.dir/mru_window_list.cpp.o
FAILED: /usr/lib/ccache/clang++ -I../include -isystem /usr/include/mirclient -isystem /usr/include/mircommon -isystem /usr/include/mircookie -I/usr/include/mirtest -I/usr/include/mirserver -I/usr/include/mirplatform -Wno-mismatched-tags -pthread -g -Werror -Wall -pedantic -Wextra -fPIC -fuse-ld=gold -Wno-unused-command-line-argument -Wnon-virtual-dtor -std=c++14 -Wno-mismatched-tags -Wno-return-type-c-linkage -MMD -MT test/CMakeFiles/miral-test.dir/mru_window_list.cpp.o -MF test/CMakeFiles/miral-test.dir/mru_window_list.cpp.o.d -o test/CMakeFiles/miral-test.dir/mru_window_list.cpp.o -c ../test/mru_window_list.cpp
In file included from ../test/mru_window_list.cpp:22:
/usr/include/mirtest/mir/test/doubles/stub_session.h:92:24: error: 'create_buffer' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    graphics::BufferID create_buffer(graphics::BufferProperties const& properties);
                       ^
/usr/include/mirserver/mir/scene/session.h:72:32: note: overridden virtual function is here
    virtual graphics::BufferID create_buffer(graphics::BufferProperties const& properties) = 0;
                               ^
In file included from ../test/mru_window_list.cpp:22:
/usr/include/mirtest/mir/test/doubles/stub_session.h:93:10: error: 'destroy_buffer' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    void destroy_buffer(graphics::BufferID);
         ^
/usr/include/mirserver/mir/scene/session.h:73:18: note: overridden virtual function is here
    virtual void destroy_buffer(graphics::BufferID) = 0;
                 ^
In file included from ../test/mru_window_list.cpp:22:
/usr/include/mirtest/mir/test/doubles/stub_session.h:94:39: error: 'get_buffer' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    std::shared_ptr<graphics::Buffer> get_buffer(graphics::BufferID);
                                      ^
/usr/include/mirserver/mir/scene/session.h:74:47: note: overridden virtual function is here
    virtual std::shared_ptr<graphics::Buffer> get_buffer(graphics::BufferID) = 0;
                                              ^
3 errors generated.
[80/235] Building CXX object miral-qt/tests/framework/CMakeFiles/qtmir-test-framework-static.dir/fake_mirsurface.cpp.o
ninja: build stopped: subcommand failed.

review: Needs Fixing
Gerry Boland (gerboland) wrote :

Command used:
cmake .. -DMIRAL_ENABLE_QT=1 -DMIRAL_ENABLE_TESTS=1 -DCMAKE_CXX_COMPILER=clang++ -GNinja

292. By Alan Griffiths on 2016-08-22

merge :parent

293. By Alan Griffiths on 2016-08-22

Workaround lp:1615646

Alan Griffiths (alan-griffiths) wrote :

> Failed here in xenial+overlay:
> /usr/include/mirtest/mir/test/doubles/stub_session.h:92:24: error:
> 'create_buffer' overrides a member function but is not marked 'override'
> [-Werror,-Winconsistent-missing-override]
> graphics::BufferID create_buffer(graphics::BufferProperties const&
> properties);

Logged as Mir bug lp:1615646 and workaround added to MirAL

294. By Alan Griffiths on 2016-08-22

Mir already fixed on trunk

Gerry Boland (gerboland) wrote :

Yep, works now, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-08-19 10:54:39 +0000
3+++ CMakeLists.txt 2016-08-22 13:59:01 +0000
4@@ -6,6 +6,7 @@
5 endif()
6
7 include (GNUInstallDirs)
8+include(CheckCXXCompilerFlag)
9
10 cmake_policy(SET CMP0015 NEW)
11 cmake_policy(SET CMP0022 NEW)
12@@ -24,7 +25,8 @@
13 if (MIRAL_USE_LD_GOLD)
14 set(MIRAL_COMPILER_FLAGS "${MIRAL_COMPILER_FLAGS} -fuse-ld=gold")
15 set(MIRAL_LINKER_FLAGS "${MIRAL_LINKER_FLAGS} -fuse-ld=gold")
16- if ("${CMAKE_CXX_COMPILER}" MATCHES "clang")
17+ check_cxx_compiler_flag(-Wno-unused-command-line-argument MIRAL_COMPILE_WITH_W_NO_UNUSED_COMMAND_LINE_ARGUMENT)
18+ if (MIRAL_COMPILE_WITH_W_NO_UNUSED_COMMAND_LINE_ARGUMENT)
19 set(MIRAL_COMPILER_FLAGS "${MIRAL_COMPILER_FLAGS} -Wno-unused-command-line-argument")
20 endif()
21 endif()
22@@ -39,6 +41,11 @@
23 endif()
24 endif()
25
26+check_cxx_compiler_flag(-Wno-mismatched-tags MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS)
27+if (MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS)
28+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags")
29+endif()
30+
31 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MIRAL_COMPILER_FLAGS}")
32 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MIRAL_COMPILER_FLAGS} -Wnon-virtual-dtor -std=c++14")
33 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}")
34
35=== modified file 'test/CMakeLists.txt'
36--- test/CMakeLists.txt 2016-08-19 10:54:39 +0000
37+++ test/CMakeLists.txt 2016-08-22 13:59:01 +0000
38@@ -1,3 +1,25 @@
39+if (MIRTEST_VERSION VERSION_LESS 0.25)
40+ # Mir used mix struct and class in public test headers (fixed -r 3606 in lp:mir)
41+ check_cxx_compiler_flag(-Wno-mismatched-tags MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS)
42+ if (MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS)
43+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags")
44+ endif()
45+
46+ if (NOT MIRTEST_VERSION VERSION_LESS 0.24)
47+ # Mir 0.24 shipped with inconsistent override use in mirtest/mir/test/doubles/stub_session.h (lp:1609612)
48+ check_cxx_compiler_flag(-Wno-inconsistent-missing-override MIRAL_COMPILE_WITH_W_NO_INCONSISTENT_MISSING_OVERRIDE)
49+ if (MIRAL_COMPILE_WITH_W_NO_INCONSISTENT_MISSING_OVERRIDE)
50+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
51+ endif()
52+ endif()
53+endif()
54+
55+# Mir uses "C" linkage to avoid name-mangling some functions that are not intended not for C compatibility (lp:1615587)
56+check_cxx_compiler_flag(-Wno-return-type-c-linkage MIRAL_COMPILE_WITH_W_RETURN_TYPE_C_LINKAGE)
57+if (MIRAL_COMPILE_WITH_W_RETURN_TYPE_C_LINKAGE)
58+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
59+endif()
60+
61 include_directories(
62 ${MIRTEST_INCLUDE_DIRS}
63 ${GMOCK_INCLUDE_DIR}

Subscribers

People subscribed via source and target branches