[tor-bugs] #26785 [Core Tor/Tor]: older gccs don't accept -Wunused-const-variable

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Jul 13 22:06:01 UTC 2018


#26785: older gccs don't accept -Wunused-const-variable
-------------------------+-------------------------------------------------
     Reporter:           |      Owner:  (none)
  catalyst               |
         Type:  defect   |     Status:  new
     Priority:  Medium   |  Milestone:  Tor: 0.3.2.x-final
    Component:  Core     |    Version:  Tor: 0.3.2.11
  Tor/Tor                |   Keywords:  compression, portability,
     Severity:  Normal   |  regression?, zstd
Actual Points:           |  Parent ID:
       Points:           |   Reviewer:
      Sponsor:           |
-------------------------+-------------------------------------------------
 In src/common/compress_zstd.c, we use the `DISABLE_GCC_WARNING()` macro to
 disable the `-Wunused-const-variable` warning.  Some versions of gcc don't
 recognize that warning option, so they will warn about incorrect pragma
 usage.

 {{{
 src/common/compress_zstd.c:29:1: warning: unknown option after ‘#pragma
 GCC diagnostic’ kind [-Wpragmas]
  DISABLE_GCC_WARNING(unused-const-variable)
  ^
 }}}

 We should probably define a macro if `-Wunused-const-variable` is
 supported by gcc and update the preprocessor conditional in
 compress_zstd.c
 {{{
 #ifdef HAVE_ZSTD
 DISABLE_GCC_WARNING(unused-const-variable)
 }}}
 to use it.

 Reported on IRC.

 Confirmed on Xenial with gcc 5.4.0-6ubuntu1~16.04.10 and libzstd1-dev
 1.3.1+dfsg-1~ubuntu0.16.04.1.  Travis is still on Trusty so doesn't have a
 libzstd-dev.

 This might be a regression on platforms with libzstd but an older gcc.

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


More information about the tor-bugs mailing list