static and HIDDEN

Дилян Палаузов dilyan.palauzov at aegee.org
Thu Jul 12 09:06:17 EDT 2012


Hello,

> Dilyan, this warning is caused by some of your recent commits, like
>
> libcyrus: mark all local symbols declared in .h with static
>
> which made some of the function declarations in header files 'static'.
> That's just never right.
>
> Also, you've marked a number of cyrusdb_*() functions as 'static'.
> These are actual external APIs used by code, albeit in the conversations
> branch, not master.  This is just not helpful.  If you care that much
> about external symbols, remove the functions entirely and we'll put them
> back when we merge the conversations code.  Or just leave them alone.

Yes, attaching static to all variables and functions, that are not used 
out of the library, was sometimes inappropriate.  I do not have problems 
with either of the approaches to remove the functions entirely, or to 
mark them as part of the external API, which will be used by future 
versions.  On the other side, there shall be some track of functions, 
which are really unnecessary (like lib/util.c:kv_bsearch()), and marking 
them with HIDDEN or static eases their finding.  Of course, strictly 
internal functions, that are even not tested, shall not be exported, as 
this would slow down the dynamic linker.  Putting static things in 
header files is stupid.  That said, there should be some balance.

Currently there are 12 symbols marked as static in header files under 
lib/ and 71 under imap/, which lead to compiler warnings.

I do not know which of the remaining HIDDEN symbols (in libcyrus and 
libcyrus_imap; in cyrus_min and cyrus_sieve internal symbols are not 
annotated), belong to future external API, and which will be strictly 
internal for the library but are included (for now strange reasons) in a 
header file (e.g. why is fuzzy_match() part of lmtpd.h, when it is 
defined and used entirely in lmtpd.c and thus shall be static?).

Със здраве
   Дилян
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dilyan_palauzov.vcf
Type: text/x-vcard
Size: 380 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20120712/f7c0ccdb/attachment.vcf 


More information about the Cyrus-devel mailing list