[freetds] $Id and include file

Christos Zoulas christos at zoulas.com
Tue Oct 19 12:33:27 EDT 2004


On Oct 19,  5:35pm, Frediano.Ziglio at vodafone.com ("ZIGLIO, Frediano, VF-IT") wrote:
-- Subject: [freetds] $Id and include file

| Some small analisy show that using these lines in include=20
| 
| static char rcsid_tds_h[] =3D "$Id$";
| static void *no_unused_tds_h_warn[] =3D { rcsid_tds_h,
| no_unused_tds_h_warn };
| 
| cause a replication of this string for every library module. Also this
| code goes on all programs that use tds include. I readed recently a
| Samba coding style and they use size to determine if program can have
| thread problems (just data should be null). After changing line above
| into
| 
| static const char rcsid_tds_h[] =3D "$Id$";
| static const void *const no_unused_tds_h_warn[] =3D { rcsid_tds_h,
| no_unused_tds_h_warn };
| 
| code get placed in the same place of constants strings.
| 
| Just for statistics all $Id strings occupy about 13K of ODBC while all
| ODBC occupy 260k (that is 5%).
| 
| Perhaps it would be better to use /* $Id */ in include and add const in
| modules ??

Well, it is nice to have "ident" say what version of each file the
library contains.

For gcc you can:

#define __RCSID(id) \
    static const char rcsid[] \
	__attribute__((__unused__,__section__(".ident"))) = id

Unfortunately this makes the section still allocatable, but it puts
it in the ident section. A better and less portable solution is to
use:

#define __RCSID(id) \
    __asm__(".section .ident\n\t.asciz \"" id "\"\n\t.previous")

which actually puts the string in a non-allocatable section.

It would be nice to change the rcsid strings in freetds to $FreeTDS$,
instead of using $Id$.

christos


More information about the FreeTDS mailing list