Merge lp:~michihenning/unity-api/clang-fixes into lp:unity-api

Proposed by Michi Henning
Status: Merged
Approved by: Jussi Pakkanen
Approved revision: 109
Merged at revision: 108
Proposed branch: lp:~michihenning/unity-api/clang-fixes
Merge into: lp:unity-api
Diff against target: 33 lines (+12/-1)
2 files modified
CMakeLists.txt (+6/-1)
test/gtest/CMakeLists.txt (+6/-0)
To merge this branch: bzr merge lp:~michihenning/unity-api/clang-fixes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Unity Team Pending
Review via email: mp+191747@code.launchpad.net

Commit message

Don't set -fno-permissive when compiling with clang because clang produces an "ignored" warning for this flag.

Set -DGTEST_USE_OWN_TR1_TUPLE=1 to make tests compile with clang.

Description of the change

Don't set -fno-permissive when compiling with clang because clang produces an "ignored" warning for this flag.

Set -DGTEST_USE_OWN_TR1_TUPLE=1 to make tests compile with clang.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
109. By Michi Henning

Removed trailing whitespace from previous commit.

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

If it works, then it works.

Revision history for this message
Michi Henning (michihenning) wrote :

Yep, works. Not sure whether it's necessary with older versions of clang, but with 4.3, it's needed.

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 2013-09-26 02:48:38 +0000
3+++ CMakeLists.txt 2013-10-18 03:03:05 +0000
4@@ -98,7 +98,12 @@
5 add_definitions(-DUNITY_DLL_EXPORTS)
6 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
7
8-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
9+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -Wall -Wextra")
10+
11+# -fno-permissive causes warnings with clang, so we only enable it for gcc
12+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
13+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-permissive")
14+endif()
15
16 if ("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "relwithdebinfo")
17 option(Werror "Treat warnings as errors" ON)
18
19=== modified file 'test/gtest/CMakeLists.txt'
20--- test/gtest/CMakeLists.txt 2013-06-18 04:03:26 +0000
21+++ test/gtest/CMakeLists.txt 2013-10-18 03:03:05 +0000
22@@ -3,6 +3,12 @@
23 set(LIBGTEST gtest)
24 set(TESTLIBS ${TESTLIBS} ${LIBGTEST} ${CMAKE_THREAD_LIBS_INIT})
25
26+# gtest does weird things with its own implementation of tr1::tuple. For clang, we need to
27+# set this macro, otherwise anything that includes gtest.h won't compile.
28+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
29+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
30+endif()
31+
32 add_subdirectory(libgtest)
33 add_subdirectory(unity)
34

Subscribers

People subscribed via source and target branches

to all changes: