getting rid of mkproto.sh from Samba3

James Peach jpeach at samba.org
Wed Jun 6 00:47:31 GMT 2007


On 05/06/2007, at 5:10 PM, tridge at samba.org wrote:

> James,
>
>> If I have a decent header file, I can see the full interface in a
>> single screen, along with comments, macros and typedefs. I don't  
>> think
>> the argument about the extra typing involved in changing headers by
>> hand is very strong, since the code needs to be read and understood
>> thousands more times than it needs to be written.
>
> It is not the extra typing, it's the mistakes. Before we had auto
> prototypes in Samba the following mistakes were common:
>
>  *) leaving a prototype in a header for a function that has been
>   removed. I don't know of any tool that will find/remove those.
>
>  *) getting details in the prototype wrong, especially the varargs
>   functions with printf arguments.
>
>  *) when the arguments to a function change, and the prototype isn't
>   updated. This is especially insidious when the new and old arguments
>   are type compatible, but change their meaning, so the old prototype
>   is completely misleading (ie. is still takes an int as the 3rd
>   argument, but now its a set of flags, not a counter)
>
>  *) once you start breaking up your includes out of a single
>   includes.h, then you risk getting the prototype completely wrong if
>   the source file of the function doesn't include the prototype
>   header. The compiler won't complain.
>
>  *) programmers add nice comments to the prototype header, which is in
>   a completely different file to the code. Those comments will degrade
>   over time as the code changes and the comment is not upgraded, so
>   those nice docs that you do this month will become completely wrong
>   by next year, and the person updating the function will not notice,
>   as the prototype is not on the same screen as the code they are
>   changing.

OK, these are pretty convincing. I'll take a look at integrating the  
Samba4 mkproto, that seems uncontroversial and likely to improve things.

--
James Peach | jpeach at samba.org




More information about the samba-technical mailing list