{"action":"created","comment":{"url":"https://api.github.com/repos/google/benchmark/pulls/comments/29517400","id":29517400,"diff_hunk":"@@ -17,38 +18,73 @@ message(\"-- Version: ${VERSION}\")\n set(GENERIC_LIB_VERSION ${VERSION})\n string(SUBSTRING ${VERSION} 0 1 GENERIC_LIB_SOVERSION)\n \n-# Try and enable C++11. Don't use C++14 because it doesn't work in some\n-# configurations.\n+# Import our CMake modules\n include(CheckCXXCompilerFlag)\n include(AddCXXCompilerFlag)\n include(CXXFeatureCheck)\n \n-check_cxx_compiler_flag(-std=c++11 HAVE_FLAG_CXX_11)\n-check_cxx_compiler_flag(-std=c++0x HAVE_FLAG_CXX_0X)\n-if (HAVE_FLAG_CXX_11)\n-  set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11\")\n-elseif (HAVE_FLAG_CXX_0X)\n-  set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++0x\")\n+# Try and enable C++11. Don't use C++14 because it doesn't work in some\n+# configurations.\n+add_cxx_compiler_flag(-std=c++11)\n+if (NOT HAVE_CXX_FLAG_STD_CXX11)\n+  add_cxx_compiler_flag(-std=c++0x)\n endif()\n \n # Turn compiler warnings up to 11\n add_cxx_compiler_flag(-Wall)\n add_cxx_compiler_flag(-Wextra)\n add_cxx_compiler_flag(-Wshadow)\n-add_cxx_compiler_flag(-Werror)\n-add_cxx_compiler_flag(-pedantic-errors)\n+add_cxx_compiler_flag(-Werror RELEASE)\n+add_cxx_compiler_flag(-pedantic)\n+add_cxx_compiler_flag(-pedantic-errors RELEASE)\n add_cxx_compiler_flag(-Wshorten-64-to-32)\n add_cxx_compiler_flag(-Wfloat-equal)\n add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)\n-# Release flags\n-add_cxx_compiler_flag(-fno-strict-aliasing RELEASE)\n-\n add_cxx_compiler_flag(-Wthread-safety)\n if (HAVE_WTHREAD_SAFETY)\n   add_definitions(-DHAVE_WTHREAD_SAFETY)\n   cxx_feature_check(THREAD_SAFETY_ATTRIBUTES)\n endif()\n \n+# Release flags\n+add_cxx_compiler_flag(-fno-strict-aliasing RELEASE)\n+\n+# Link time optimisation\n+if (BENCHMARK_ENABLE_LTO)\n+  add_cxx_compiler_flag(-flto RELEASE)\n+  if (\"${CMAKE_C_COMPILER_ID}\" STREQUAL \"GNU\")\n+    find_program(GCC_AR gcc-ar)\n+    if (GCC_AR)\n+      set(CMAKE_AR ${GCC_AR})\n+    endif()\n+    find_program(GCC_RANLIB gcc-ranlib)\n+    if (GCC_RANLIB)\n+      set(CMAKE_RANLIB ${GCC_RANLIB})\n+    endif()\n+  endif()\n+endif()\n+\n+# Coverage build type\n+set(CMAKE_CXX_FLAGS_COVERAGE \"${CMAKE_CXX_FLAGS_DEBUG}\" CACHE STRING\n+  \"Flags used by the C++ compiler during coverage builds.\"\n+  FORCE)\n+set(CMAKE_EXE_LINKER_FLAGS_COVERAGE\n+  \"${CMAKE_EXE_LINKER_FLAGS_DEBUG}\" CACHE STRING\n+  \"Flags used for linking binaries during coverage builds.\"\n+  FORCE)\n+set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE\n+  \"${CMAKE_SHARED_LINKER_FLAGS_DEBUG}\" CACHE STRING\n+  \"Flags used by the shared libraries linker during coverage builds.\"\n+  FORCE)\n+mark_as_advanced(\n+  CMAKE_CXX_FLAGS_COVERAGE\n+  CMAKE_EXE_LINKER_FLAGS_COVERAGE\n+  CMAKE_SHARED_LINKER_FLAGS_COVERAGE)\n+set(CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\" CACHE STRING\n+  \"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage.\"\n+  FORCE)\n+add_cxx_compiler_flag(--coverage COVERAGE)","path":"CMakeLists.txt","position":90,"original_position":90,"commit_id":"7f37c9520b838aac13713556f7d87cc50689a557","original_commit_id":"7f37c9520b838aac13713556f7d87cc50689a557","user":{"login":"EricWF","id":1176427,"avatar_url":"https://avatars.githubusercontent.com/u/1176427?v=3","gravatar_id":"","url":"https://api.github.com/users/EricWF","html_url":"https://github.com/EricWF","followers_url":"https://api.github.com/users/EricWF/followers","following_url":"https://api.github.com/users/EricWF/following{/other_user}","gists_url":"https://api.github.com/users/EricWF/gists{/gist_id}","starred_url":"https://api.github.com/users/EricWF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricWF/subscriptions","organizations_url":"https://api.github.com/users/EricWF/orgs","repos_url":"https://api.github.com/users/EricWF/repos","events_url":"https://api.github.com/users/EricWF/events{/privacy}","received_events_url":"https://api.github.com/users/EricWF/received_events","type":"User","site_admin":false},"body":"the presence of the second `COVERAGE` arg means that the flag gets added to CMAKE_CXX_FLAGS_COVERAGE and not directly to CMAKE_CXX_FLAGS.","created_at":"2015-05-01T17:30:06Z","updated_at":"2015-05-01T17:30:06Z","html_url":"https://github.com/google/benchmark/pull/122#discussion_r29517400","pull_request_url":"https://api.github.com/repos/google/benchmark/pulls/122","_links":{"self":{"href":"https://api.github.com/repos/google/benchmark/pulls/comments/29517400"},"html":{"href":"https://github.com/google/benchmark/pull/122#discussion_r29517400"},"pull_request":{"href":"https://api.github.com/repos/google/benchmark/pulls/122"}}},"pull_request":{"url":"https://api.github.com/repos/google/benchmark/pulls/122","id":34462564,"html_url":"https://github.com/google/benchmark/pull/122","diff_url":"https://github.com/google/benchmark/pull/122.diff","patch_url":"https://github.com/google/benchmark/pull/122.patch","issue_url":"https://api.github.com/repos/google/benchmark/issues/122","number":122,"state":"open","locked":false,"title":"Coverage","user":{"login":"mattyclarkson","id":1081113,"avatar_url":"https://avatars.githubusercontent.com/u/1081113?v=3","gravatar_id":"","url":"https://api.github.com/users/mattyclarkson","html_url":"https://github.com/mattyclarkson","followers_url":"https://api.github.com/users/mattyclarkson/followers","following_url":"https://api.github.com/users/mattyclarkson/following{/other_user}","gists_url":"https://api.github.com/users/mattyclarkson/gists{/gist_id}","starred_url":"https://api.github.com/users/mattyclarkson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattyclarkson/subscriptions","organizations_url":"https://api.github.com/users/mattyclarkson/orgs","repos_url":"https://api.github.com/users/mattyclarkson/repos","events_url":"https://api.github.com/users/mattyclarkson/events{/privacy}","received_events_url":"https://api.github.com/users/mattyclarkson/received_events","type":"User","site_admin":false},"body":"I've implemented a branch that allows for `lcov` coverage of the code base. To enable just install `lcov` and `gcov` with your package manager and do:\r\n\r\n```\r\ncmake -DCMAKE_BUILD_TYPE=Coverage .\r\nmake coverage\r\n```\r\n\r\nIt'll create the coverage report in the `lcov` directory. Just run up a web server `python3 -m http.server` or `python2 -m SimpleHTTPServer` and go to `localhost:8000`.\r\n\r\nCurrent coverage is:\r\n\r\n| Directory         | Line Coverage  | Functions      |\r\n|:------------------|:---------------|:---------------|\r\n| include/benchmark | 84.1% 37/44    | 55.0 %  11/20  |\r\n| src               | 62.0% 738/1190 | 73.4 % 146/199 |\r\n| test              | 97.6% 242/248  | 95.2 %  60/63  |\r\n\r\nCoverage isn't everything, as long as you're testing the critical stuff - but it's nice to have the metric!\r\n\r\nAs part of the branch I've have done some other improvements to the build:\r\n * The C++ flag checker has got better at detecting flags that are required by the linker\r\n * Added link time optimisation if supported\r\n * Added sanitization checkers to debug builds\r\n * Updated the `.gitignore` to ignore the new unit tests\r\n * Allow the user to determine the C++ standard to build with","created_at":"2015-04-30T14:04:38Z","updated_at":"2015-05-01T17:30:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d7b83e81f8b23ac8a78fa37d0f75f8bc27f2034f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/google/benchmark/pulls/122/commits","review_comments_url":"https://api.github.com/repos/google/benchmark/pulls/122/comments","review_comment_url":"https://api.github.com/repos/google/benchmark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/benchmark/issues/122/comments","statuses_url":"https://api.github.com/repos/google/benchmark/statuses/7f37c9520b838aac13713556f7d87cc50689a557","head":{"label":"mattyclarkson:coverage","ref":"coverage","sha":"7f37c9520b838aac13713556f7d87cc50689a557","user":{"login":"mattyclarkson","id":1081113,"avatar_url":"https://avatars.githubusercontent.com/u/1081113?v=3","gravatar_id":"","url":"https://api.github.com/users/mattyclarkson","html_url":"https://github.com/mattyclarkson","followers_url":"https://api.github.com/users/mattyclarkson/followers","following_url":"https://api.github.com/users/mattyclarkson/following{/other_user}","gists_url":"https://api.github.com/users/mattyclarkson/gists{/gist_id}","starred_url":"https://api.github.com/users/mattyclarkson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattyclarkson/subscriptions","organizations_url":"https://api.github.com/users/mattyclarkson/orgs","repos_url":"https://api.github.com/users/mattyclarkson/repos","events_url":"https://api.github.com/users/mattyclarkson/events{/privacy}","received_events_url":"https://api.github.com/users/mattyclarkson/received_events","type":"User","site_admin":false},"repo":{"id":22434991,"name":"benchmark","full_name":"mattyclarkson/benchmark","owner":{"login":"mattyclarkson","id":1081113,"avatar_url":"https://avatars.githubusercontent.com/u/1081113?v=3","gravatar_id":"","url":"https://api.github.com/users/mattyclarkson","html_url":"https://github.com/mattyclarkson","followers_url":"https://api.github.com/users/mattyclarkson/followers","following_url":"https://api.github.com/users/mattyclarkson/following{/other_user}","gists_url":"https://api.github.com/users/mattyclarkson/gists{/gist_id}","starred_url":"https://api.github.com/users/mattyclarkson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattyclarkson/subscriptions","organizations_url":"https://api.github.com/users/mattyclarkson/orgs","repos_url":"https://api.github.com/users/mattyclarkson/repos","events_url":"https://api.github.com/users/mattyclarkson/events{/privacy}","received_events_url":"https://api.github.com/users/mattyclarkson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mattyclarkson/benchmark","description":"A microbenchmark support library","fork":true,"url":"https://api.github.com/repos/mattyclarkson/benchmark","forks_url":"https://api.github.com/repos/mattyclarkson/benchmark/forks","keys_url":"https://api.github.com/repos/mattyclarkson/benchmark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattyclarkson/benchmark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattyclarkson/benchmark/teams","hooks_url":"https://api.github.com/repos/mattyclarkson/benchmark/hooks","issue_events_url":"https://api.github.com/repos/mattyclarkson/benchmark/issues/events{/number}","events_url":"https://api.github.com/repos/mattyclarkson/benchmark/events","assignees_url":"https://api.github.com/repos/mattyclarkson/benchmark/assignees{/user}","branches_url":"https://api.github.com/repos/mattyclarkson/benchmark/branches{/branch}","tags_url":"https://api.github.com/repos/mattyclarkson/benchmark/tags","blobs_url":"https://api.github.com/repos/mattyclarkson/benchmark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattyclarkson/benchmark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattyclarkson/benchmark/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattyclarkson/benchmark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattyclarkson/benchmark/statuses/{sha}","languages_url":"https://api.github.com/repos/mattyclarkson/benchmark/languages","stargazers_url":"https://api.github.com/repos/mattyclarkson/benchmark/stargazers","contributors_url":"https://api.github.com/repos/mattyclarkson/benchmark/contributors","subscribers_url":"https://api.github.com/repos/mattyclarkson/benchmark/subscribers","subscription_url":"https://api.github.com/repos/mattyclarkson/benchmark/subscription","commits_url":"https://api.github.com/repos/mattyclarkson/benchmark/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattyclarkson/benchmark/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattyclarkson/benchmark/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattyclarkson/benchmark/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattyclarkson/benchmark/contents/{+path}","compare_url":"https://api.github.com/repos/mattyclarkson/benchmark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattyclarkson/benchmark/merges","archive_url":"https://api.github.com/repos/mattyclarkson/benchmark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattyclarkson/benchmark/downloads","issues_url":"https://api.github.com/repos/mattyclarkson/benchmark/issues{/number}","pulls_url":"https://api.github.com/repos/mattyclarkson/benchmark/pulls{/number}","milestones_url":"https://api.github.com/repos/mattyclarkson/benchmark/milestones{/number}","notifications_url":"https://api.github.com/repos/mattyclarkson/benchmark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattyclarkson/benchmark/labels{/name}","releases_url":"https://api.github.com/repos/mattyclarkson/benchmark/releases{/id}","created_at":"2014-07-30T16:05:29Z","updated_at":"2014-08-04T09:01:20Z","pushed_at":"2015-05-01T11:00:37Z","git_url":"git://github.com/mattyclarkson/benchmark.git","ssh_url":"git@github.com:mattyclarkson/benchmark.git","clone_url":"https://github.com/mattyclarkson/benchmark.git","svn_url":"https://github.com/mattyclarkson/benchmark","homepage":"","size":695,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"d51ba32791ac95437e209abfb651bc6d30c61b8b","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":15122806,"name":"benchmark","full_name":"google/benchmark","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/benchmark","description":"A microbenchmark support library","fork":false,"url":"https://api.github.com/repos/google/benchmark","forks_url":"https://api.github.com/repos/google/benchmark/forks","keys_url":"https://api.github.com/repos/google/benchmark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/benchmark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/benchmark/teams","hooks_url":"https://api.github.com/repos/google/benchmark/hooks","issue_events_url":"https://api.github.com/repos/google/benchmark/issues/events{/number}","events_url":"https://api.github.com/repos/google/benchmark/events","assignees_url":"https://api.github.com/repos/google/benchmark/assignees{/user}","branches_url":"https://api.github.com/repos/google/benchmark/branches{/branch}","tags_url":"https://api.github.com/repos/google/benchmark/tags","blobs_url":"https://api.github.com/repos/google/benchmark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/benchmark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/benchmark/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/benchmark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/benchmark/statuses/{sha}","languages_url":"https://api.github.com/repos/google/benchmark/languages","stargazers_url":"https://api.github.com/repos/google/benchmark/stargazers","contributors_url":"https://api.github.com/repos/google/benchmark/contributors","subscribers_url":"https://api.github.com/repos/google/benchmark/subscribers","subscription_url":"https://api.github.com/repos/google/benchmark/subscription","commits_url":"https://api.github.com/repos/google/benchmark/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/benchmark/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/benchmark/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/benchmark/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/benchmark/contents/{+path}","compare_url":"https://api.github.com/repos/google/benchmark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/benchmark/merges","archive_url":"https://api.github.com/repos/google/benchmark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/benchmark/downloads","issues_url":"https://api.github.com/repos/google/benchmark/issues{/number}","pulls_url":"https://api.github.com/repos/google/benchmark/pulls{/number}","milestones_url":"https://api.github.com/repos/google/benchmark/milestones{/number}","notifications_url":"https://api.github.com/repos/google/benchmark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/benchmark/labels{/name}","releases_url":"https://api.github.com/repos/google/benchmark/releases{/id}","created_at":"2013-12-12T00:10:48Z","updated_at":"2015-04-29T04:02:29Z","pushed_at":"2015-05-01T11:00:38Z","git_url":"git://github.com/google/benchmark.git","ssh_url":"git@github.com:google/benchmark.git","clone_url":"https://github.com/google/benchmark.git","svn_url":"https://github.com/google/benchmark","homepage":"","size":2374,"stargazers_count":348,"watchers_count":348,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":59,"mirror_url":null,"open_issues_count":6,"forks":59,"open_issues":6,"watchers":348,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/benchmark/pulls/122"},"html":{"href":"https://github.com/google/benchmark/pull/122"},"issue":{"href":"https://api.github.com/repos/google/benchmark/issues/122"},"comments":{"href":"https://api.github.com/repos/google/benchmark/issues/122/comments"},"review_comments":{"href":"https://api.github.com/repos/google/benchmark/pulls/122/comments"},"review_comment":{"href":"https://api.github.com/repos/google/benchmark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/benchmark/pulls/122/commits"},"statuses":{"href":"https://api.github.com/repos/google/benchmark/statuses/7f37c9520b838aac13713556f7d87cc50689a557"}}}}