diff mbox

[PATCH/RFC] KVM: fix sparse warning in include/trace/events/kvm.h

Message ID 1421331679-38118-1-git-send-email-borntraeger@de.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christian Borntraeger Jan. 15, 2015, 2:21 p.m. UTC
sparse complains about
include/trace/events/kvm.h:163:1: error: directive in argument list
include/trace/events/kvm.h:167:1: error: directive in argument list
include/trace/events/kvm.h:169:1: error: directive in argument list
and sparse is right. Preprocessing directives in an argument of a
macro are undefined behaviour as of C99 6.10.3p11.

Lets use an indirection to fix this.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 include/trace/events/kvm.h | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Christian Borntraeger Jan. 19, 2015, 8:54 a.m. UTC | #1
Adding Alex and Marcelo CC as git blame gives them authorship to that piece of code.

Paolo, I assume that you will pick that up without a git tree if Alex/Marcelo ack that change.

Christian



Am 15.01.2015 um 15:21 schrieb Christian Borntraeger:
> sparse complains about
> include/trace/events/kvm.h:163:1: error: directive in argument list
> include/trace/events/kvm.h:167:1: error: directive in argument list
> include/trace/events/kvm.h:169:1: error: directive in argument list
> and sparse is right. Preprocessing directives in an argument of a
> macro are undefined behaviour as of C99 6.10.3p11.
> 
> Lets use an indirection to fix this.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  include/trace/events/kvm.h | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
> index 6edf1f2..86b399c 100644
> --- a/include/trace/events/kvm.h
> +++ b/include/trace/events/kvm.h
> @@ -146,6 +146,14 @@ TRACE_EVENT(kvm_msi_set_irq,
> 
>  #if defined(CONFIG_HAVE_KVM_IRQFD)
> 
> +#ifdef kvm_irqchips
> +#define kvm_ack_irq_string "irqchip %s pin %u"
> +#define kvm_ack_irq_parm  __print_symbolic(__entry->irqchip, kvm_irqchips), __entry->pin
> +#else
> +#define kvm_ack_irq_string "irqchip %d pin %u"
> +#define kvm_ack_irq_parm  __entry->irqchip, __entry->pin
> +#endif
> +
>  TRACE_EVENT(kvm_ack_irq,
>  	TP_PROTO(unsigned int irqchip, unsigned int pin),
>  	TP_ARGS(irqchip, pin),
> @@ -160,13 +168,7 @@ TRACE_EVENT(kvm_ack_irq,
>  		__entry->pin		= pin;
>  	),
> 
> -#ifdef kvm_irqchips
> -	TP_printk("irqchip %s pin %u",
> -		  __print_symbolic(__entry->irqchip, kvm_irqchips),
> -		 __entry->pin)
> -#else
> -	TP_printk("irqchip %d pin %u", __entry->irqchip, __entry->pin)
> -#endif
> +	TP_printk(kvm_ack_irq_string, kvm_ack_irq_parm)
>  );
> 
>  #endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
> 

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paolo Bonzini Jan. 19, 2015, 10:07 a.m. UTC | #2
On 15/01/2015 15:21, Christian Borntraeger wrote:
> sparse complains about
> include/trace/events/kvm.h:163:1: error: directive in argument list
> include/trace/events/kvm.h:167:1: error: directive in argument list
> include/trace/events/kvm.h:169:1: error: directive in argument list
> and sparse is right. Preprocessing directives in an argument of a
> macro are undefined behaviour as of C99 6.10.3p11.
> 
> Lets use an indirection to fix this.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

Applied to kvm/master, thanks.

Paolo
> ---
>  include/trace/events/kvm.h | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
> index 6edf1f2..86b399c 100644
> --- a/include/trace/events/kvm.h
> +++ b/include/trace/events/kvm.h
> @@ -146,6 +146,14 @@ TRACE_EVENT(kvm_msi_set_irq,
>  
>  #if defined(CONFIG_HAVE_KVM_IRQFD)
>  
> +#ifdef kvm_irqchips
> +#define kvm_ack_irq_string "irqchip %s pin %u"
> +#define kvm_ack_irq_parm  __print_symbolic(__entry->irqchip, kvm_irqchips), __entry->pin
> +#else
> +#define kvm_ack_irq_string "irqchip %d pin %u"
> +#define kvm_ack_irq_parm  __entry->irqchip, __entry->pin
> +#endif
> +
>  TRACE_EVENT(kvm_ack_irq,
>  	TP_PROTO(unsigned int irqchip, unsigned int pin),
>  	TP_ARGS(irqchip, pin),
> @@ -160,13 +168,7 @@ TRACE_EVENT(kvm_ack_irq,
>  		__entry->pin		= pin;
>  	),
>  
> -#ifdef kvm_irqchips
> -	TP_printk("irqchip %s pin %u",
> -		  __print_symbolic(__entry->irqchip, kvm_irqchips),
> -		 __entry->pin)
> -#else
> -	TP_printk("irqchip %d pin %u", __entry->irqchip, __entry->pin)
> -#endif
> +	TP_printk(kvm_ack_irq_string, kvm_ack_irq_parm)
>  );
>  
>  #endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcelo Tosatti Jan. 19, 2015, 2:46 p.m. UTC | #3
On Mon, Jan 19, 2015 at 09:54:53AM +0100, Christian Borntraeger wrote:
> Adding Alex and Marcelo CC as git blame gives them authorship to that piece of code.
> 
> Paolo, I assume that you will pick that up without a git tree if Alex/Marcelo ack that change.
> 
> Christian

Looks good to me.

> 
> 
> 
> Am 15.01.2015 um 15:21 schrieb Christian Borntraeger:
> > sparse complains about
> > include/trace/events/kvm.h:163:1: error: directive in argument list
> > include/trace/events/kvm.h:167:1: error: directive in argument list
> > include/trace/events/kvm.h:169:1: error: directive in argument list
> > and sparse is right. Preprocessing directives in an argument of a
> > macro are undefined behaviour as of C99 6.10.3p11.
> > 
> > Lets use an indirection to fix this.
> > 
> > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> > ---
> >  include/trace/events/kvm.h | 16 +++++++++-------
> >  1 file changed, 9 insertions(+), 7 deletions(-)
> > 
> > diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
> > index 6edf1f2..86b399c 100644
> > --- a/include/trace/events/kvm.h
> > +++ b/include/trace/events/kvm.h
> > @@ -146,6 +146,14 @@ TRACE_EVENT(kvm_msi_set_irq,
> > 
> >  #if defined(CONFIG_HAVE_KVM_IRQFD)
> > 
> > +#ifdef kvm_irqchips
> > +#define kvm_ack_irq_string "irqchip %s pin %u"
> > +#define kvm_ack_irq_parm  __print_symbolic(__entry->irqchip, kvm_irqchips), __entry->pin
> > +#else
> > +#define kvm_ack_irq_string "irqchip %d pin %u"
> > +#define kvm_ack_irq_parm  __entry->irqchip, __entry->pin
> > +#endif
> > +
> >  TRACE_EVENT(kvm_ack_irq,
> >  	TP_PROTO(unsigned int irqchip, unsigned int pin),
> >  	TP_ARGS(irqchip, pin),
> > @@ -160,13 +168,7 @@ TRACE_EVENT(kvm_ack_irq,
> >  		__entry->pin		= pin;
> >  	),
> > 
> > -#ifdef kvm_irqchips
> > -	TP_printk("irqchip %s pin %u",
> > -		  __print_symbolic(__entry->irqchip, kvm_irqchips),
> > -		 __entry->pin)
> > -#else
> > -	TP_printk("irqchip %d pin %u", __entry->irqchip, __entry->pin)
> > -#endif
> > +	TP_printk(kvm_ack_irq_string, kvm_ack_irq_parm)
> >  );
> > 
> >  #endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
> > 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 6edf1f2..86b399c 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -146,6 +146,14 @@  TRACE_EVENT(kvm_msi_set_irq,
 
 #if defined(CONFIG_HAVE_KVM_IRQFD)
 
+#ifdef kvm_irqchips
+#define kvm_ack_irq_string "irqchip %s pin %u"
+#define kvm_ack_irq_parm  __print_symbolic(__entry->irqchip, kvm_irqchips), __entry->pin
+#else
+#define kvm_ack_irq_string "irqchip %d pin %u"
+#define kvm_ack_irq_parm  __entry->irqchip, __entry->pin
+#endif
+
 TRACE_EVENT(kvm_ack_irq,
 	TP_PROTO(unsigned int irqchip, unsigned int pin),
 	TP_ARGS(irqchip, pin),
@@ -160,13 +168,7 @@  TRACE_EVENT(kvm_ack_irq,
 		__entry->pin		= pin;
 	),
 
-#ifdef kvm_irqchips
-	TP_printk("irqchip %s pin %u",
-		  __print_symbolic(__entry->irqchip, kvm_irqchips),
-		 __entry->pin)
-#else
-	TP_printk("irqchip %d pin %u", __entry->irqchip, __entry->pin)
-#endif
+	TP_printk(kvm_ack_irq_string, kvm_ack_irq_parm)
 );
 
 #endif /* defined(CONFIG_HAVE_KVM_IRQFD) */