Opened 2 weeks ago

Closed 7 days ago

#26272 closed defect (fixed)

gcc 7 fails on -Wunused-const-variable for Zstd headers

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: 0.3.4.x-final
Component: Core Tor/Tor Version: Tor: 0.3.1.1-alpha
Severity: Normal Keywords: fast-fix, 033-backport, 032-backport, 031-backport
Cc: Actual Points:
Parent ID: Points:
Reviewer: asn Sponsor:

Description

When using gcc 7 on macOS:

$ gcc-7 --version
gcc-7 (Homebrew GCC 7.3.0) 7.3.0

I see the following errors:

In file included from ../src/common/compress_zstd.c:29:0:
/usr/local/Cellar/zstd/1.3.4//include/zstd.h:593:29: error: 'ZSTD_defaultCMem' defined but not used [-Werror=unused-const-variable=]
 static ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL };  /**< this constant defers to stdlib's functions */
                             ^~~~~~~~~~~~~~~~
/usr/local/Cellar/zstd/1.3.4//include/zstd.h:404:21: error: 'ZSTD_skippableHeaderSize' defined but not used [-Werror=unused-const-variable=]
 static const size_t ZSTD_skippableHeaderSize = 8;  /* magic number + skippable frame length */
                     ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/zstd/1.3.4//include/zstd.h:403:21: error: 'ZSTD_frameHeaderSize_max' defined but not used [-Werror=unused-const-variable=]
 static const size_t ZSTD_frameHeaderSize_max = ZSTD_FRAMEHEADERSIZE_MAX;
                     ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/zstd/1.3.4//include/zstd.h:402:21: error: 'ZSTD_frameHeaderSize_min' defined but not used [-Werror=unused-const-variable=]
 static const size_t ZSTD_frameHeaderSize_min = ZSTD_FRAMEHEADERSIZE_MIN;
                     ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/zstd/1.3.4//include/zstd.h:401:21: error: 'ZSTD_frameHeaderSize_prefix' defined but not used [-Werror=unused-const-variable=]
 static const size_t ZSTD_frameHeaderSize_prefix = ZSTD_FRAMEHEADERSIZE_PREFIX;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Child Tickets

Change History (5)

comment:1 Changed 2 weeks ago by teor

Status: newneeds_review

Please see my branch bug26272-031 on https://ghithub.com/teor2345/tor.git

Waiting for travis to complete...

comment:2 Changed 2 weeks ago by dgoulet

Reviewer: ahf

comment:3 Changed 8 days ago by asn

Reviewer: ahfasn

Swapping 034 reviews with ahf since he is travelling.

comment:4 Changed 7 days ago by asn

Status: needs_reviewmerge_ready

Hmm, I don't have a macOS box to actually test this in practice with the right gcc version, but teor's branch looks legit and harmless to me.

LGTM.

comment:5 Changed 7 days ago by nickm

Resolution: fixed
Status: merge_readyclosed

Merged to 0.3.1 and forward!

Note: See TracTickets for help on using tickets.