[dpdk-dev,4/6] fix build error in app/test with gcc4.3

Message ID 1426735018-19411-7-git-send-email-yong.liu@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Marvin Liu March 19, 2015, 3:16 a.m. UTC
  From: Marvin Liu <yong.liu@intel.com>

Build app/test will be failed for function only defined but not used.
test_prefetch.c:65: error: ‘testfn_prefetch_cmd’ defined but not used

Add attribute used in test function declaration can fix this.
static void __attribute__((used)) testfn_##t(void);

Signed-off-by: Marvin Liu <yong.liu@intel.com>
  

Patch

diff --git a/app/test/test.h b/app/test/test.h
index 5450986..62eb51d 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -169,7 +169,7 @@  struct test_command {
 void add_test_command(struct test_command *t);
 
 #define REGISTER_TEST_COMMAND(t) \
-static void testfn_##t(void);\
+static void __attribute__((used)) testfn_##t(void);\
 void __attribute__((constructor, used)) testfn_##t(void)\
 {\
 	add_test_command(&t);\