[Pdbg] [PATCH 1/6] libpdbg: Fix clang warning -Wunused-function

Amitay Isaacs amitay at ozlabs.org
Wed Jun 19 13:15:45 AEST 2019


The *_check() functions are never going to be called.

../../libpdbg/adu.c:583:1: error: unused function 'p8_adu_hw_unit_check' [-Werror,-Wunused-function]
DECLARE_HW_UNIT(p8_adu);
^
../../libpdbg/hwunit.h:43:21: note: expanded from macro 'DECLARE_HW_UNIT'
        static inline void name ##_hw_unit_check(void) {                \

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/hwunit.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h
index 117e622..b816ae3 100644
--- a/libpdbg/hwunit.h
+++ b/libpdbg/hwunit.h
@@ -40,7 +40,7 @@ const struct hw_unit_info *pdbg_hwunit_find_compatible(const char *compat);
  * container struct. Not doing so will break other assumptions.
  */
 #define DECLARE_HW_UNIT(name)						\
-	static inline void name ##_hw_unit_check(void) {		\
+	__attribute__((unused)) static inline void name ##_hw_unit_check(void) {	\
 		((void)sizeof(char[1 - 2 * (container_off(typeof(name), target) != 0)])); \
 	}								\
 	const struct hw_unit_info __used name ##_hw_unit =              \
-- 
2.21.0



More information about the Pdbg mailing list