Opened 6 years ago

Closed 6 years ago

#9254 closed defect (fixed)

tor-0.2.4.x compilation with FreeBSD gcc

Reported by: grarpamp Owned by:
Priority: Medium Milestone: Tor: 0.2.4.x-final
Component: Core Tor/Tor Version: Tor: 0.2.4.15-rc
Severity: Keywords: tor-client freebsd build warning
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

FreeBSD 8.3+ i386 gcc 4.2.1+

tor-0.2.3.25 is fine

tor-0.2.4.15
src/or/circuitlist.c:1522: warning: passing argument 1 of 'TO_OR_CIRCUIT' discards qualifiers from pointer target type

master 6848e29
src/or/circuitlist.c:1647: warning: passing argument 1 of 'TO_OR_CIRCUIT' discards qualifiers from pointer target type

Child Tickets

Attachments (1)

9254.patch (484 bytes) - added by nickm 6 years ago.
possible fix for #9254

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by nickm

Strange! The code in question is

    n += TO_OR_CIRCUIT((circuit_t*)c)->p_chan_cells.n;

And that warning usually means that you're calling TO_OR_CIRCUIT with a const pointer when it only takes a non-const one. But we *are* calling it with a non-const pointer -- we're casting c to circuit_t*.

This warning doesn't seem to occur on other platforms, as far as I know. Could the FreeBSD gcc be doing something unusual here?

comment:2 Changed 6 years ago by grarpamp

Could the FreeBSD gcc be doing something unusual here?

That I don't know. FreeBSD typically uses older gcc's for their base, backport select gcc patches into it, and do what they need for FreeBSD.

I just checked and this warning goes away when using gcc 4.6.4 from their packages (added CC and CPP env vars to the 4.6.4 bins).

comment:3 Changed 6 years ago by nickm

Summary: tor-0.2.4.x compilationtor-0.2.4.x compilation with FreeBSD gcc

comment:4 Changed 6 years ago by ln5

FWIW, I can't reproduce that warning on a FreeBSD 8.3 amd64 (!) system
with gcc 4.2.1.

Changed 6 years ago by nickm

Attachment: 9254.patch added

possible fix for #9254

comment:5 Changed 6 years ago by nickm

Status: newneeds_review

Does the attached patch (against maint-0.2.4) fix the compilation warning for you?

comment:6 Changed 6 years ago by grarpamp

This was on a 'Jul 2012 RELENG_8 i386' with its 'gcc 4.2.1 20070831 patched [FreeBSD]'.

The attached patch as applied to the rc tarball fixes the warning there.

comment:7 Changed 6 years ago by nickm

Keywords: tor-client freebsd build warning added
Resolution: fixed
Status: needs_reviewclosed

Fixed in c36bdbd53521a9b7d2213cde1f9f0f8fe8ac7441. Thanks!

Note: See TracTickets for help on using tickets.