[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-dev] [PATCH] Fix comparison is always true due to limited range of data type
Hi,
I was unable to compile Tor for powerpc32 for a while but I was unable to
bisect it because of other compilation errors (and "git bisect skip" did
not help):
-----------------------------------------------
CC src/or/scheduler.o
In file included from src/or/or.h:91:0,
from src/or/scheduler.c:9:
src/or/scheduler.c: In function 'scheduler_adjust_queue_size':
src/or/scheduler.c:623:18: error: comparison is always true due to limited
range of data type [-Werror=type-limits]
(dir >= 0) ? "+" : "-",
^
src/or/../common/torlog.h:190:55: note: in definition of macro 'log_debug'
log_fn_(LOG_DEBUG, domain, __PRETTY_FUNCTION__, args); \
^
src/or/scheduler.c:631:11: error: comparison is always true due to limited
range of data type [-Werror=type-limits]
if (dir >= 0) {
^
cc1: all warnings being treated as errors
-----------------------------------------------
The last good version to compile for me was
4ae729683 ("Try to fix test_checkdir windows compilation more"). Below is
my attempt to fix this issue by declaring "dir" as "signed char". It
compiles now (4.6.3 and 4.9.1) for powerpc32 and Tor seems to work - but
please have a look if this is the Right Thing To Do.
Thanks,
Christian.
Declare "char dir" as signed, otherwise compilation on powerpc32
would fail with:
-------------------------------------
CC src/or/scheduler.o
In file included from src/or/or.h:91:0,
from src/or/scheduler.c:9:
src/or/scheduler.c: In function 'scheduler_adjust_queue_size':
src/or/scheduler.c:623:18: error: comparison is always true due to limited range of data type [-Werror=type-limits]
(dir >= 0) ? "+" : "-",
^
src/or/../common/torlog.h:190:55: note: in definition of macro 'log_debug'
log_fn_(LOG_DEBUG, domain, __PRETTY_FUNCTION__, args); \
^
src/or/scheduler.c:631:11: error: comparison is always true due to limited range of data type [-Werror=type-limits]
if (dir >= 0) {
^
cc1: all warnings being treated as errors
-------------------------------------
Signed-off-by: Christian Kujau <lists@xxxxxxxxxxxxxxx>
scheduler.c | 2 +-
scheduler.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index f3fbc4a..78db274 100644
--- a/src/or/scheduler.c
+++ b/src/or/scheduler.c
@@ -613,7 +613,7 @@ scheduler_touch_channel(channel_t *chan)
*/
void
-scheduler_adjust_queue_size(channel_t *chan, char dir, uint64_t adj)
+scheduler_adjust_queue_size(channel_t *chan, signed char dir, uint64_t adj)
{
time_t now = approx_time();
diff --git a/src/or/scheduler.h b/src/or/scheduler.h
index 70f6a39..111e23a 100644
--- a/src/or/scheduler.h
+++ b/src/or/scheduler.h
@@ -29,7 +29,7 @@ void scheduler_channel_wants_writes(channel_t *chan);
MOCK_DECL(void,scheduler_release_channel,(channel_t *chan));
/* Notify scheduler of queue size adjustments */
-void scheduler_adjust_queue_size(channel_t *chan, char dir, uint64_t adj);
+void scheduler_adjust_queue_size(channel_t *chan, signed char dir, uint64_t adj);
/* Notify scheduler that a channel's queue position may have changed */
void scheduler_touch_channel(channel_t *chan);
--
BOFH excuse #103:
operators on strike due to broken coffee machine
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev