Opened 10 years ago

Closed 7 years ago

#1031 closed enhancement (fixed)

reserved identifier violation

Reported by: elfring Owned by: nickm
Priority: Medium Milestone: Tor: 0.2.4.x-final
Component: Core Tor/Tor Version: 0.2.2.6-alpha
Severity: Keywords: tor-relay
Cc: nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by nickm)

I suggest to try the search pattern "_[A-Z]+" on the source files. You will find some places where names begin with an underscore and an uppercase letter.

Examples:

This does not fit to the expected naming conventions of the C language standard.
http://en.wikipedia.org/wiki/Reserved_identifier

See also section "7.1.3 Reserved identifiers".
http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf

[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Attachments (1)

1031.diff (24.3 KB) - added by elfring 10 years ago.
update suggestion

Download all attachments as: .zip

Change History (11)

comment:1 Changed 10 years ago by nickm

Sounds worth fixing in 0.2.2. A patch against git master would be welcome.

comment:2 Changed 10 years ago by elfring

How do you think about to make any symbols longer together with the adjustment to get rid of leading underscores?

Changed 10 years ago by elfring

Attachment: 1031.diff added

update suggestion

comment:3 Changed 9 years ago by nickm

Cc: elfring removed
Type: defectenhancement
Version: 0.2.0.350.2.2.6-alpha

If somebody wants to pick this up again, that would be fine. It's not a big deal in practice unless we have a symbol that actually *does* conflict with something, but it would be nice to be a little more standards-compliant in our C.

Doing this as diff by hand is not the best approach, though: there are too many places to check for too many identifiers, and we can't rely on the compiler to tell us if we found them all. The best approach is probably to use a search-and-replace tool (like perl -i) so we can be sure there aren't any uses we're missing.

comment:4 Changed 9 years ago by nickm

Description: modified (diff)
Milestone: Tor: unspecified

comment:5 Changed 7 years ago by nickm

Owner: set to nickm
Status: newassigned

I wrote up a set of scripts to do this fix on libevent. If they work out, I'll link here and we can consider doing this as early as 0.2.3.x

comment:6 Changed 7 years ago by nickm

Milestone: Tor: unspecifiedTor: 0.2.4.x-final
Priority: minornormal

(The libevent scripts did indeed work. See libevent commits 3f8c7cd0353f4b2adcf19a90ffd3b8ba42b68209 and cb9da0bf38c18e6406bbba4f5373fb41e4dac2f5.)

comment:7 Changed 7 years ago by nickm

Keywords: tor-relay added

comment:8 Changed 7 years ago by nickm

Component: Tor RelayTor

comment:9 Changed 7 years ago by nickm

Status: assignedneeds_review

Please see branch "bug1031" in my public repository. It is a slightly big patch, but the bulk of the commits here were generated by shorter perl scripts, which in turn were generated by even shorter perl scripts. (The scripts are included in the commit messages.)

Who doesn't like code that writes code to change code?

comment:10 Changed 7 years ago by nickm

Resolution: Nonefixed
Status: needs_reviewclosed

Andrea liked it; merging it. Added #7117 to track the suggestion of making sure we don't add any more bogus identifiers.

Note: See TracTickets for help on using tickets.