[Mapserver-dev] Anyone mind me adding IDENT strings in MapServer?

Frank Warmerdam warmerdam at pobox.com
Sat Oct 16 13:21:41 EDT 2004


Folks,

In GDAL I use a macro to insert a static string in each object file with
the CVS Id value.  This means I can easily inspect any executable, or
shared library and determine what version of any given source file was
built in.  For example:

warmerda at gdal2200[70]% ident ~/gdal/libgdal.so | grep cpl_vsi
      $Id: cpl_vsil_unix_stdio_64.cpp,v 1.6 2002/06/17 14:00:16 warmerda Exp $
      $Id: cpl_vsisimple.cpp,v 1.17 2003/09/10 19:44:36 warmerda Exp $

I am interested in doing the same thing with MapServer, to make it easier to
establish exactly what version of stuff folks are using.

I would propose to add a macro definition like this in map.h:

#ifndef DISABLE_CVSID
#  define MS_CVSID(string)     static char ms_cvsid[] = string; \
static char *msid_aw() { return( msid_aw() ? ((char *) NULL) : ms_cvsid ); }
#else
#  define MS_CVSID(string)
#endif

So, to disable it entirely just define DISABLE_CVSID.  The macro is somewhat
complex as I need to emit a dummy function that uses the static string variable
so it won't be complained of as unused.

The downsides to doing this are:
  o The executables will be somewhat larger.  It would add roughly 100 bytes
    to the executable per object file.  We have roughly 76 source files so that
    would add roughly 7600 bytes to the size of any of the executables.
  o Someone has to make a pass through everything committing code to use this
    macro.  I am willing to do this.
  o Yet another rule for people to keep in mind when checking in new source files,
    though there is nothing terrible that will happen if this gets missed in a
    few files.

So, what do people think?  If I get no objections and at least two positive
responses I will take that as permission.

I would add this pass through the code would be a good opportunity to add
"standard headers" to all the source files.  We seem to have a variety of styles
ranging from Steve's (launch directly into the code ... to hell with headers),
to several variations on my normal style.  My would also appreciate permission
to add a header looking something like the following in each file that has no
current header.

/******************************************************************************
  * $Id: mapdrawgdal.c,v 1.31 2004/09/29 17:12:13 frank Exp $
  *
  * Project:  MapServer
  * Purpose:  Code for drawing GDAL raster layers.  Called from
  *           msDrawRasterLayerLow() in mapraster.c.
  * Author:   Frank Warmerdam, warmerdam at pobox.com
  *
  ******************************************************************************
  * Copyright (c) 2002, Frank Warmerdam <warmerdam at pobox.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  * and/or sell copies of the Software, and to permit persons to whom the
  * Software is furnished to do so, subject to the following conditions:
  *
  * The above copyright notice and this permission notice shall be included
  * in all copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  ******************************************************************************
  *
  * $Log: mapdrawgdal.c,v $
  * Revision 1.31  2004/09/29 17:12:13  frank
  * fixed casting issues to avoid warnings
  */

However, this won't really give much concrete benefit. It mostly just makes it
a bit easier to see the author, a short description of the purpose of the module,
and the revision history as well as making the licensing of each file more
explicit.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the mapserver-dev mailing list