Opened 5 weeks ago

Closed 5 days ago

#27709 closed defect (fixed)

The compiler doesn't warn about tor_assert(a = b)

Reported by: nickm Owned by: nickm
Priority: High Milestone: Tor: 0.3.5.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 029-backport 032-backport 033-backport 034-backport
Cc: Actual Points:
Parent ID: Points:
Reviewer: asn Sponsor:

Description

C's assignment expressions are notoriously easy to mis-type when you are trying to enter an equality expression instead. Most compilers will notice when you say something like if (a = b), and make you add an extra set of parentheses. But we've done something with our tor_assert() macro so this doesn't happen. We should fix that.

Found from ahf's review of #27289

We should also make sure BUG doesn't have this problem.

Child Tickets

Change History (8)

comment:1 Changed 5 weeks ago by nickm

Owner: set to nickm
Status: newaccepted

comment:2 Changed 5 weeks ago by nickm

Keywords: 029-backport 032-backport 033-backport 034-backport added
Status: acceptedneeds_review

See branch bug27709_029, with PR at https://github.com/torproject/tor/pull/337

This is important IMO, since it has potential to suppress important compiler warnings.

comment:3 Changed 5 weeks ago by nickm

(ahf says it looks okay to him, but it should get another reviewer too)

comment:4 Changed 5 weeks ago by asn

Reviewer: asn

comment:5 Changed 5 days ago by asn

Status: needs_reviewneeds_revision

Asked a few questions on the PR.

comment:6 Changed 5 days ago by nickm

Status: needs_revisionneeds_review

I've tried to answer your questions!

comment:7 Changed 5 days ago by asn

Status: needs_reviewmerge_ready

LGTM!

comment:8 Changed 5 days ago by nickm

Resolution: fixed
Status: merge_readyclosed

Merged to 0.2.9 and forwards. I had to add 796e36e535d1713fd1168772669199ea9189ba61 as well to fix some warnings in 0.3.3.

Note: See TracTickets for help on using tickets.