From 5ce1e001d2e672cb547bd318e49a8df429a3a2f1 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Tue, 9 Apr 2019 19:59:02 +0000 Subject: [PATCH] Squashed 'third_party/nlbuild-autotools/repo/' changes from 75faaf5f..d4c1c470 d4c1c470 Merge pull request #18 from bukepo/code-coverage/fix-for-clang 21fb7d7b bump version and update changes 271abad7 Add code coverage for clang 3597c61e Merge pull request #17 from nestlabs/bug/fix-repos-remake-issue git-subtree-dir: third_party/nlbuild-autotools/repo git-subtree-split: d4c1c47033060e6f6bbd6b9203e2d1ed26107979 --- .default-version | 2 +- CHANGES | 6 ++++++ autoconf/m4/nl_enable_coverage.m4 | 16 +++++++++------- examples/configure.ac | 9 +++++---- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.default-version b/.default-version index 9f05f9f2c..ec70f7556 100644 --- a/.default-version +++ b/.default-version @@ -1 +1 @@ -1.6.5 +1.6.6 diff --git a/CHANGES b/CHANGES index 516c8f187..6bd89216f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +1.6.6 (2019-04-09) + + * Added code coverage support for clang, which uses a link flag + --coverage instead of linking to a library(-lgov) as gcc does + for code coverage functions. + 1.6.5 (2018-11-19) * Addressed an issue in which the failure to make the 'repos-warning' diff --git a/autoconf/m4/nl_enable_coverage.m4 b/autoconf/m4/nl_enable_coverage.m4 index b60c4bb0d..7a62a5359 100644 --- a/autoconf/m4/nl_enable_coverage.m4 +++ b/autoconf/m4/nl_enable_coverage.m4 @@ -58,7 +58,7 @@ AC_DEFUN([NL_ENABLE_COVERAGE], AC_ARG_ENABLE(coverage, [AS_HELP_STRING([--enable-coverage],[Enable the generation of code-coverage instances @<:@default=$1@:>@.])], [ - case "${enableval}" in + case "${enableval}" in no|yes) nl_cv_build_coverage=${enableval} @@ -78,21 +78,23 @@ AC_DEFUN([NL_ENABLE_COVERAGE], if test "${nl_cv_build_optimized}" = "yes"; then AC_MSG_WARN([--enable-optimization was specified, coverage disabled]) nl_cv_build_coverage=no - + else nl_cv_build_coverage=$1 - + fi ]) - if test "${nl_cv_build_coverage}" = "yes"; then + if test "${nl_cv_build_coverage}" = "yes"; then if test "${GCC}" != "yes"; then AC_MSG_ERROR([GCC or a GCC-compatible toolchain is required for --enable-coverage]) - else NL_COVERAGE_CPPFLAGS="--coverage" - NL_COVERAGE_LIBS="-lgcov" - + if ${CC} --version | grep -q clang; then + NL_COVERAGE_LDFLAGS="--coverage" + else + NL_COVERAGE_LIBS="-lgcov" + fi fi fi ]) diff --git a/examples/configure.ac b/examples/configure.ac index 02bc83d96..4de427008 100644 --- a/examples/configure.ac +++ b/examples/configure.ac @@ -292,14 +292,14 @@ AC_PATH_PROG([PKG_CONFIG],[pkg-config]) # # configured nor built, so the normal checks we undertake for an # # external package cannot be run here. Simply set the appropriate # # variables and trust all will be well. -# +# # NLUNIT_TEST_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlunit-test/repo/src" # NLUNIT_TEST_LDFLAGS="-L${ac_pwd}/third_party/nlunit-test/repo/src" # NLUNIT_TEST_LIBS="-lnlunit-test" # ], # [ # # Check for required nlunit-test headers. -# +# # AC_CHECK_HEADERS([nlunit-test.h], # [], # [ @@ -312,7 +312,7 @@ AC_PATH_PROG([PKG_CONFIG],[pkg-config]) # # location, its directory stem within this package needs to be set # # accordingly. In addition, if the location is internal, then we need # # to attempt to pull it down using the bootstrap makefile. -# +# # if test "${nl_with_nlunit_test}" = "internal"; then # maybe_nlunit_test_dirstem="nlunit-test/repo" # nlunit_test_dirstem="third_party/${maybe_nlunit_test_dirstem}" @@ -364,7 +364,7 @@ fi # this, as needed. # # Add any nlunit-test CPPFLAGS, LDFLAGS, and LIBS -# +# # CPPFLAGS="${CPPFLAGS} ${NLUNIT_TEST_CPPFLAGS}" # LDFLAGS="${LDFLAGS} ${NLUNIT_TEST_LDFLAGS}" # LIBS="${LIBS} ${NLUNIT_TEST_LIBS}" @@ -373,6 +373,7 @@ fi CPPFLAGS="${CPPFLAGS} ${NL_COVERAGE_CPPFLAGS}" LIBS="${LIBS} ${NL_COVERAGE_LIBS}" +LDFLAGS="${LDFLAGS} ${NL_COVERAGE_LDFLAGS}" # At this point, we can restore the compiler flags to whatever the # user passed in, now that we're clear of any -Werror issues by