Opened 5 months ago

Closed 5 months ago

#26785 closed defect (fixed)

older gccs don't accept -Wunused-const-variable

Reported by: catalyst Owned by: catalyst
Priority: Medium Milestone: Tor: 0.3.2.x-final
Component: Core Tor/Tor Version: Tor: 0.3.2.11
Severity: Normal Keywords: compression, portability, regression?, zstd, fast-fix
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

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.

Child Tickets

Change History (3)

comment:1 Changed 5 months ago by catalyst

Keywords: fast-fix added
Owner: set to catalyst
Status: newassigned

comment:2 Changed 5 months ago by catalyst

Status: assignedneeds_review

comment:3 Changed 5 months ago by nickm

Resolution: fixed
Status: needs_reviewclosed

LGTM; I've merged this to 0.3.2 and forward.

Note: See TracTickets for help on using tickets.