diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-08-12 17:24:53 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-08-12 17:24:53 +0000 |
commit | 789374dbbd6931fb9749161ea2882fccfc172343 (patch) | |
tree | cdb535dd3382ff2a5265ac67ccb419253aa31d1c /src/common | |
parent | 21959c1bfd8bbc465a330fe8d9ad52518de51f71 (diff) | |
download | tor-789374dbbd6931fb9749161ea2882fccfc172343.tar.gz tor-789374dbbd6931fb9749161ea2882fccfc172343.zip |
Make GCC very happy, even with lots of warnings set. Also, try to fix some reported Solaris x86 warnings.
svn:r4770
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/compat.h | 3 | ||||
-rw-r--r-- | src/common/log.c | 6 | ||||
-rw-r--r-- | src/common/test.h | 33 | ||||
-rw-r--r-- | src/common/util.c | 3 |
4 files changed, 32 insertions, 13 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index 0cdc5442fc..30db44d8ce 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -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 diff --git a/src/common/log.c b/src/common/log.c index d288d3f172..e676612b6f 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -14,6 +14,12 @@ const char log_c_id[] = "$Id$"; #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" diff --git a/src/common/test.h b/src/common/test.h index 34845146d5..99abc0b5a4 100644 --- a/src/common/test.h +++ b/src/common/test.h @@ -49,21 +49,28 @@ extern int have_failed; 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); \ diff --git a/src/common/util.c b/src/common/util.c index ea726d1135..acc5cb9d44 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -77,6 +77,9 @@ const char util_c_id[] = "$Id$"; #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif +#ifdef HAVE_TIME_H +#include <time.h> +#endif #ifndef O_BINARY #define O_BINARY 0 |