WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] -D_FORTIFY_SOURCE=2 fixup
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
Envelope-to: xen+James.Bulpin@xxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Sender: xen-devel-admin@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>

--- 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] -D_FORTIFY_SOURCE=2 fixup, Rik van Riel <=