[dpdk-dev,2/2] net/thunderx: fix unused function nicvf_mbox_msg_str error

Message ID 1467044166-31912-2-git-send-email-jerin.jacob@caviumnetworks.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Jerin Jacob June 27, 2016, 4:16 p.m. UTC
  Fix the following error with clang
	error: unused function 'nicvf_mbox_msg_str'

The nicvf_mbox_msg_str() maybe unused, based on DEBUG
compilation option selected. Mark __attribute__((unused)) on
this function, to inform compiler that this function may be unused

Fixes: e93592f1 ("net/thunderx/base: add mbox APIs for PF/VF communication")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/thunderx/base/nicvf_mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit June 28, 2016, 8:56 a.m. UTC | #1
On 6/27/2016 5:16 PM, Jerin Jacob wrote:
> Fix the following error with clang
> 	error: unused function 'nicvf_mbox_msg_str'
> 
> The nicvf_mbox_msg_str() maybe unused, based on DEBUG
> compilation option selected. Mark __attribute__((unused)) on
> this function, to inform compiler that this function may be unused
> 
> Fixes: e93592f1 ("net/thunderx/base: add mbox APIs for PF/VF communication")
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>

...

> -static inline const char *
> +static inline const char * __attribute__((unused))
it is possible to use __rte_unused macro here, although not required,
and moving it before return type can prevent checkpatch error


>  nicvf_mbox_msg_str(int msg)
>  {
>  	assert(msg >= 0 && msg < NIC_MBOX_MSG_MAX);
> 

Checkpatch gives following error:
ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
#39: FILE: drivers/net/thunderx/base/nicvf_mbox.c:67:
+static inline const char * __attribute__((unused))


check-git-log gives following errors:
Wrong headline format:
net/thunderx: fix unused function nicvf_mbox_msg_str error
  
Bruce Richardson June 29, 2016, 10:39 a.m. UTC | #2
On Tue, Jun 28, 2016 at 09:56:02AM +0100, Ferruh Yigit wrote:
> On 6/27/2016 5:16 PM, Jerin Jacob wrote:
> > Fix the following error with clang
> > 	error: unused function 'nicvf_mbox_msg_str'
> > 
> > The nicvf_mbox_msg_str() maybe unused, based on DEBUG
> > compilation option selected. Mark __attribute__((unused)) on
> > this function, to inform compiler that this function may be unused
> > 
> > Fixes: e93592f1 ("net/thunderx/base: add mbox APIs for PF/VF communication")
> > 
> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> ...
> 
> > -static inline const char *
> > +static inline const char * __attribute__((unused))
> it is possible to use __rte_unused macro here, although not required,
> and moving it before return type can prevent checkpatch error
> 
> 
> >  nicvf_mbox_msg_str(int msg)
> >  {
> >  	assert(msg >= 0 && msg < NIC_MBOX_MSG_MAX);
> > 
> 
> Checkpatch gives following error:
> ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
> #39: FILE: drivers/net/thunderx/base/nicvf_mbox.c:67:
> +static inline const char * __attribute__((unused))
> 
> 
> check-git-log gives following errors:
> Wrong headline format:
> net/thunderx: fix unused function nicvf_mbox_msg_str error

Thanks for flagging these Ferruh. I'll fix them on apply, no need for V2, unless
you particularly want to do one, Jerin. :-)

/Bruce
  
Bruce Richardson June 29, 2016, 10:43 a.m. UTC | #3
On Wed, Jun 29, 2016 at 11:39:51AM +0100, Bruce Richardson wrote:
> On Tue, Jun 28, 2016 at 09:56:02AM +0100, Ferruh Yigit wrote:
> > On 6/27/2016 5:16 PM, Jerin Jacob wrote:
> > > Fix the following error with clang
> > > 	error: unused function 'nicvf_mbox_msg_str'
> > > 
> > > The nicvf_mbox_msg_str() maybe unused, based on DEBUG
> > > compilation option selected. Mark __attribute__((unused)) on
> > > this function, to inform compiler that this function may be unused
> > > 
> > > Fixes: e93592f1 ("net/thunderx/base: add mbox APIs for PF/VF communication")
> > > 
> > > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > > Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
> > 
> > ...
> > 
> > > -static inline const char *
> > > +static inline const char * __attribute__((unused))
> > it is possible to use __rte_unused macro here, although not required,
> > and moving it before return type can prevent checkpatch error
> > 
> > 
> > >  nicvf_mbox_msg_str(int msg)
> > >  {
> > >  	assert(msg >= 0 && msg < NIC_MBOX_MSG_MAX);
> > > 
> > 
> > Checkpatch gives following error:
> > ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
> > #39: FILE: drivers/net/thunderx/base/nicvf_mbox.c:67:
> > +static inline const char * __attribute__((unused))
> > 
> > 
> > check-git-log gives following errors:
> > Wrong headline format:
> > net/thunderx: fix unused function nicvf_mbox_msg_str error
> 
> Thanks for flagging these Ferruh. I'll fix them on apply, no need for V2, unless
> you particularly want to do one, Jerin. :-)
> 
> /Bruce

Applied to dpdk-next-net/rel_16_07 with the check-git-log.sh issue fixed.
Checkpatch issue is ok to ignore.

/Bruce
  

Patch

diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c
index 3067331..9c5cd83 100644
--- a/drivers/net/thunderx/base/nicvf_mbox.c
+++ b/drivers/net/thunderx/base/nicvf_mbox.c
@@ -64,7 +64,7 @@  static const char *mbox_message[NIC_MBOX_MSG_MAX] =  {
 	[NIC_MBOX_MSG_SHUTDOWN]           = "NIC_MBOX_MSG_SHUTDOWN",
 };
 
-static inline const char *
+static inline const char * __attribute__((unused))
 nicvf_mbox_msg_str(int msg)
 {
 	assert(msg >= 0 && msg < NIC_MBOX_MSG_MAX);