Skip to contentSkip to conversation

A few more gcc4isms

DISCUSSION Paul Larson 2 participants 2 messages Apr 22, 2005

lore
Share & tools
lore
#0 lore raw

Here's a couple more gcc4 cleanups.

--- xen-unstable/xen/common/grant_table.c2005-04-21 22:14:31.000000000 -0500
+++ xen-unstable-fix/xen/common/grant_table.c2005-04-22 14:54:34.000000000 -0500@@ -437,7 +437,7 @@ gnttab_map_grant_ref(
gnttab_map_grant_ref_t *uop, unsigned int count)

 {
     int i, flush = 0;

- unsigned long va;
+ unsigned long va=0;

     for ( i = 0; i < count; i++ )
         if ( __gnttab_map_grant_ref(&uop[i], &va) == 0 )
@@ -633,7 +633,7 @@ gnttab_unmap_grant_ref(
     gnttab_unmap_grant_ref_t *uop, unsigned int count)
 {
     int i, flush = 0;

- unsigned long va;
+ unsigned long va=0;

     for ( i = 0; i < count; i++ )
         if ( __gnttab_unmap_grant_ref(&uop[i], &va) == 0 )
Signature · 4 lines
Thanks,
Paul Larson
[email protected]
IBM Linux Technology Center

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

#1 lore raw
Quoted 16 lines · Paul Larson

Here's a couple more gcc4 cleanups.

--- xen-unstable/xen/common/grant_table.c2005-04-21 22:14:31.000000000 -0500
+++ xen-unstable-fix/xen/common/grant_table.c2005-04-22 14:54:34.000000000 -0500@@ -437,7 +437,7 @@ gnttab_map_grant_ref(
gnttab_map_grant_ref_t *uop, unsigned int count)

 {
     int i, flush = 0;
(quoted diff) +1 -1
-    unsigned long va;
+    unsigned long va=0;
 
     for ( i = 0; i < count; i++ )
         if ( __gnttab_map_grant_ref(&uop[i], &va) == 0 )

Review gnttab_unmap_grant_ref(

Quoted 9 lines
(quoted diff) +1 -2
@@ -633,7 +633,7 @@ gnttab_unmap_grant_ref(
     gnttab_unmap_grant_ref_t *uop, unsigned int count)
 {
     int i, flush = 0;
-    unsigned long va;
+    unsigned long va=0;
 
     for ( i = 0; i < count; i++ )
         if ( __gnttab_unmap_grant_ref(&uop[i], &va) == 0 )
--

Actually, there's a window here for gcc to grow an extension.

An attribute on the second arg of gnttab_unmap_grant_ref, that says it doesn't read it, but instead writes a value to it, would allow for these unitialized warnings to not appear.