[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Make GCC very happy, even with lots of warnings set. Also, ...



Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv16419/src/common

Modified Files:
	compat.h log.c test.h util.c 
Log Message:
Make GCC very happy, even with lots of warnings set. Also, try to fix some reported Solaris x86 warnings.

Index: compat.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- compat.h	23 Jul 2005 02:19:43 -0000	1.33
+++ compat.h	12 Aug 2005 17:24:53 -0000	1.34
@@ -26,6 +26,9 @@
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
 #include <stdarg.h>
 
 #ifndef NULL_REP_IS_ZERO_BYTES

Index: log.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/log.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- log.c	8 Aug 2005 17:31:57 -0000	1.97
+++ log.c	12 Aug 2005 17:24:53 -0000	1.98
@@ -14,6 +14,12 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
 #include "./util.h"
 #include "./log.h"
 

Index: test.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/test.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- test.h	11 Jun 2005 05:31:15 -0000	1.23
+++ test.h	12 Aug 2005 17:24:53 -0000	1.24
@@ -49,21 +49,28 @@
     return;                                                     \
   } STMT_END
 
-#define test_eq(expr1, expr2)                                   \
-  STMT_BEGIN                                                    \
-    long v1=(long)(expr1), v2=(long)(expr2);                    \
-    if (v1==v2) { printf("."); fflush(stdout); } else {         \
-    have_failed = 1;                                            \
-    printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"\
-           "      (%ld != %ld)\n",                              \
-      _SHORT_FILE_,                                             \
-      __LINE__,                                                 \
-      PRETTY_FUNCTION,                                          \
-      #expr1, #expr2,                                           \
-      v1, v2);                                                  \
-    return;                                                     \
+#define test_eq_type(tp, fmt, expr1, expr2) \
+  STMT_BEGIN                                                            \
+  tp v1=(tp)(expr1);                                                    \
+  tp v2=(tp)(expr2);                                                    \
+  if (v1==v2) { printf("."); fflush(stdout); } else {                   \
+    have_failed = 1;                                                    \
+    printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"      \
+           "      "fmt "!="fmt"\n",                                     \
+             _SHORT_FILE_,                                              \
+             __LINE__,                                                  \
+             PRETTY_FUNCTION,                                           \
+             #expr1, #expr2,                                            \
+             v1, v2);                                                   \
+    return;                                                             \
   } STMT_END
 
+#define test_eq(expr1, expr2)                   \
+  test_eq_type(long, "%ld", expr1, expr2)
+
+#define test_eq_ptr(expr1, expr2)               \
+  test_eq_type(void*, "%p", expr1, expr2)
+
 #define test_neq(expr1, expr2)                                  \
   STMT_BEGIN                                                    \
     long v1=(long)(expr1), v2=(long)(expr2);                    \

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.214
retrieving revision 1.215
diff -u -d -r1.214 -r1.215
--- util.c	5 Aug 2005 01:51:19 -0000	1.214
+++ util.c	12 Aug 2005 17:24:53 -0000	1.215
@@ -77,6 +77,9 @@
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
 
 #ifndef O_BINARY
 #define O_BINARY 0