aboutsummaryrefslogtreecommitdiff
path: root/src/ext/timeouts
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-04-13 09:13:33 -0400
committerNick Mathewson <nickm@torproject.org>2016-04-15 09:03:22 -0400
commit9d6c530015e4eefd7b333885eaeca1f9fcbc6578 (patch)
treee8e9f3912b0cadfe856e531166f63a4a63f74974 /src/ext/timeouts
parent05499b6ded25b5cbc8b16916fa9c0a39407ab10f (diff)
downloadtor-9d6c530015e4eefd7b333885eaeca1f9fcbc6578.tar.gz
tor-9d6c530015e4eefd7b333885eaeca1f9fcbc6578.zip
Fix compilation of timeout.c with our flags and warnings.
Diffstat (limited to 'src/ext/timeouts')
-rw-r--r--src/ext/timeouts/timeout-bitops.c7
-rw-r--r--src/ext/timeouts/timeout.c7
-rw-r--r--src/ext/timeouts/timeout.h2
3 files changed, 14 insertions, 2 deletions
diff --git a/src/ext/timeouts/timeout-bitops.c b/src/ext/timeouts/timeout-bitops.c
index d8325db3b4..a018f33b95 100644
--- a/src/ext/timeouts/timeout-bitops.c
+++ b/src/ext/timeouts/timeout-bitops.c
@@ -1,4 +1,5 @@
#include <stdint.h>
+#include <limits.h>
#ifdef _MSC_VER
#include <intrin.h> /* _BitScanForward, _BitScanReverse */
#endif
@@ -7,12 +8,16 @@
* you want them to be fast. */
#if defined(__GNUC__) && !defined(TIMEOUT_DISABLE_GNUC_BITOPS)
+#ifndef LONG_BIT
+#define LONG_BIT (SIZEOF_LONG*CHAR_BIT)
+#endif
+
/* On GCC and clang and some others, we can use __builtin functions. They
* are not defined for n==0, but timeout.s never calls them with n==0. */
#define ctz64(n) __builtin_ctzll(n)
#define clz64(n) __builtin_clzll(n)
-#if LONG_BITS == 32
+#if LONG_BIT == 32
#define ctz32(n) __builtin_ctzl(n)
#define clz32(n) __builtin_clzl(n)
#else
diff --git a/src/ext/timeouts/timeout.c b/src/ext/timeouts/timeout.c
index e78f57d25b..70bc0eba0a 100644
--- a/src/ext/timeouts/timeout.c
+++ b/src/ext/timeouts/timeout.c
@@ -23,6 +23,9 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE.
* ==========================================================================
*/
+#ifdef HAVE_CONFIG_H
+#include "orconfig.h"
+#endif
#include <limits.h> /* CHAR_BIT */
#include <stddef.h> /* NULL */
@@ -39,6 +42,10 @@
#include "timeout.h"
+#ifndef TIMEOUT_DEBUG
+#define TIMEOUT_DEBUG 0
+#endif
+
#if TIMEOUT_DEBUG - 0
#include "timeout-debug.h"
#endif
diff --git a/src/ext/timeouts/timeout.h b/src/ext/timeouts/timeout.h
index 3ef76e90a2..6d7359a6a2 100644
--- a/src/ext/timeouts/timeout.h
+++ b/src/ext/timeouts/timeout.h
@@ -90,7 +90,7 @@ typedef uint64_t timeout_t;
#ifndef TIMEOUT_CB_OVERRIDE
struct timeout_cb {
- void (*fn)();
+ void (*fn)(void);
void *arg;
}; /* struct timeout_cb */
#endif