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

[Xen-changelog] 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.



ChangeSet 1.1313, 2005/04/18 21:48:40+01:00, iap10@xxxxxxxxxxxxxxxxxxxxx

        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>
        



 iostream.h |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)


diff -Nru a/tools/libxutil/iostream.h b/tools/libxutil/iostream.h
--- a/tools/libxutil/iostream.h 2005-04-18 21:03:47 -04:00
+++ b/tools/libxutil/iostream.h 2005-04-18 21:03:47 -04:00
@@ -114,7 +114,7 @@
         result = -EINVAL;
         goto exit;
     }
-    result = stream->methods->read(stream, buf, n);
+    result = (stream->methods->read)(stream, buf, n);
     if(result > 0){
         stream->read += result;
     }
@@ -139,7 +139,7 @@
         result = -EINVAL;
         goto exit;
     }
-    result = stream->methods->write(stream, buf, n);
+    result = (stream->methods->write)(stream, buf, n);
     if(result > 0){
         stream->written += result;
     }
@@ -157,7 +157,7 @@
     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;
@@ -171,7 +171,7 @@
 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;
 }
@@ -184,7 +184,7 @@
 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);
         stream->closed = 1;
     }
     return err;
@@ -205,10 +205,10 @@
  */
 static inline void IOStream_free(IOStream *stream){
     if(!stream->closed && stream->methods && stream->methods->close){
-        stream->methods->close(stream);
+        (stream->methods->close)(stream);
     }
     if(stream->methods && stream->methods->free){
-        stream->methods->free(stream);
+        (stream->methods->free)(stream);
     }
     *stream = (IOStream){};
     deallocate(stream);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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