From b6a11e351ab2799aae884d69a2c20f8e6623fbf9 Mon Sep 17 00:00:00 2001 From: Stephan Dollberg Date: Fri, 4 Oct 2024 12:59:27 +0100 Subject: [PATCH] Always define rd_ut_coverage_check Define `rd_ut_coverage_check` even in non-devel mode as the `lds-gen.py` script adds the symbol unconditionally. Otherwise LLD complains about ld: ``` error: version script assignment of 'global' to symbol 'rd_ut_coverage_check' failed: symbol not defined ``` Fixes https://github.com/confluentinc/librdkafka/issues/4593 --- src/rdunittest.c | 11 +++++++++++ src/rdunittest.h | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/rdunittest.c b/src/rdunittest.c index fc82c242cd..daa2f8dab3 100644 --- a/src/rdunittest.c +++ b/src/rdunittest.c @@ -104,6 +104,17 @@ rd_ut_coverage_check(const char *file, const char *func, int line, int covnr) { } /**@}*/ +#else + +void rd_ut_coverage(const char * /* file */, const char * /* func */, int /* line */, int /* covnr */) { +} + + +int64_t +rd_ut_coverage_check(const char * /* file */, const char * /* func */, int /* line */, int /* covnr */) { + return 1; +} + #endif /* ENABLE_CODECOV */ diff --git a/src/rdunittest.h b/src/rdunittest.h index a9e709fa73..10d01383a2 100644 --- a/src/rdunittest.h +++ b/src/rdunittest.h @@ -188,6 +188,10 @@ int rd_unittest(void); * @{ */ +void rd_ut_coverage(const char *file, const char *func, int line, int covnr); +int64_t +rd_ut_coverage_check(const char *file, const char *func, int line, int covnr); + #if ENABLE_CODECOV /* @define When adding new code coverages, use the next value and increment @@ -209,10 +213,6 @@ int rd_unittest(void); rd_ut_coverage_check(__FILE__, __FUNCTION__, __LINE__, COVNR) -void rd_ut_coverage(const char *file, const char *func, int line, int covnr); -int64_t -rd_ut_coverage_check(const char *file, const char *func, int line, int covnr); - #else /* Does nothing if ENABLE_CODECOV is not set */