[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-dev] #if 0 unused functions?



Hi teor,

> On 22 Mar 2015, at 14:41, teor <teor2345@xxxxxxxxx> wrote:
>> Date: Sun, 22 Mar 2015 05:12:03 +0100
>> From: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
>> To: tor-dev@xxxxxxxxxxxxxxxxxxxx
>> 
>> Hi there,
>> 
>> we have some functions which we never call anywhere. In many cases, it
>> appears we shouldn't delete them from the source because they "belong"
>> there - the thing I initially stumbled across was
>> ed25519_seckey_write_to_file(), for example. But I also don't see why
>> compiling it and potentially including it in our binary makes any sense.
>> 
>> Thoughts?
>> 
>> Cheers
>> Sebastian
> 
> I'm think that removing / disabling unused code is a great idea, but I wonder what happens over the long term:
> 
> [How] do we prevent bit-rot on the disabled code?
> 
> Does the disabled code have unit tests?

I meant code which doesn't have unit tests currently.

> Should we add unit tests or keep them active to prevent bit-rot?
> Or should any unit tests be disabled too?
> 
> I wonder if we could unit test unused code, but not link it into the tor binary.
> This would make sure it works if we ever want to use it in future, but without the risks and performance impacts of including unused code in the binary.
> 
> There could be issues with this strategy that I haven't thought of. Like the added maintenance cost involved in keeping unused code and unit tests up-to-date.
> 
> Perhaps we could:
> * remove entirely if we're unlikely to ever use the code,
> * disable if we want to keep it around for future reference, and
> * unit test it, but not link it in to the tor binary, if we think we'll use it soon.
> 
> Which category do most of the unused functions fall into?

I don't know how much of this code there actually is, I would just
do it as I spot such code, not as a big project to identify it all
(tho looking at a call graph including unit tests should give you
some idea).

Cheers
Sebastian

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev