[tor-bugs] #18728 [Tor]: Build is broken with --enable-gcc-warnings on NetBSD.

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Apr 5 23:12:44 UTC 2016


#18728: Build is broken with --enable-gcc-warnings on NetBSD.
-------------------------+-----------------------------------
     Reporter:  yawning  |      Owner:
         Type:  defect   |     Status:  new
     Priority:  Medium   |  Milestone:  Tor: 0.2.8.x-final
    Component:  Tor      |    Version:  Tor: unspecified
     Severity:  Normal   |   Keywords:  tor-core, portability
Actual Points:           |  Parent ID:
       Points:           |   Reviewer:
      Sponsor:           |
-------------------------+-----------------------------------
 Part of trying to track down #18286, neither tor nor the unit tests build
 with `--enable-gcc-warnings` set on NetBSD 7.0 (gcc 4.8.4) due to char
 subscript warnings.

 This gets tor to build:
 {{{
 diff --git a/src/ext/readpassphrase.c b/src/ext/readpassphrase.c
 index ab71935..dee474f 100644
 --- a/src/ext/readpassphrase.c
 +++ b/src/ext/readpassphrase.c
 @@ -144,11 +144,11 @@ restart:
                         if (p < end) {
                                 if ((flags & RPP_SEVENBIT))
                                         ch &= 0x7f;
 -                               if (isalpha(ch)) {
 +                               if (isalpha((int)ch)) {
                                         if ((flags & RPP_FORCELOWER))
 -                                               ch = (char)tolower(ch);
 +                                               ch =
 (char)tolower((int)ch);
                                         if ((flags & RPP_FORCEUPPER))
 -                                               ch = (char)toupper(ch);
 +                                               ch =
 (char)toupper((int)ch);
                                 }
                                 *p++ = ch;
                         }
 }}}

 The test suite fails with:
 {{{
   CC       src/test/src_test_test-test_util.o
 ../src/test/test_util.c: In function 'test_util_format_time_interval':
 ../src/test/test_util.c:2347:3: error: array subscript has type 'char'
 [-Werror=char-subscripts]
    tt_ci_char_op(label_s[0],OP_EQ, 's');
    ^
 ../src/test/test_util.c:2354:3: error: array subscript has type 'char'
 [-Werror=char-subscripts]
    tt_ci_char_op(label_s[0],OP_EQ, 's');

 [lots more use of the macro snipped]
 }}}

 I'm filing this against 0.2.8, since it's a build failure, change it if
 you disagree.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18728>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list