Skip to contentSkip to conversation

remove the use of -Wno-unused-value

PATCH In review Jan Beulich 2 participants 2 messages Dec 12, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove the use of -Wno-unused-value

It has been hiding actual mistakes, and there are not too many changes necessary to make things build without suppressing this warning.

Config.mk +0 -4
@@ -157,10 +157,6 @@ CFLAGS += -std=gnu99
 
 CFLAGS += -Wall -Wstrict-prototypes
 
-# -Wunused-value makes GCC 4.x too aggressive for my taste: ignoring the
-# result of any casted expression causes a warning.
-CFLAGS += -Wno-unused-value
-
 # Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
 # and is over-zealous with the printf format lint
 CFLAGS-$(clang) += -Wno-parentheses -Wno-format
tools/libfsimage/common/fsimage_grub.h +1 -1
@@ -57,7 +57,7 @@ typedef struct fsig_plugin_ops {
 #define	disk_read_func (*fsig_disk_read_junk())
 #define	disk_read_hook (*fsig_disk_read_junk())
 #define	print_possibilities 0
-#define	noisy_printf
+#define	noisy_printf(fmt...)
 
 #define	grub_memset memset
 #define	grub_memmove memmove
xen/arch/x86/debug.c +2 -2
@@ -37,8 +37,8 @@
 #define DBGP1(...) {(kdbdbg>1) ? kdbp(__VA_ARGS__):0;}
 #define DBGP2(...) {(kdbdbg>2) ? kdbp(__VA_ARGS__):0;}
 #else
-#define DBGP1(...) {0;}
-#define DBGP2(...) {0;}
+#define DBGP1(...) ((void)0)
+#define DBGP2(...) ((void)0)
 #endif
 
 /* Returns: mfn for the given (hvm guest) vaddr */
xen/arch/x86/hvm/svm/vpmu.c +1 -1
@@ -154,7 +154,7 @@ static int amd_vpmu_do_interrupt(struct 
     if ( GET_APIC_DELIVERY_MODE(vlapic_lvtpc) == APIC_MODE_FIXED )
         vlapic_set_irq(vcpu_vlapic(v), int_vec, 0);
     else
-        test_and_set_bool(v->nmi_pending);
+        v->nmi_pending = 1;
 
     return 1;
 }
xen/arch/x86/hvm/vmx/vpmu_core2.c +1 -1
@@ -574,7 +574,7 @@ static int core2_vpmu_do_interrupt(struc
     if ( GET_APIC_DELIVERY_MODE(vlapic_lvtpc) == APIC_MODE_FIXED )
         vlapic_set_irq(vcpu_vlapic(v), int_vec, 0);
     else
-        test_and_set_bool(v->nmi_pending);
+        v->nmi_pending = 1;
     return 1;
 }
 
xen/arch/x86/oprofile/nmi_int.c +1 -1
@@ -92,7 +92,7 @@ static int nmi_callback(struct cpu_user_
 		send_guest_vcpu_virq(current, VIRQ_XENOPROF);
 
 	if ( ovf == 2 ) 
-                test_and_set_bool(current->nmi_pending);
+                current->nmi_pending = 1;
 	return 1;
 }
  
xen/include/asm-x86/debugger.h +6 -1
@@ -55,7 +55,12 @@ static inline int debugger_trap_fatal(
 
 #else
 
-#define debugger_trap_fatal(v, r) (0)
+static inline int debugger_trap_fatal(
+    unsigned int vector, struct cpu_user_regs *regs)
+{
+    return 0;
+}
+
 #define debugger_trap_immediate() ((void)0)
 
 #endif
xen/include/asm-x86/hvm/hvm.h +1 -1
@@ -235,7 +235,7 @@ int hvm_girq_dest_2_vcpu_id(struct domai
 #define hvm_long_mode_enabled(v) \
     ((v)->arch.hvm_vcpu.guest_efer & EFER_LMA)
 #else
-#define hvm_long_mode_enabled(v) (v,0)
+#define hvm_long_mode_enabled(v) ((void)(v),0)
 #endif
 
 enum hvm_intblk
xen/include/xen/tmem_xen.h +3 -3
@@ -365,7 +365,7 @@ static inline int tmh_page_cmp(pfp_t *pf
     // FIXME: code in assembly?
 ASSERT(p1 != NULL);
 ASSERT(p2 != NULL);
-    for ( i = PAGE_SIZE/sizeof(uint64_t); i && *p1 == *p2; i--, *p1++, *p2++ );
+    for ( i = PAGE_SIZE/sizeof(uint64_t); i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
@@ -386,7 +386,7 @@ static inline int tmh_pcd_cmp(void *va1,
     if ( len1 > len2 )
         return 1;
     ASSERT(len1 == len2);
-    for ( i = len2; i && *p1 == *p2; i--, *p1++, *p2++ );
+    for ( i = len2; i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
@@ -413,7 +413,7 @@ static inline int tmh_tze_pfp_cmp(pfp_t 
     if ( pfp_len > tze_len )
         return 1;
     ASSERT(pfp_len == tze_len);
-    for ( i = tze_len/sizeof(uint64_t); i && *p1 == *p2; i--, *p1++, *p2++ );
+    for ( i = tze_len/sizeof(uint64_t); i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
xen/include/xsm/xsm.h +4 -4
@@ -163,7 +163,7 @@ extern struct xsm_operations *xsm_ops;
 static inline void xsm_security_domaininfo (struct domain *d,
                                         struct xen_domctl_getdomaininfo *info)
 {
-    xsm_call(security_domaininfo(d, info));
+    (void)xsm_call(security_domaininfo(d, info));
 }
 
 static inline int xsm_setvcpucontext(struct domain *d)
@@ -310,7 +310,7 @@ static inline int xsm_evtchn_interdomain
 
 static inline void xsm_evtchn_close_post (struct evtchn *chn)
 {
-    xsm_call(evtchn_close_post(chn));
+    (void)xsm_call(evtchn_close_post(chn));
 }
 
 static inline int xsm_evtchn_send (struct domain *d, struct evtchn *chn)
@@ -366,7 +366,7 @@ static inline int xsm_alloc_security_dom
 
 static inline void xsm_free_security_domain (struct domain *d)
 {
-    xsm_call(free_security_domain(d));
+    (void)xsm_call(free_security_domain(d));
 }
 
 static inline int xsm_alloc_security_evtchn (struct evtchn *chn)
@@ -376,7 +376,7 @@ static inline int xsm_alloc_security_evt
 
 static inline void xsm_free_security_evtchn (struct evtchn *chn)
 {
-    xsm_call(free_security_evtchn(chn));
+    (void)xsm_call(free_security_evtchn(chn));
 }
 
 static inline int xsm_memory_adjust_reservation (struct domain *d1, struct

remove the use of -Wno-unused-value

It has been hiding actual mistakes, and there are not too many changes necessary to make things build without suppressing this warning.

Config.mk +0 -4
@@ -157,10 +157,6 @@ CFLAGS += -std=gnu99
 
 CFLAGS += -Wall -Wstrict-prototypes
 
-# -Wunused-value makes GCC 4.x too aggressive for my taste: ignoring the
-# result of any casted expression causes a warning.
-CFLAGS += -Wno-unused-value
-
 # Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
 # and is over-zealous with the printf format lint
 CFLAGS-$(clang) += -Wno-parentheses -Wno-format
tools/libfsimage/common/fsimage_grub.h +1 -1
@@ -57,7 +57,7 @@ typedef struct fsig_plugin_ops {
 #define	disk_read_func (*fsig_disk_read_junk())
 #define	disk_read_hook (*fsig_disk_read_junk())
 #define	print_possibilities 0
-#define	noisy_printf
+#define	noisy_printf(fmt...)
 
 #define	grub_memset memset
 #define	grub_memmove memmove
xen/arch/x86/debug.c +2 -2
@@ -37,8 +37,8 @@
 #define DBGP1(...) {(kdbdbg>1) ? kdbp(__VA_ARGS__):0;}
 #define DBGP2(...) {(kdbdbg>2) ? kdbp(__VA_ARGS__):0;}
 #else
-#define DBGP1(...) {0;}
-#define DBGP2(...) {0;}
+#define DBGP1(...) ((void)0)
+#define DBGP2(...) ((void)0)
 #endif
 
 /* Returns: mfn for the given (hvm guest) vaddr */
xen/arch/x86/hvm/svm/vpmu.c +1 -1
@@ -154,7 +154,7 @@ static int amd_vpmu_do_interrupt(struct 
     if ( GET_APIC_DELIVERY_MODE(vlapic_lvtpc) == APIC_MODE_FIXED )
         vlapic_set_irq(vcpu_vlapic(v), int_vec, 0);
     else
-        test_and_set_bool(v->nmi_pending);
+        v->nmi_pending = 1;
 
     return 1;
 }
xen/arch/x86/hvm/vmx/vpmu_core2.c +1 -1
@@ -574,7 +574,7 @@ static int core2_vpmu_do_interrupt(struc
     if ( GET_APIC_DELIVERY_MODE(vlapic_lvtpc) == APIC_MODE_FIXED )
         vlapic_set_irq(vcpu_vlapic(v), int_vec, 0);
     else
-        test_and_set_bool(v->nmi_pending);
+        v->nmi_pending = 1;
     return 1;
 }
 
xen/arch/x86/oprofile/nmi_int.c +1 -1
@@ -92,7 +92,7 @@ static int nmi_callback(struct cpu_user_
 		send_guest_vcpu_virq(current, VIRQ_XENOPROF);
 
 	if ( ovf == 2 ) 
-                test_and_set_bool(current->nmi_pending);
+                current->nmi_pending = 1;
 	return 1;
 }
  
xen/include/asm-x86/debugger.h +6 -1
@@ -55,7 +55,12 @@ static inline int debugger_trap_fatal(
 
 #else
 
-#define debugger_trap_fatal(v, r) (0)
+static inline int debugger_trap_fatal(
+    unsigned int vector, struct cpu_user_regs *regs)
+{
+    return 0;
+}
+
 #define debugger_trap_immediate() ((void)0)
 
 #endif
xen/include/asm-x86/hvm/hvm.h +1 -1
@@ -235,7 +235,7 @@ int hvm_girq_dest_2_vcpu_id(struct domai
 #define hvm_long_mode_enabled(v) \
     ((v)->arch.hvm_vcpu.guest_efer & EFER_LMA)
 #else
-#define hvm_long_mode_enabled(v) (v,0)
+#define hvm_long_mode_enabled(v) ((void)(v),0)
 #endif
 
 enum hvm_intblk
xen/include/xen/tmem_xen.h +3 -3
@@ -365,7 +365,7 @@ static inline int tmh_page_cmp(pfp_t *pf
     // FIXME: code in assembly?
 ASSERT(p1 != NULL);
 ASSERT(p2 != NULL);
-    for ( i = PAGE_SIZE/sizeof(uint64_t); i && *p1 == *p2; i--, *p1++, *p2++ );
+    for ( i = PAGE_SIZE/sizeof(uint64_t); i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
@@ -386,7 +386,7 @@ static inline int tmh_pcd_cmp(void *va1,
     if ( len1 > len2 )
         return 1;
     ASSERT(len1 == len2);
-    for ( i = len2; i && *p1 == *p2; i--, *p1++, *p2++ );
+    for ( i = len2; i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
@@ -413,7 +413,7 @@ static inline int tmh_tze_pfp_cmp(pfp_t 
     if ( pfp_len > tze_len )
         return 1;
     ASSERT(pfp_len == tze_len);
-    for ( i = tze_len/sizeof(uint64_t); i && *p1 == *p2; i--, *p1++, *p2++ );
+    for ( i = tze_len/sizeof(uint64_t); i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
xen/include/xsm/xsm.h +4 -4
@@ -163,7 +163,7 @@ extern struct xsm_operations *xsm_ops;
 static inline void xsm_security_domaininfo (struct domain *d,
                                         struct xen_domctl_getdomaininfo *info)
 {
-    xsm_call(security_domaininfo(d, info));
+    (void)xsm_call(security_domaininfo(d, info));
 }
 
 static inline int xsm_setvcpucontext(struct domain *d)
@@ -310,7 +310,7 @@ static inline int xsm_evtchn_interdomain
 
 static inline void xsm_evtchn_close_post (struct evtchn *chn)
 {
-    xsm_call(evtchn_close_post(chn));
+    (void)xsm_call(evtchn_close_post(chn));
 }
 
 static inline int xsm_evtchn_send (struct domain *d, struct evtchn *chn)
@@ -366,7 +366,7 @@ static inline int xsm_alloc_security_dom
 
 static inline void xsm_free_security_domain (struct domain *d)
 {
-    xsm_call(free_security_domain(d));
+    (void)xsm_call(free_security_domain(d));
 }
 
 static inline int xsm_alloc_security_evtchn (struct evtchn *chn)
@@ -376,7 +376,7 @@ static inline int xsm_alloc_security_evt
 
 static inline void xsm_free_security_evtchn (struct evtchn *chn)
 {
-    xsm_call(free_security_evtchn(chn));
+    (void)xsm_call(free_security_evtchn(chn));
 }
 
 static inline int xsm_memory_adjust_reservation (struct domain *d1, struct

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jan Beulich

It has been hiding actual mistakes, and there are not too many changes necessary to make things build without suppressing this warning.

Quoted 184 lines
Config.mk 2011-11-30 17:49:42.000000000 +0100 renamed from Config.mk 2011-12-12 15:46:14.000000000 +0100 +0 -5
@@ -157,10 +157,6 @@ CFLAGS += -std=gnu99
 
 CFLAGS += -Wall -Wstrict-prototypes
 
-# -Wunused-value makes GCC 4.x too aggressive for my taste: ignoring the
-# result of any casted expression causes a warning.
-CFLAGS += -Wno-unused-value
-
 # Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
 # and is over-zealous with the printf format lint
 CFLAGS-$(clang) += -Wno-parentheses -Wno-format
--- 2011-12-12.orig/tools/libfsimage/common/fsimage_grub.h 2010-04-19

09:12:58.000000000 +0200
+++ 2011-12-12/tools/libfsimage/common/fsimage_grub.h 2011-12-12 15:47:35.000000000 +0100

Config.mk 2011-11-30 17:49:42.000000000 +0100 renamed from Config.mk 2011-12-12 15:46:14.000000000 +0100 +1 -1
@@ -57,7 +57,7 @@ typedef struct fsig_plugin_ops {
 #define disk_read_func (*fsig_disk_read_junk())
 #define disk_read_hook (*fsig_disk_read_junk())
 #define print_possibilities 0
-#define noisy_printf
+#define noisy_printf(fmt...)
 
 #define grub_memset memset
 #define grub_memmove memmove
xen/arch/x86/debug.c 2011-11-30 17:50:55.000000000 +0100 renamed from xen/arch/x86/debug.c 2011-12-12 15:46:14.000000000 +0100 +5 -5
@@ -37,8 +37,8 @@
 #define DBGP1(...) {(kdbdbg>1) ? kdbp(__VA_ARGS__):0;}
 #define DBGP2(...) {(kdbdbg>2) ? kdbp(__VA_ARGS__):0;}
 #else
-#define DBGP1(...) {0;}
-#define DBGP2(...) {0;}
+#define DBGP1(...) ((void)0)
+#define DBGP2(...) ((void)0)
 #endif
 
 /* Returns: mfn for the given (hvm guest) vaddr */
--- 2011-12-12.orig/xen/arch/x86/hvm/svm/vpmu.c 2011-12-12 15:46:14.000000000
+0100
+++ 2011-12-12/xen/arch/x86/hvm/svm/vpmu.c 2011-12-01 11:35:58.000000000 +0100
@@ -154,7 +154,7 @@ static int amd_vpmu_do_interrupt(struct
     if ( GET_APIC_DELIVERY_MODE(vlapic_lvtpc) == APIC_MODE_FIXED )
         vlapic_set_irq(vcpu_vlapic(v), int_vec, 0);
     else
-        test_and_set_bool(v->nmi_pending);
+        v->nmi_pending = 1;
 
     return 1;
 }
--- 2011-12-12.orig/xen/arch/x86/hvm/vmx/vpmu_core2.c 2011-12-12

15:46:14.000000000 +0100
+++ 2011-12-12/xen/arch/x86/hvm/vmx/vpmu_core2.c 2011-12-01 11:36:37.000000000 +0100

xen/arch/x86/debug.c 2011-11-30 17:50:55.000000000 +0100 renamed from xen/arch/x86/debug.c 2011-12-12 15:46:14.000000000 +0100 +1 -2
@@ -574,7 +574,7 @@ static int core2_vpmu_do_interrupt(struc
     if ( GET_APIC_DELIVERY_MODE(vlapic_lvtpc) == APIC_MODE_FIXED )
         vlapic_set_irq(vcpu_vlapic(v), int_vec, 0);
     else
-        test_and_set_bool(v->nmi_pending);
+        v->nmi_pending = 1;
     return 1;
 }
 
--- 2011-12-12.orig/xen/arch/x86/oprofile/nmi_int.c 2011-12-12

15:46:14.000000000 +0100
+++ 2011-12-12/xen/arch/x86/oprofile/nmi_int.c 2011-11-30 18:01:11.000000000 +0100

xen/arch/x86/debug.c 2011-11-30 17:50:55.000000000 +0100 renamed from xen/arch/x86/debug.c 2011-12-12 15:46:14.000000000 +0100 +1 -2
@@ -92,7 +92,7 @@ static int nmi_callback(struct cpu_user_
 send_guest_vcpu_virq(current, VIRQ_XENOPROF);
 
 if ( ovf == 2 ) 
-                test_and_set_bool(current->nmi_pending);
+                current->nmi_pending = 1;
 return 1;
 }
 
--- 2011-12-12.orig/xen/include/asm-x86/debugger.h 2011-12-12

15:46:14.000000000 +0100
+++ 2011-12-12/xen/include/asm-x86/debugger.h 2011-11-30 17:58:20.000000000 +0100

xen/arch/x86/debug.c 2011-11-30 17:50:55.000000000 +0100 renamed from xen/arch/x86/debug.c 2011-12-12 15:46:14.000000000 +0100 +6 -2
@@ -55,7 +55,12 @@ static inline int debugger_trap_fatal(
 
 #else
 
-#define debugger_trap_fatal(v, r) (0)
+static inline int debugger_trap_fatal(
+    unsigned int vector, struct cpu_user_regs *regs)
+{
+    return 0;
+}
+
 #define debugger_trap_immediate() ((void)0)
 
 #endif
--- 2011-12-12.orig/xen/include/asm-x86/hvm/hvm.h 2011-12-12

15:46:14.000000000 +0100
+++ 2011-12-12/xen/include/asm-x86/hvm/hvm.h 2011-12-01 12:15:02.000000000 +0100

xen/arch/x86/debug.c 2011-11-30 17:50:55.000000000 +0100 renamed from xen/arch/x86/debug.c 2011-12-12 15:46:14.000000000 +0100 +4 -3
@@ -235,7 +235,7 @@ int hvm_girq_dest_2_vcpu_id(struct domai
 #define hvm_long_mode_enabled(v) \
     ((v)->arch.hvm_vcpu.guest_efer & EFER_LMA)
 #else
-#define hvm_long_mode_enabled(v) (v,0)
+#define hvm_long_mode_enabled(v) ((void)(v),0)
 #endif
 
 enum hvm_intblk
--- 2011-12-12.orig/xen/include/xen/tmem_xen.h 2011-12-12 15:46:14.000000000
+0100
+++ 2011-12-12/xen/include/xen/tmem_xen.h 2011-11-30 17:55:22.000000000 +0100
@@ -365,7 +365,7 @@ static inline int tmh_page_cmp(pfp_t *pf
     // FIXME: code in assembly?
 ASSERT(p1 != NULL);
 ASSERT(p2 != NULL);
-    for ( i = PAGE_SIZE/sizeof(uint64_t); i && *p1 == *p2; i--, *p1++, *p2++
 );
+    for ( i = PAGE_SIZE/sizeof(uint64_t); i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
xen/arch/x86/debug.c 2011-11-30 17:50:55.000000000 +0100 renamed from xen/arch/x86/debug.c 2011-12-12 15:46:14.000000000 +0100 +2 -2
@@ -386,7 +386,7 @@ static inline int tmh_pcd_cmp(void *va1,
     if ( len1 > len2 )
         return 1;
     ASSERT(len1 == len2);
-    for ( i = len2; i && *p1 == *p2; i--, *p1++, *p2++ );
+    for ( i = len2; i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
@@ -413,7 +413,7 @@ static inline int tmh_tze_pfp_cmp(pfp_t
     if ( pfp_len > tze_len )
         return 1;
     ASSERT(pfp_len == tze_len);
-    for ( i = tze_len/sizeof(uint64_t); i && *p1 == *p2; i--, *p1++, *p2++ );
+    for ( i = tze_len/sizeof(uint64_t); i && *p1 == *p2; i--, p1++, p2++ );
     if ( !i )
         return 0;
     if ( *p1 < *p2 )
xen/include/xsm/xsm.h 2011-12-12 15:23:49.000000000 +0100 renamed from xen/include/xsm/xsm.h 2011-12-12 15:46:14.000000000 +0100 +1 -1
@@ -163,7 +163,7 @@ extern struct xsm_operations *xsm_ops;
 static inline void xsm_security_domaininfo (struct domain *d,
                                         struct xen_domctl_getdomaininfo
 *info)
 {
-    xsm_call(security_domaininfo(d, info));
+    (void)xsm_call(security_domaininfo(d, info));
 }
 

static inline int xsm_setvcpucontext(struct domain *d)

xen/include/xsm/xsm.h 2011-12-12 15:23:49.000000000 +0100 renamed from xen/include/xsm/xsm.h 2011-12-12 15:46:14.000000000 +0100 +3 -3
@@ -310,7 +310,7 @@ static inline int xsm_evtchn_interdomain
 
 static inline void xsm_evtchn_close_post (struct evtchn *chn)
 {
-    xsm_call(evtchn_close_post(chn));
+    (void)xsm_call(evtchn_close_post(chn));
 }
 
 static inline int xsm_evtchn_send (struct domain *d, struct evtchn *chn)
@@ -366,7 +366,7 @@ static inline int xsm_alloc_security_dom
 
 static inline void xsm_free_security_domain (struct domain *d)
 {
-    xsm_call(free_security_domain(d));
+    (void)xsm_call(free_security_domain(d));
 }
 
 static inline int xsm_alloc_security_evtchn (struct evtchn *chn)
@@ -376,7 +376,7 @@ static inline int xsm_alloc_security_evt
 
 static inline void xsm_free_security_evtchn (struct evtchn *chn)
 {
-    xsm_call(free_security_evtchn(chn));
+    (void)xsm_call(free_security_evtchn(chn));
 }
 
 static inline int xsm_memory_adjust_reservation (struct domain *d1, struct

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel