changeset fb895218046e in /z/repo/encumbered
details: http://repo.m5sim.org/encumbered?cmd=changeset;node=fb895218046e
summary: add a hack to ingore a return value even when gcc was told that we 
shouldn't

diffstat:

3 files changed, 6 insertions(+), 3 deletions(-)
eio/eio.cc    |    4 ++--
eio/exolex.cc |    2 +-
eio/libexo.h  |    3 +++

diffs (46 lines):

diff -r 3ef40471424f -r fb895218046e eio/eio.cc
--- a/eio/eio.cc        Wed Mar 11 09:15:25 2009 -0700
+++ b/eio/eio.cc        Fri Apr 17 11:49:34 2009 -0700
@@ -221,7 +221,7 @@
        return false;
 
     /* read and check EIO file header */
-    fgets(buf, 512, fd);
+    $ignore(fgets(buf, 512, fd));
 
     /* check the header */
     if (strcmp(buf, EIO_FILE_HEADER))
@@ -515,7 +515,7 @@
                int real_fd = sim_fd(tgt_fd);
 
                if (real_fd >= 0) {
-                   write(real_fd, blob->as_blob.data, blob->as_blob.size);
+                   $ignore(write(real_fd, blob->as_blob.data, 
blob->as_blob.size));
                }
            }
        }
diff -r 3ef40471424f -r fb895218046e eio/exolex.cc
--- a/eio/exolex.cc     Wed Mar 11 09:15:25 2009 -0700
+++ b/eio/exolex.cc     Fri Apr 17 11:49:34 2009 -0700
@@ -584,7 +584,7 @@
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO $ignore(fwrite( yytext, yyleng, 1, yyout ))
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff -r 3ef40471424f -r fb895218046e eio/libexo.h
--- a/eio/libexo.h      Wed Mar 11 09:15:25 2009 -0700
+++ b/eio/libexo.h      Fri Apr 17 11:49:34 2009 -0700
@@ -77,6 +77,9 @@
 #include "eio/alpha_exo.h"
 #include "sim/host.hh"
 
+// Gross hack to ignore a return value even with a gcc warning
+#define $ignore(X) do { if (X) {} } while(0)
+
 #ifdef __cplusplus
 extern "C" {
 #endif
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to