Opened 4 years ago

Closed 4 years ago

#19132 closed defect (fixed)

shared random: missing field 'fetch_missing_votes' initializer

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: 0.2.9.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: #16943 Points: 0.1
Reviewer: Sponsor:

Description

dgoulet's ticket16943_029_02 fails to compile on OS X with Apple LLVM version 7.3.0 (clang-703.0.31):

src/or/dirvote.c:2547:46: error: missing field 'fetch_missing_votes' initializer
      [-Werror,-Wmissing-field-initializers]

Even though this is perfectly legal C for "initialise the whole structure to zero".

Child Tickets

Change History (6)

comment:1 Changed 4 years ago by asn

Seems to be related to llvm bug 21689. See https://webcache.googleusercontent.com/search?q=cache:7Fk9-xz-MBYJ:https://llvm.org/bugs/show_bug.cgi%3Fid%3D21689+&cd=1&hl=en&ct=clnk&gl=us

In theory we could work around this llvm bug by removing the = {0} part, since the struct is a file-level static variable which should have its elements inited to NULs anyway.

Not sure if we should bother here.

comment:2 Changed 4 years ago by teor

If we don't bother, any build on those clang/llvm versions with ./configure --enable-gcc-warnings will fail.

So we need to silence this warning, otherwise no-one can use --enable-gcc-warnings with clang/llvm.

comment:3 in reply to:  2 Changed 4 years ago by asn

Replying to teor:

If we don't bother, any build on those clang/llvm versions with ./configure --enable-gcc-warnings will fail.

So we need to silence this warning, otherwise no-one can use --enable-gcc-warnings with clang/llvm.

You are right. I'm surprised this is the only place in the codebase where this pattern bothers clang/llvm.

If this is the only instance of this issue, maybe we can just remove the = {0} part, and rely on the compiler zeroing it because it's a global static struct.

comment:4 Changed 4 years ago by teor

Sounds like a good idea!

comment:5 Changed 4 years ago by asn

Status: newneeds_review

OK, I implemented the fix from comment:3 and pushed it as part of my ticket16943_029_04 branch (see 697ee23). That branch will probably get reviewed in #16943.

comment:6 Changed 4 years ago by dgoulet

Resolution: fixed
Status: needs_reviewclosed

Cherry-picked into the main branch for prop250 code. Closing this because review will happen in the prop250 giant branch.

Note: See TracTickets for help on using tickets.