rcs tags
Moderator: Forum Moderators
-
- Retired Developer
- Posts: 2633
- Joined: March 22nd, 2004, 11:22 pm
- Location: An Earl's Roadstead
rcs tags
I would like to propose including the rcs tags[1] in the code, not just in comments. There is a fairly simple way to keep the rcs Id tags not be optimized away by the compiler, for example:
now causes the string with the rcs tag to be kept in the .o files and the binary file.
In linux you can then run the ident command on an executable to extract the rcs tag information associated with that binary. There is no real performance hit and the object files and binary will be negligibly larger as a result.
[1] for those who don't know the rcs tags are updated by cvs when commits are done so that cvs info can be automatically stored in the file itself and updated by cvs.
Code: Select all
#define USE(var) static void * use_##var = (void *) &var
static char crcsid[] =
"$Id: make_vert.c,v 1.4 1998/10/09 18:26:20 mcnabb Exp $";
USE(crcsid); /* make sure it is not optimized away */
In linux you can then run the ident command on an executable to extract the rcs tag information associated with that binary. There is no real performance hit and the object files and binary will be negligibly larger as a result.
[1] for those who don't know the rcs tags are updated by cvs when commits are done so that cvs info can be automatically stored in the file itself and updated by cvs.
-
- Retired Developer
- Posts: 2633
- Joined: March 22nd, 2004, 11:22 pm
- Location: An Earl's Roadstead
If you like it I can go ahead and implement it. It will probably come in the form of a header file and perl script to run on the src directory to add the one or two lines that are needed to all the appropriate files. At some point I had actually worked on a (fairly short) bit of code to make a program "version self-aware" so that with a --version command line option it would spit out the cvs versions of every file in it. It worked ok as long as you weren't trying to link against a library and wanted all the info of the versions inside that library... That is probably overkill here.