Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#1824 closed defect (fixed)

Remove unused prototypes from rephist.h et al.

Reported by: karsten Owned by: Sebastian
Priority: Medium Milestone:
Component: Core Tor/Tor Version:
Severity: Keywords: tor-relay
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by nickm)

rephist.h has some prototypes of functions that are not in rephist.c and that we don't use anymore, e.g., hs_usage_* . Is there a way to find all of these unused prototypes in all .h files and remove them?

Child Tickets

Attachments (1)

find_orphaned_prototypes.py (761 bytes) - added by nickm 9 years ago.
script to post-process gnu ctags output

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by nickm

Attachment: find_orphaned_prototypes.py added

script to post-process gnu ctags output

comment:1 Changed 9 years ago by nickm

Description: modified (diff)

So the way I'd do it is to write a script use gnu ctags (you want the gnu one; it does more stuff) to parse the .h files and the .c files, and then post-process the output to find identifiers that are in the .h files but not defined in any .c file.

The incant for "all function prototypes and only function prototypes" is

ctags -n --c-kinds=p -f - ./src/*/*.[ch]

and the incant for "all function definitions" is

ctags -n --c-kinds=f -f - ./src/*/*.[ch]

.....

Oh heck, I've practically written the thing already. Finishing it up as a script and attaching it. There are some false positives left, but it'll still be useful, I hope.

comment:2 Changed 9 years ago by Sebastian

Hah, I was using ctags too; but your script does more. I was planning on doing this for 0.2.3 unless there's a reason to get it into 0.2.2?

comment:3 Changed 9 years ago by nickm

It's a code cleanup; it can go in 0.2.2 if it's done in time.

comment:4 Changed 9 years ago by Sebastian

Status: newneeds_review

See branch cleanups in my repository.

comment:5 Changed 9 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged. Thanks!

(I had hope to one day make the buffer tests work again, but given the amount of time that's gone by, I suppose I should admit that it's not likely to be soon.)

comment:6 Changed 7 years ago by nickm

Keywords: tor-relay added

comment:7 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.