svn commit: samba r6586 - in branches/SAMBA_3_0/source: lib libads libsmb smbd tests torture

derrell at samba.org derrell at samba.org
Mon May 2 18:50:21 GMT 2005


derrell at samba.org writes:

> herb at samba.org writes:
>
>> Log:
>> get rid of a few more compiler warnings
>>
>> Modified: branches/SAMBA_3_0/source/lib/dummyroot.c
>> ===================================================================
>> --- branches/SAMBA_3_0/source/lib/dummyroot.c	2005-05-02 16:23:02 UTC (rev 6585)
>> +++ branches/SAMBA_3_0/source/lib/dummyroot.c	2005-05-02 17:49:43 UTC (rev 6586)
>> @@ -22,6 +22,9 @@
>>  /* Stupid dummy functions required due to the horrible dependency mess
>>     in Samba. */
>>  
>> +void become_root(void);
>> +void unbecome_root(void);
>> +
>>  void become_root(void)
>>  {
>>          return;
>>
>
> Herb, I don't get it.  What is the purpose of a forward declaration
> immediately prior to an actual function declaration?  What type of warning
> were you getting that this solves?

Herb, in talking with abartlet, I now understand what problem this was trying
to solve.  These are public functions, and therefore should have calls by
external (not in the same file) users.  (If not, they'd likely be declared
static.)  These stub functions that you have corrected should, as you
discovered, have external declarations as well.  Since the callers are
intended to be external, the external declarations should really be in a
header file so that all callers to these functions are using the same external
declaration.  By putting the external declarations in the C file with the
function declaration, the warning is removed, but the "purpose" of the warning
is defeated.

In our discussion, abartlet and I agreed that the proper place for these
declarations is probably in proto.h, which raises the question as to why they
are not automagically being added to proto.h.  Would you like to try to figure
out why they're not being generated in proto.h, and perhaps fix it so they
are?

If there is some reason that they shouldn't in fact, go in proto.h, then it
seems that includes.h would likely be the right place for them.

Cheers,

Derrell


More information about the samba-cvs mailing list