Warn of unused variables in C++ code
authorRoland Schulz <roland@utk.edu>
Sun, 4 Mar 2012 00:31:58 +0000 (19:31 -0500)
committerRoland Schulz <roland@utk.edu>
Sat, 17 Mar 2012 21:58:26 +0000 (17:58 -0400)
- Replace -Wunused by -Wunused-function for C++
- Remove all unused variables in C++
- Replaced static const in headers used by C++ by get function for constant
- Also warn of non-virtual-dtor and sign-compare
- Removes src/contrib/copyrgt.c. Is not needed anymore for manual.
  If it is needed for other purposes should be rewritten using CopyRight(...)
  (from src/gromacs/legacyheaders/copyrite.h)

Change-Id: I9046eae5d097e65607add7a18a3a7e8c643c8331

33 files changed:
cmake/gmxCFlags.cmake
src/contrib/copyrgt.c [deleted file]
src/contrib/ehanal.c
src/gromacs/analysisdata/abstractdata.cpp
src/gromacs/analysisdata/modules/displacement.cpp
src/gromacs/analysisdata/modules/histogram.cpp
src/gromacs/gmxlib/copyrite.c
src/gromacs/gmxlib/pargs.c
src/gromacs/gmxlib/pdbio.c
src/gromacs/gmxlib/wman.c
src/gromacs/legacyheaders/copyrite.h
src/gromacs/legacyheaders/maths.h
src/gromacs/legacyheaders/pdbio.h
src/gromacs/legacyheaders/readinp.h
src/gromacs/mdlib/constr.c
src/gromacs/mdlib/coupling.c
src/gromacs/mdlib/domdec.c
src/gromacs/options/optionsassigner.cpp
src/gromacs/selection/centerofmass.cpp
src/gromacs/selection/compiler.cpp
src/gromacs/selection/params.cpp
src/gromacs/selection/parsetree.cpp
src/gromacs/selection/poscalc.cpp
src/gromacs/selection/sm_insolidangle.cpp
src/gromacs/selection/sm_merge.cpp
src/gromacs/selection/sm_permute.cpp
src/gromacs/selection/sm_same.cpp
src/gromacs/selection/symrec.cpp
src/gromacs/trajectoryanalysis/cmdlinerunner.cpp
src/gromacs/trajectoryanalysis/modules/angle.cpp
src/tools/gmx_anaeig.c
src/tools/gmx_chi.c
src/tools/gmx_editconf.c

index edcab5819458549f772b3c340a0b12aa3eaa30de..b3593c521fbf70e40d7de79c57419f79630dc20c 100644 (file)
@@ -46,7 +46,8 @@ MACRO(gmx_c_flags)
         if(NOT GMX_OPENMP)
             GMX_TEST_CFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
         endif()
-        GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall -Wno-unused" GMXC_CXXFLAGS)
+        GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall -Wno-unused-function" GMXC_CXXFLAGS)
+        GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wnon-virtual-dtor -Wno-unused-parameter -Wsign-compare" GMXC_CXXFLAGS)
       # new in gcc 4.5
         GMX_TEST_CXXFLAG(CXXFLAGS_EXCESS_PREC "-fexcess-precision=fast" 
                           GMXC_CXXFLAGS)
@@ -126,6 +127,21 @@ MACRO(gmx_c_flags)
         GMX_TEST_CFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996" GMXC_CXXFLAGS)
     endif()
 
+    if (CMAKE_C_COMPILER_ID MATCHES "Clang")
+        if(NOT GMX_OPENMP)
+            GMX_TEST_CFLAG(CFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CFLAGS)
+        endif()
+        GMX_TEST_CFLAG(CFLAGS_WARN "-Wall -Wno-unused" GMXC_CFLAGS)
+    endif()
+
+    if (CMAKE_C_COMPILER_ID MATCHES "Clang")
+        if(NOT GMX_OPENMP)
+            GMX_TEST_CFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
+        endif()
+        GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall -Wno-unused-function" GMXC_CXXFLAGS)
+    endif()
+      
+
     # now actually set the flags:
     # C
     if ( NOT DEFINED GMXCFLAGS_SET AND NOT DEFINED ENV{CFLAGS} )
diff --git a/src/contrib/copyrgt.c b/src/contrib/copyrgt.c
deleted file mode 100644 (file)
index e301924..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * 
- *                This source code is part of
- * 
- *                 G   R   O   M   A   C   S
- * 
- *          GROningen MAchine for Chemical Simulations
- * 
- *                        VERSION 3.3.99_development_20071104
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2006, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- * 
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- * 
- * For more info, check our website at http://www.gromacs.org
- * 
- * And Hey:
- * Groningen Machine for Chemical Simulation
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "stdio.h"
-#include "stdlib.h"
-#include "macros.h"
-#include "string2.h"
-#include "futil.h"
-#include "copyrite.h"
-
-static char *head1[]= {
-  "",
-  "               This source code is part of",
-  "",
-  "                G   R   O   M   A   C   S",
-  "",
-  "         GROningen MAchine for Chemical Simulations",
-  ""
-};
-
-static char *head2[]= {
-  "This program is free software; you can redistribute it and/or",
-  "modify it under the terms of the GNU General Public License",
-  "as published by the Free Software Foundation; either version 2",
-  "of the License, or (at your option) any later version.",
-  "",
-  "If you want to redistribute modifications, please consider that",
-  "scientific software is very special. Version control is crucial -",
-  "bugs must be traceable. We will be happy to consider code for",
-  "inclusion in the official distribution, but derived work must not",
-  "be called official GROMACS. Details are found in the README & COPYING",
-  "files - if they are missing, get the official version at www.gromacs.org.",
-  "",
-  "To help us fund GROMACS development, we humbly ask that you cite",
-  "the papers on the package - you can find them in the top README file.",
-  "",
-  "For more info, check our website at http://www.gromacs.org",
-  "",
-  "And Hey:"
-};
-
-#define NH1 asize(head1)
-#define NCR asize(CopyrightText)
-#define NH2 asize(head2)
-#define MAXS 10240
-
-void head(FILE *out, char *fn_, gmx_bool bH,
-         char *cstart, char *ccont, char *cend)
-{
-  char buf[STRLEN];
-  int i;
-
-  fprintf(out,"%s\n",cstart);
-  /* NOTE: the "" are to mislead CVS so it will not replace by version info */
-  fprintf(out,"%s $""Id""$\n",ccont);
-  for(i=0; (i<NH1); i++)
-    fprintf(out,"%s %s\n",ccont,head1[i]);
-  fprintf(out,"%s                        %s\n",ccont,GromacsVersion());
-  for(i=0; (i<NCR); i++)
-    fprintf(out,"%s %s\n",ccont,CopyrightText[i]);
-  for(i=0; (i<NH2); i++)
-    fprintf(out,"%s %s\n",ccont,head2[i]);
-  bromacs(buf,STRLEN-1);
-  fprintf(out,"%s %s\n",ccont,buf);
-  fprintf(out,"%s\n",cend);
-  if (bH) {
-    fprintf(out,"\n");
-    fprintf(out,"#ifndef _%s\n",fn_);
-    fprintf(out,"#define _%s\n",fn_);
-    fprintf(out,"\n");
-  }
-}
-
-void cr_c(char *fn)
-{
-  FILE *in,*out;
-  char ofn[1024],line[MAXS+1],cwd[1024];
-  char *p,*fn_;
-  gmx_bool bH;
-  
-  sprintf(ofn,"%s.bak",fn);
-  
-  fprintf(stderr,"Processing %s (backed up to %s)\n",
-         fn,ofn);
-  
-  if (rename(fn,ofn) != 0) {
-    perror(ofn);
-    exit(1);
-  }
-  in=ffopen(ofn,"r");
-  out=ffopen(fn,"w");
-  
-  /* Skip over empty lines in the beginning only */
-  do { 
-    if (fgets2(line,MAXS,in))
-      rtrim(line); 
-  } while ((strlen(line) == 0) && (!feof(in)));
-  
-  /* Now we are at end of file, or we have a non-empty string */
-  if (strlen(line) != 0) {  
-    if (strstr(line,"/*") != NULL) {
-      /* File does start with comment, so delete it and add new */
-      while ((strstr(line,"*/") == NULL) && (!feof(in)))
-       fgets2(line,MAXS,in);
-    }
-    fn_=strdup(fn);
-    p=strchr(fn_,'.');
-    if (p)
-      p[0]='_';
-    bH=FALSE;
-    do {
-      fgets2(line,MAXS,in);
-      if ( (strstr(line,fn_) != NULL) && 
-          (strstr(line,"#define") != NULL) )
-       bH=TRUE;
-    } while ( ( (strstr(line,fn_) != NULL)  ||
-               (strlen(line)==0) ) && (!feof(in) ) );
-    getcwd(cwd,STRLEN);
-    head(out,fn_,bH,"/*"," *"," */");
-    do {
-      fprintf(out,"%s\n",line);
-    } while (!feof(in) && fgets2(line,MAXS,in));
-  }
-  ffclose(in);
-  ffclose(out);
-}
-
-void cr_other(char *fn)
-{
-
-  /* Doesnt work right now, so its commented out */
-  /*  FILE *in,*out;
-  char ofn[1024],line[MAXS+1],line2[MAXS+1],cwd[1024];
-  char *p,*fn_,*ptr;
-  gmx_bool bH;
-  
-  sprintf(ofn,"%s.bak",fn);
-  
-  fprintf(stderr,"Processing %s (backed up to %s)\n",fn,ofn);
-  
-  if (rename(fn,ofn) != 0) {
-    perror(ofn);
-    exit(1);
-  }
-  in=ffopen(ofn,"r");
-  out=ffopen(fn,"w");
-  */
-  /* Skip over empty lines in the beginning only */
-
-}
-
-void cr_tex(char *fn)
-{
-  FILE *in,*out;
-  char ofn[1024],line[MAXS+1];
-  char *p;
-  
-  sprintf(ofn,"%s.bak",fn);
-  
-  fprintf(stderr,"Processing (as Tex) %s (backed up to %s)\n",
-         fn,ofn);
-  
-  if (rename(fn,ofn) != 0) {
-    perror(ofn);
-    exit(1);
-  }
-  in=ffopen(ofn,"r");
-  out=ffopen(fn,"w");
-  
-  /* Skip over empty lines in the beginning only */
-  do
-    if (fgets2(line,MAXS,in))
-      rtrim(line);
-  while ((strlen(line) == 0) && (!feof(in)));
-  
-  /* Now we are at end of file, or we have a non-empty string */
-  if (strlen(line) != 0) {  
-    while ((strstr(line,"%") != NULL) && (!feof(in)))
-      /* File does start with comment, so delete it and add new */
-      fgets2(line,MAXS,in); 
-    head(out,"",FALSE,"%","%","%");
-    /* Skip over empty lines */
-    while ( (strlen(line) == 0) && !feof(in) )
-      if (fgets2(line,MAXS,in))
-       rtrim(line);
-    do
-      fprintf(out,"%s\n",line);
-    while (!feof(in) && fgets2(line,MAXS,in));
-  }
-  ffclose(in);
-  ffclose(out);
-}
-
-int main(int argc,char *argv[])
-{
-  int i;
-  char *fn,*p;
-  
-  for(i=1; (i<argc); i++) {
-    fn=argv[i];
-    p=strrchr(fn,'.');
-    if ( strcmp(p,".tex")==0 )
-      cr_tex(fn);
-    else if ((strcmp(p,".c") == 0) || (strcmp(p,".h") == 0))
-      cr_c(fn);
-    else
-      cr_other(fn);
-  }
-  return 0;
-}
index c86f736a4e037d33c398ef226782966b8b70f950..9c19c0b9973368588acbca055318ca3a83330a53 100644 (file)
@@ -370,7 +370,7 @@ void dump_as_pdb(char *pdb,t_ana_struct *anal)
     t = 1000*anal->t[i];
     fprintf(kp,"MODEL  %d  time %g fs\n",i+1,t);
     for(j=0; (j<anal->nparticle); j++) {
-      fprintf(kp,pdbformat,"ATOM",i+1,(j < anal->nion[i]) ? "O" : "N",
+      fprintf(kp,get_pdbformat(),"ATOM",i+1,(j < anal->nion[i]) ? "O" : "N",
              "PLS",' ',1,
              anal->x[i][j][XX]/100,
              anal->x[i][j][YY]/100,
index 8af05b29972e8bb0aad010d15e987e6f1bb12715..930bab5eb1b69c81e10c89febb611ea471d2bb74 100644 (file)
@@ -69,7 +69,6 @@ AbstractAnalysisData::Impl::presentData(AbstractAnalysisData *data,
     module->dataStarted(data);
     bool bCheckMissing = _bAllowMissing
         && !(module->flags() & AnalysisDataModuleInterface::efAllowMissing);
-    int ncol = data->columnCount();
     for (int i = 0; i < data->frameCount(); ++i)
     {
         AnalysisDataFrameRef frame = data->getDataFrame(i);
index 642546d6209da1e6b7894264adefaaee2f7c5302..8cd9370cb9cbdf5f2a4a04dce7e25f471111cced 100644 (file)
@@ -217,7 +217,6 @@ AnalysisDataDisplacementModule::frameFinished(const AnalysisDataFrameHeader & /*
     }
 
     int step, i;
-    int rc;
 
     if (_impl->nstored == 2)
     {
index 0c3e88105fb3fa2ed37364c3993e5ec320abe99a..c0abc9fbf6b15bdedc92e02dec7a8991ab6bf132 100644 (file)
@@ -229,7 +229,6 @@ AbstractAverageHistogram::resampleDoubleBinWidth(bool bIntegerBins) const
         nbins = rowCount() / 2;
     }
 
-    real minx = xstart();
     AverageHistogramPointer dest(
         new internal::StaticAverageHistogram(
             histogramFromBins(xstart(), nbins, 2*xstep())
index da538eac1dc5984137f1a26dd931dfda7c9e530e..b8cb89039a177733046f19587aea5271fd0a6d83 100644 (file)
@@ -216,6 +216,26 @@ void cool_quote(char *retstring, int retsize, int *cqnum)
 
 void CopyRight(FILE *out,const char *szProgram)
 {
+  static const char * CopyrightText[] = {
+             "Written by Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,",
+             "Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra, ",
+             "Gerrit Groenhof, Peter Kasson, Per Larsson, Pieter Meulenhoff, ",
+             "Teemu Murtola, Szilard Pall, Sander Pronk, Roland Schulz, ",
+             "Michael Shirts, Alfons Sijbers, Peter Tieleman,\n",
+             "Berk Hess, David van der Spoel, and Erik Lindahl.\n",
+             "Copyright (c) 1991-2000, University of Groningen, The Netherlands.",
+             "Copyright (c) 2001-2010, The GROMACS development team at",
+             "Uppsala University & The Royal Institute of Technology, Sweden.",
+             "check out http://www.gromacs.org for more information.\n"
+  };
+
+  static const char * GPLText[] = {
+              "This program is free software; you can redistribute it and/or",
+              "modify it under the terms of the GNU General Public License",
+              "as published by the Free Software Foundation; either version 2",
+              "of the License, or (at your option) any later version."
+  };
+
   /* Dont change szProgram arbitrarily - it must be argv[0], i.e. the 
    * name of a file. Otherwise, we won't be able to find the library dir.
    */
@@ -639,4 +659,5 @@ void gmx_print_version_info(FILE *fp)
 #else
     fprintf(fp, "FFT Library:      unknown\n");
 #endif
+
 }
index 36f1e8861ca27d404a8f8cf2e0d049369181c464..dd244cada4da37b3eee6e6b7685e901e5d5826c5 100644 (file)
@@ -302,18 +302,18 @@ char *pargs_print_line(t_pargs *pa,gmx_bool bLeadingSpace)
   else
     strcpy(buf,pa->option);
   desc = check_tty(pa->desc);
-  if (strlen(buf)>((OPTLEN+TYPELEN)-max(strlen(argtp[pa->type]),4))) {
+  if (strlen(buf)>((OPTLEN+TYPELEN)-max(strlen(get_arg_desc(pa->type)),4))) {
     sprintf(buf2,"%s%s %-6s %-6s  %-s\n",
            bLeadingSpace ? " " : "",buf,
-           argtp[pa->type],pa_val(pa,tmp,LONGSTR-1),desc);
+           get_arg_desc(pa->type),pa_val(pa,tmp,LONGSTR-1),desc);
   } else if (strlen(buf)>OPTLEN) {
     /* so type can be 3 or 4 char's, this fits in the %4s */
     sprintf(buf2,"%s%-14s %-4s %-6s  %-s\n",
-           bLeadingSpace ? " " : "",buf,argtp[pa->type],
+           bLeadingSpace ? " " : "",buf,get_arg_desc(pa->type),
            pa_val(pa,tmp,LONGSTR-1),desc);
   } else
     sprintf(buf2,"%s%-12s %-6s %-6s  %-s\n",
-           bLeadingSpace ? " " : "",buf,argtp[pa->type],
+           bLeadingSpace ? " " : "",buf,get_arg_desc(pa->type),
            pa_val(pa,tmp,LONGSTR-1),desc);
   sfree(desc);
   sfree(tmp);
index 33fb2078a0a51769ac5108bd33c4954bb080b070..933249b23869e2a1d57c2cc8e635e16ff47339dd 100644 (file)
@@ -324,9 +324,9 @@ void write_pdbfile_indexed(FILE *out,const char *title,
     else {
       /* Check whether atomname is an element name */
       if ((strlen(nm)<4) && (gmx_strcasecmp(nm,atoms->atom[i].elem) != 0))
-       strcpy(pdbform,pdbformat);
+       strcpy(pdbform,get_pdbformat());
       else {
-       strcpy(pdbform,pdbformat4);
+       strcpy(pdbform,get_pdbformat4());
        if (strlen(nm) > 4) {
          int maxwln=20;
          if (nlongname < maxwln) {
@@ -878,3 +878,15 @@ gmx_conect gmx_conect_generate(t_topology *top)
   }
   return gc;
 }
+
+const char* get_pdbformat()
+{
+    static const char *pdbformat ="%-6s%5u  %-4.4s%3.3s %c%4d%c   %8.3f%8.3f%8.3f";
+    return pdbformat;
+}
+
+const char* get_pdbformat4()
+{
+    static const char *pdbformat4="%-6s%5u %-4.4s %3.3s %c%4d%c   %8.3f%8.3f%8.3f";
+    return pdbformat4;
+}
index 4c51f10a80cdea832bc640db35d9bccac44394be..be89c2e078144d608c0a27a239f1cedb86600069 100644 (file)
@@ -431,14 +431,14 @@ static void write_texman(FILE *out,const char *program,
       if (strlen(check_tex(pa_val(&(pa[i]),tmp,255))) <= 8)
        fprintf(out,"\\> {\\tt %s} \\'\\> %s \\'\\> {\\tt %s} \\' "
                "\\parbox[t]{0.68\\linewidth}{%s}\\\\\n",
-               check_tex(pa[i].option),argtp[pa[i].type],
+               check_tex(pa[i].option),get_arg_desc(pa[i].type),
                check_tex(pa_val(&(pa[i]),tmp,255)),
                check_tex(pa[i].desc));
       else
        fprintf(out,"\\> {\\tt %s} \\'\\> %s \\'\\>\\\\\n"
                "\\> \\'\\> \\'\\> {\\tt %s} \\' "
                "\\parbox[t]{0.7\\linewidth}{%s}\\\\\n",
-               check_tex(pa[i].option),argtp[pa[i].type],
+               check_tex(pa[i].option),get_arg_desc(pa[i].type),
                check_tex(pa_val(&(pa[i]),tmp,255)),
                check_tex(pa[i].desc));
     }
@@ -487,7 +487,7 @@ static void write_nroffman(FILE *out,
        fprintf(out,".BI \"\\-[no]%s\" \"\"\n",check_nroff(pa[i].option+1));
       else
        fprintf(out,".BI \"%s\" \" %s \"\n",check_nroff(pa[i].option),
-               check_nroff(argtp[pa[i].type]));
+               check_nroff(get_arg_desc(pa[i].type)));
   }
   
   /* description */
@@ -520,7 +520,7 @@ static void write_nroffman(FILE *out,
       else
        fprintf(out,".BI \"%s\"  \" %s\" \" %s\" \n %s\n\n",
                check_nroff(pa[i].option),
-                check_nroff(argtp[pa[i].type]),
+                check_nroff(get_arg_desc(pa[i].type)),
                check_nroff(pa_val(&(pa[i]),tmp,255)),
                 check_nroff(pa[i].desc));
     }
@@ -766,7 +766,7 @@ static void write_htmlman(FILE *out,
              "<TD> %s </TD>"
              "</TD>\n",
              (pa[i].type == etBOOL)?"-[no]":"-",pa[i].option+1,
-             argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),NSR(pa[i].desc));
+             get_arg_desc(pa[i].type),pa_val(&(pa[i]),tmp,255),NSR(pa[i].desc));
     fprintf(out,"</TABLE>\n");
   }
   if (nbug > 0) {
@@ -855,9 +855,9 @@ static void write_xmlman(FILE *out,
              "\t<default-value>%s</default-value>\n"
              "\t<description>%s</description>\n"
              "</option>\n",
-             argtp[pa[i].type], is_hidden(&pa[i]),
+             get_arg_desc(pa[i].type), is_hidden(&pa[i]),
              pa[i].option+1,                  /* +1 - with no trailing '-' */
-             pa_val(&(pa[i]),buf,255),pa[i].desc); /*argtp[pa[i].type],*/
+             pa_val(&(pa[i]),buf,255),pa[i].desc); /*get_argtp()[pa[i].type],*/
     fprintf(out,"</options>\n");
   }
 
@@ -1109,3 +1109,9 @@ void write_man(FILE *out,const char *mantp,
   finish_linkdata(links);
 }
 
+const char *get_arg_desc(int type) {
+   static const char *argtp[etNR] = {
+     "int", "step", "real", "time", "string", "bool", "vector", "enum"
+   };
+   return argtp[type];
+}
index 487bdba60a758cc01b441236ae508c910a17e0ae..783ca95da28981a0e67f5f9d03430177abd54f82 100644 (file)
@@ -50,30 +50,6 @@ const char *GromacsVersion(void);
 void 
 gmx_print_version_info(FILE *fp);
   
-  
-static const char *
-CopyrightText[] = {
-  "Written by Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,",
-  "Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra, ",
-  "Gerrit Groenhof, Peter Kasson, Per Larsson, Pieter Meulenhoff, ",
-  "Teemu Murtola, Szilard Pall, Sander Pronk, Roland Schulz, ",
-  "Michael Shirts, Alfons Sijbers, Peter Tieleman,\n",
-  "Berk Hess, David van der Spoel, and Erik Lindahl.\n",
-  "Copyright (c) 1991-2000, University of Groningen, The Netherlands.",
-  "Copyright (c) 2001-2010, The GROMACS development team at",
-  "Uppsala University & The Royal Institute of Technology, Sweden.",
-  "check out http://www.gromacs.org for more information.\n"
-};
-
-static const char *
-GPLText[] = {
-  "This program is free software; you can redistribute it and/or",
-  "modify it under the terms of the GNU General Public License",
-  "as published by the Free Software Foundation; either version 2",
-  "of the License, or (at your option) any later version."
-};
-
-
 void
 pr_difftime(FILE *out,double dt);
 
index 5d29e53487d44b4a68135437084e657ab22d37d4..0f64b63579fa078108f2b926fe5f632506e8ecef 100644 (file)
@@ -64,37 +64,6 @@ extern "C" {
 #ifndef M_1_PI
 #define M_1_PI      0.31830988618379067154
 #endif
-    
-/* Suzuki-Yoshida Constants, for n=3 and n=5, for symplectic integration  */
-/* for n=1, w0 = 1 */
-/* for n=3, w0 = w2 = 1/(2-2^-(1/3)), w1 = 1-2*w0 */
-/* for n=5, w0 = w1 = w3 = w4 = 1/(4-4^-(1/3)), w1 = 1-4*w0 */
-    
-#define MAX_SUZUKI_YOSHIDA_NUM 5
-#define SUZUKI_YOSHIDA_NUM  5
-
-static const double sy_const_1[] = { 1. };
-static const double sy_const_3[] = { 0.828981543588751,-0.657963087177502,0.828981543588751 };
-static const double sy_const_5[] = { 0.2967324292201065,0.2967324292201065,-0.186929716880426,0.2967324292201065,0.2967324292201065 };
-
-static const double* sy_const[] = {
-    NULL,
-    sy_const_1,
-    NULL,
-    sy_const_3,
-    NULL,
-    sy_const_5
-};
-
-/*
-static const double sy_const[MAX_SUZUKI_YOSHIDA_NUM+1][MAX_SUZUKI_YOSHIDA_NUM+1] = {
-    {},
-    {1},
-    {},
-    {0.828981543588751,-0.657963087177502,0.828981543588751},
-    {},
-    {0.2967324292201065,0.2967324292201065,-0.186929716880426,0.2967324292201065,0.2967324292201065}
-};*/
 
 int            gmx_nint(real a);
 real    sign(real x,real y);
index 092451805f6f6dd2221165a302be1e320fd0130a..f1dfd8fb9093aa341e241b86c9f70814a534ee7a 100644 (file)
@@ -48,8 +48,8 @@ extern "C" {
 typedef struct gmx_conect_t *gmx_conect;
 
 /* THE pdb format (for ATOM/HETATOM lines) */
-static const char *pdbformat ="%-6s%5u  %-4.4s%3.3s %c%4d%c   %8.3f%8.3f%8.3f";
-static const char *pdbformat4="%-6s%5u %-4.4s %3.3s %c%4d%c   %8.3f%8.3f%8.3f";
+const char* get_pdbformat(void);
+const char* get_pdbformat4(void);
 
 /* Enumerated type for pdb records. The other entries are ignored
  * when reading a pdb file 
index f3599d95a97eb1f9e591b6b7579aa8e021fb3e7b..e8bef133d57702d40594ae1c7d6117d07e39e37d 100644 (file)
@@ -115,10 +115,8 @@ enum {
   etINT, etGMX_LARGE_INT, etREAL, etTIME, etSTR,    etBOOL, etRVEC,   etENUM, etNR
 };
 
-/* names to print in help info */
-static const char *argtp[etNR] = {
-  "int", "step", "real", "time", "string", "bool", "vector", "enum" 
-};
+/* name to print in help info for command line arguments (defined in enum above) */
+const char *get_arg_desc(int type);
 
 typedef struct {
   const char *option;
index 9550ba59e332c855e6166757943f92ebebe02e00..c4a83b8dc01f5c666d5fbfd2bfd9a013b617fbfe 100644 (file)
@@ -224,7 +224,7 @@ static void write_constr_pdb(const char *fn,const char *title,
     {
         sprintf(fname,"%s.pdb",fn);
     }
-    sprintf(format,"%s\n",pdbformat);
+    sprintf(format,"%s\n",get_pdbformat());
     
     out = gmx_fio_fopen(fname,"w");
     
index feb2bdeb47cdddfb6619b03b5af0af12079ce158..ec8b8fe9d1b7aa551576a488ba2de4edc5d623e7 100644 (file)
 
 #define NTROTTERPARTS 3
 
+/* Suzuki-Yoshida Constants, for n=3 and n=5, for symplectic integration  */
+/* for n=1, w0 = 1 */
+/* for n=3, w0 = w2 = 1/(2-2^-(1/3)), w1 = 1-2*w0 */
+/* for n=5, w0 = w1 = w3 = w4 = 1/(4-4^-(1/3)), w1 = 1-4*w0 */
+
+#define MAX_SUZUKI_YOSHIDA_NUM 5
+#define SUZUKI_YOSHIDA_NUM  5
+
+static const double sy_const_1[] = { 1. };
+static const double sy_const_3[] = { 0.828981543588751,-0.657963087177502,0.828981543588751 };
+static const double sy_const_5[] = { 0.2967324292201065,0.2967324292201065,-0.186929716880426,0.2967324292201065,0.2967324292201065 };
+
+static const double* sy_const[] = {
+    NULL,
+    sy_const_1,
+    NULL,
+    sy_const_3,
+    NULL,
+    sy_const_5
+};
+
+/*
+static const double sy_const[MAX_SUZUKI_YOSHIDA_NUM+1][MAX_SUZUKI_YOSHIDA_NUM+1] = {
+    {},
+    {1},
+    {},
+    {0.828981543588751,-0.657963087177502,0.828981543588751},
+    {},
+    {0.2967324292201065,0.2967324292201065,-0.186929716880426,0.2967324292201065,0.2967324292201065}
+};*/
+
 /* these integration routines are only referenced inside this file */
 static void NHC_trotter(t_grpopts *opts,int nvar, gmx_ekindata_t *ekind,real dtfull,
                         double xi[],double vxi[], double scalefac[], real *veta, t_extmass *MassQ, gmx_bool bEkinAveVel)
index 6aa09c9af736d5e94aceef7033704bd315878742..f30c64b9f5a177b3eaff1a92f4fab6538e8608c5 100644 (file)
@@ -1871,7 +1871,7 @@ static void write_dd_grid_pdb(const char *fn,gmx_large_int_t step,
             }
         }
         sprintf(fname,"%s_%s.pdb",fn,gmx_step_str(step,buf));
-        sprintf(format,"%s%s\n",pdbformat,"%6.2f%6.2f");
+        sprintf(format,"%s%s\n",get_pdbformat(),"%6.2f%6.2f");
         out = gmx_fio_fopen(fname,"w");
         gmx_write_pdb_box(out,dd->bScrewPBC ? epbcSCREW : epbcXYZ,box);
         a = 1;
@@ -1935,8 +1935,8 @@ void write_dd_pdb(const char *fn,gmx_large_int_t step,const char *title,
     
     sprintf(fname,"%s_%s_n%d.pdb",fn,gmx_step_str(step,buf),cr->sim_nodeid);
     
-    sprintf(format,"%s%s\n",pdbformat,"%6.2f%6.2f");
-    sprintf(format4,"%s%s\n",pdbformat4,"%6.2f%6.2f");
+    sprintf(format,"%s%s\n",get_pdbformat(),"%6.2f%6.2f");
+    sprintf(format4,"%s%s\n",get_pdbformat4(),"%6.2f%6.2f");
     
     out = gmx_fio_fopen(fname,"w");
     
index 95f8ec9a2c56dbaecdd3e1f70d07d54c487583e8..6019fbd5b1c268c66685334c7e050d4261b1c7e3 100644 (file)
@@ -118,7 +118,6 @@ OptionsAssigner::Impl::findOption(const char *name)
             }
             if (searchList.empty() && root != &_options)
             {
-                Options *oldRoot = root;
                 root = root->_impl->_parent;
                 ++upcount;
                 searchList.push_back(root);
index 49730d667e021a0dcdf3afd7e50e4ce45479c725..79dbdd666aa714869d1f437478b9c0fa7d4fd454 100644 (file)
@@ -56,7 +56,7 @@
 int
 gmx_calc_cog(t_topology *top, rvec x[], int nrefat, atom_id index[], rvec xout)
 {
-    int                 m, j, ai;
+    int                 m, ai;
 
     clear_rvec(xout);
     for (m = 0; m < nrefat; ++m)
index 0867d277eb7e38603c4ccc96abb1c23e66fed585..b9acf9449e64fa02c36d8aa139d61555951ec9c3 100644 (file)
@@ -2019,7 +2019,6 @@ evaluate_boolean_minmax_grps(t_selelem *sel, gmx_ana_index_t *g,
 static void
 analyze_static(gmx_sel_evaluate_t *data, t_selelem *sel, gmx_ana_index_t *g)
 {
-    t_selelem       *child, *next;
     bool             bDoMinMax;
 
     if (sel->type != SEL_ROOT && g)
index 7e86d53b6c4e9a25a740fd80104f825ba521ad8c..3acd8151828ddad74bf78c0454b83b7145049929 100644 (file)
@@ -695,7 +695,6 @@ parse_values_varnum_expr(int nval, t_selexpr_value *values,
 {
     t_selexpr_value    *value;
     t_selelem          *child;
-    t_selelem          *expr;
 
     if (nval != 1 || !values->bExpr)
     {
index 44b156d1ba3f144f48997a19d2a7cf9871f5824f..927512acce048f1bc82c721bb8b276ce768d1c44 100644 (file)
@@ -555,8 +555,6 @@ void
 _gmx_selelem_set_method(t_selelem *sel, gmx_ana_selmethod_t *method,
                         yyscan_t scanner)
 {
-    int      i;
-
     _gmx_selelem_set_vtype(sel, method->type);
     sel->name   = method->name;
     snew(sel->u.expr.method, 1);
@@ -662,7 +660,6 @@ _gmx_sel_init_comparison(t_selelem *left, t_selelem *right, char *cmpop,
     t_selelem         *sel;
     t_selexpr_param   *params, *param;
     const char        *name;
-    int                rc;
 
     gmx::MessageStringCollector *errors = _gmx_sel_lexer_error_reporter(scanner);
     gmx::MessageStringContext  context(errors, "In comparison initialization");
@@ -858,7 +855,6 @@ _gmx_sel_init_modifier(gmx_ana_selmethod_t *method, t_selexpr_param *params,
     t_selelem         *root;
     t_selelem         *mod;
     t_selexpr_param   *vparam;
-    int                i;
 
     gmx::MessageStringCollector *errors = _gmx_sel_lexer_error_reporter(scanner);
     char  buf[128];
@@ -1077,7 +1073,6 @@ _gmx_sel_init_variable_ref(t_selelem *sel)
 t_selelem *
 _gmx_sel_init_selection(char *name, t_selelem *sel, yyscan_t scanner)
 {
-    gmx_ana_selcollection_t *sc = _gmx_sel_lexer_selcollection(scanner);
     t_selelem               *root;
     int                      rc;
 
index 44cbf43e96cc9c2e45cbd6adcec517d7d9bc76e3..d7889d5610023b98d6e01f485b5df6cb850defc1 100644 (file)
@@ -797,7 +797,7 @@ merge_to_base(gmx_ana_poscalc_t *base, gmx_ana_poscalc_t *pc)
 {
     gmx_ana_index_t  gp, gb, g;
     int              isize, bnr;
-    int              i, j, bi, bj, bo;
+    int              i, bi, bj, bo;
 
     base->flags |= pc->flags & (POS_VELOCITIES | POS_FORCES);
     gmx_ana_index_set(&gp, pc->b.nra, pc->b.a, NULL, 0);
@@ -1023,7 +1023,6 @@ gmx_ana_poscalc_create_enum(gmx_ana_poscalc_t **pcp, gmx_ana_poscalc_coll_t *pcc
 {
     e_poscalc_t  type;
     int          cflags;
-    int          rc;
 
     cflags = flags;
     *pcp = NULL;
@@ -1276,7 +1275,7 @@ void
 gmx_ana_poscalc_update(gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p,
                        gmx_ana_index_t *g, t_trxframe *fr, t_pbc *pbc)
 {
-    int  i, j, bi, bj;
+    int  i, bi, bj;
     
     if (pc->bEval == true && !(pc->flags & POS_MASKONLY))
     {
index 3b83825d78d52b05dab30de6d8e6dc417ee94fd0..19bae2e65335373f4b900cdd44a89b771576a941 100644 (file)
@@ -477,7 +477,6 @@ static void
 evaluate_insolidangle(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                       gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void *data)
 {
-    t_methoddata_insolidangle *d = (t_methoddata_insolidangle *)data;
     int                        b;
 
     out->u.g->isize = 0;
@@ -830,7 +829,7 @@ store_surface_point(t_methoddata_insolidangle *surf, rvec x)
     real theta, phi;
     real pdeltamax, tmax;
     real theta1, theta2, pdelta1, pdelta2;
-    int  tbin, pbin, bin;
+    int  tbin;
 
     theta = acos(x[ZZ]);
     phi = atan2(x[YY], x[XX]);
index 95073d54111fe841fe93633cd9ffe767a856d159..05eea6f93e06f3f348ea82668bcf26ba7d53ae41 100644 (file)
@@ -184,7 +184,6 @@ static void
 init_merge(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
 {
     t_methoddata_merge *d = (t_methoddata_merge *)data;
-    int                 i;
 
     if (d->stride < 0)
     {
index d8372c54469d7fec7e4325bf72892966286da67a..4b08ca9048092084cb37537da3adcc3cf8f07ac8 100644 (file)
@@ -190,7 +190,7 @@ static void
 init_output_permute(t_topology *top, gmx_ana_selvalue_t *out, void *data)
 {
     t_methoddata_permute *d = (t_methoddata_permute *)data;
-    int                   i, j, b, k;
+    int                   i, j, b;
 
     gmx_ana_pos_copy(out->u.p, &d->p, true);
     gmx_ana_pos_set_evalgrp(out->u.p, &d->g);
@@ -237,7 +237,7 @@ evaluate_permute(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                  gmx_ana_pos_t *p, gmx_ana_selvalue_t *out, void *data)
 {
     t_methoddata_permute *d = (t_methoddata_permute *)data;
-    int                   i, j, b, k;
+    int                   i, j, b;
     int                   refid;
 
     if (d->p.nr % d->n != 0)
index 45d2484a387108ff02570b2a0f464f686fd66451..9094ef8eceaf4c169bed218f548d8c8e8d968f0e 100644 (file)
@@ -495,7 +495,7 @@ evaluate_same_str(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                   gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
 {
     t_methoddata_same *d = (t_methoddata_same *)data;
-    int                    i, j;
+    int                    j;
 
     out->u.g->isize = 0;
     j = 0;
index d837f5f0372699bfab9252225977c7a7d80eea00..c0bd9edd33cb0a761a9c14d00cd6c90a7e4dd0fd 100644 (file)
@@ -396,7 +396,6 @@ static gmx_sel_symrec_t *
 add_symbol(gmx_sel_symtab_t *tab, const char *name, e_symbol_t *ctype)
 {
     gmx_sel_symrec_t *sym, *psym;
-    int               len;
 
     /* Check if there is a conflicting symbol */
     psym = NULL;
index e68bac37f2cbb0ce2a52208ece14451e54915fd9..20bab5bde30150f45e23fc0adbd58e19166a79d5 100644 (file)
@@ -200,7 +200,6 @@ int
 TrajectoryAnalysisCommandLineRunner::run(int argc, char *argv[])
 {
     TrajectoryAnalysisModule *module = _impl->_module;
-    int                       rc;
 
     CopyRight(stderr, argv[0]);
 
index fc3d016d5f1f40c8e60b9c44e381a9d75d82655e..690b65bbb8f5cb780be9979d178eb6a202bb1ea6 100644 (file)
@@ -547,6 +547,7 @@ Angle::analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc,
                     GMX_THROW(InternalError("invalid -g1 value"));
             }
             angle *= RAD2DEG;
+            /* TODO: add support for -od and -dumpd 
             real dist = 0.0;
             if (_bDumpDist)
             {
@@ -561,6 +562,7 @@ Angle::analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc,
                     dist = sqrt(distance2(c1, c2));
                 }
             }
+            */
             if (_bAll)
             {
                 dh.setPoint(n + 1, angle);
index 4c2e3fa949457178214589ee97a3f75d5408a973..200dbf833993b5f6769b9d976f99f97be95b1c35 100644 (file)
@@ -588,7 +588,7 @@ static void project(const char *trajfile,t_topology *top,int ePBC,matrix topbox,
        b[i]  =inprod[3][i];
     }
     if ( ( b4D || bSplit ) && bPDB ) {
-      strcpy(pdbform,pdbformat);
+      strcpy(pdbform,get_pdbformat());
       strcat(pdbform,"%8.4f%8.4f\n");
       
       out=ffopen(threedplotfile,"w");
index 60ebc2901306767e5796a384bb400adc9ea791a2..edfbe6b61cf335579fc7b59302780607b13b08dc 100644 (file)
@@ -975,7 +975,7 @@ static void order_params(FILE *log,
     x0*=10.0;/* nm -> angstrom */
     y0*=10.0;/* nm -> angstrom */
     z0*=10.0;/* nm -> angstrom */
-    sprintf(buf,"%s%%6.f%%6.2f\n",pdbformat);
+    sprintf(buf,"%s%%6.f%%6.2f\n",get_pdbformat());
     for (i=0; (i<10); i++) {
       fprintf(fp,buf,"ATOM  ", atoms->nr+1+i, "CA", "LEG",' ', 
              atoms->nres+1, ' ',x0, y0, z0+(1.2*i), 0.0, -0.1*i);
index 7d33eb4a251442bd3068a21697e0e9a4d0363a2b..8d508a65d09d61bf811a5cd70213b19c2f7e391e 100644 (file)
@@ -379,7 +379,7 @@ void visualize_box(FILE *out, int a0, int r0, matrix box, rvec gridsize)
 
         for (i = 0; i < nat; i++)
         {
-            fprintf(out, pdbformat, "ATOM", a0 + i, "C", "BOX", 'K' + i
+            fprintf(out, get_pdbformat(), "ATOM", a0 + i, "C", "BOX", 'K' + i
                 / NCUCVERT, r0 + i, 10 * vert[i][XX], 10 * vert[i][YY], 10
                 * vert[i][ZZ]);
             fprintf(out, "\n");
@@ -400,7 +400,7 @@ void visualize_box(FILE *out, int a0, int r0, matrix box, rvec gridsize)
             for (y = 0; y <= 1; y++)
                 for (x = 0; x <= 1; x++)
                 {
-                    fprintf(out, pdbformat, "ATOM", a0 + i, "C", "BOX", 'K' + i
+                    fprintf(out, get_pdbformat(), "ATOM", a0 + i, "C", "BOX", 'K' + i
                         / 8, r0 + i, x * 10 * box[XX][XX],
                             y * 10 * box[YY][YY], z * 10 * box[ZZ][ZZ]);
                     fprintf(out, "\n");