[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] -D_FORTIFY_SOURCE=2 fixup


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxxx
  • From: Rik van Riel <riel@xxxxxxxxxx>
  • Date: Wed, 9 Mar 2005 18:55:12 -0500 (EST)
  • Delivery-date: Wed, 09 Mar 2005 23:56:17 +0000
  • List-id: List for Xen developers <xen-devel.lists.sourceforge.net>

With -D_FORTIFY_SOURCE=2 (which is used in the Fedora buildroot),
gcc has certain defines for functions like read() to check that
things are done right.

This trips up these function pointers, and gcc becomes unhappy.
Adding parens around the function prevents gcc from expanding
read to the macro it is defined to internally, and makes things
compile again.

Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>

--- xen-unstable/tools/libxutil/iostream.h.gcc4 2005-03-09 18:23:48.000000000 
-0500
+++ xen-unstable/tools/libxutil/iostream.h      2005-03-09 18:25:28.000000000 
-0500
@@ -111,7 +111,7 @@ static inline int IOStream_read(IOStream
         result = -EINVAL;
         goto exit;
     }
-    result = stream->methods->read(stream, buf, n);
+    result = (stream->methods->read)(stream, buf, n);
     if(result > 0){
         stream->read += result;
     }
@@ -133,7 +133,7 @@ static inline int IOStream_write(IOStrea
         result = -EINVAL;
         goto exit;
     }
-    result = stream->methods->write(stream, buf, n);
+    result = (stream->methods->write)(stream, buf, n);
     if(result > 0){
         stream->written += result;
     }
@@ -151,7 +151,7 @@ static inline int IOStream_flush(IOStrea
     if(stream->closed){
         result = IOSTREAM_EOF;
     } else if(stream->methods->flush){
-        result = stream->methods->flush(stream);
+        result = (stream->methods->flush)(stream);
         if(result < 0) result = IOSTREAM_EOF;
     }
     return result;
@@ -165,7 +165,7 @@ static inline int IOStream_flush(IOStrea
 static inline int IOStream_error(IOStream *stream){
     int err = 0;
     if(stream->methods && stream->methods->error){
-       err = stream->methods->error(stream);
+       err = (stream->methods->error)(stream);
     }
     return err;
 }
@@ -178,7 +178,7 @@ static inline int IOStream_error(IOStrea
 static inline int IOStream_close(IOStream *stream){
     int err = 1;
     if(stream->methods && stream->methods->close){
-        err = stream->methods->close(stream);
+        err = (stream->methods->close)(stream);
     }
     return err;
 }
@@ -198,7 +198,7 @@ static inline int IOStream_is_closed(IOS
  */
 static inline void IOStream_free(IOStream *stream){
   if(stream->methods && stream->methods->free){
-    stream->methods->free(stream);
+    (stream->methods->free)(stream);
   }
   *stream = (IOStream){};
   deallocate(stream);


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.