Fix clang 3.2 warnings.
authorTeemu Murtola <teemu.murtola@gmail.com>
Fri, 27 Jul 2012 17:39:50 +0000 (20:39 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Fri, 27 Jul 2012 17:39:50 +0000 (20:39 +0300)
Majority of these were false positives, but the fixes were simple.
Took the simplest route with gtest and edited the source.  We just need
to fix this thing again if/when we update to a newer version if it isn't
fixed upstream.

Change-Id: I5007d26ac9f38c61d5f0258d5bd4ccb7c08f4336

src/external/gmock-1.6.0/gtest/src/gtest-internal-inl.h
src/gromacs/options/tests/abstractoptionstorage.cpp
src/programs/mdrun/genalg.c
src/tools/gmx_h2order.c
src/tools/gmx_sorient.c

index 65a2101a4d8194a4fea7709240579b9e535c35aa..6554cfc07e619a79971822f7c6693e8fedaf4281 100644 (file)
@@ -203,7 +203,6 @@ class GTestFlagSaver {
   bool list_tests_;
   String output_;
   bool print_time_;
-  bool pretty_;
   internal::Int32 random_seed_;
   internal::Int32 repeat_;
   bool shuffle_;
index f6b7c998648429ef75b0bd30dfe6be1b62be2b5f..89350f19912926ca831c42dc158e2ced683433ea 100644 (file)
@@ -196,11 +196,11 @@ TEST(AbstractOptionStorageTest, HandlesValueRemoval)
 {
     gmx::Options                options(NULL, NULL);
     std::vector<std::string>    values;
-    MockOptionStorage          *mock;
+    MockOptionStorage          *mock = NULL;
     ASSERT_NO_THROW(options.addOption(
                         MockOption("name").storageObject(&mock)
                             .storeVector(&values).multiValue()));
-
+    ASSERT_TRUE(mock != NULL);
     {
         ::testing::InSequence dummy;
         using ::testing::ElementsAre;
@@ -237,7 +237,7 @@ TEST(AbstractOptionStorageTest, HandlesValueAddition)
 {
     gmx::Options                options(NULL, NULL);
     std::vector<std::string>    values;
-    MockOptionStorage          *mock=NULL;
+    MockOptionStorage          *mock = NULL;
     ASSERT_NO_THROW(options.addOption(
                         MockOption("name").storageObject(&mock)
                             .storeVector(&values).multiValue()));
@@ -279,7 +279,7 @@ TEST(AbstractOptionStorageTest, HandlesTooManyValueAddition)
 {
     gmx::Options                options(NULL, NULL);
     std::vector<std::string>    values;
-    MockOptionStorage          *mock=NULL;
+    MockOptionStorage          *mock = NULL;
     ASSERT_NO_THROW(options.addOption(
                         MockOption("name").storageObject(&mock)
                             .storeVector(&values).valueCount(2)));
@@ -317,11 +317,11 @@ TEST(AbstractOptionStorageTest, AllowsEmptyValues)
 {
     gmx::Options                options(NULL, NULL);
     std::vector<std::string>    values;
-    MockOptionStorage          *mock;
+    MockOptionStorage          *mock = NULL;
     ASSERT_NO_THROW(options.addOption(
                         MockOption("name").storageObject(&mock)
                             .storeVector(&values).valueCount(0)));
-
+    ASSERT_TRUE(mock != NULL);
     {
         ::testing::InSequence dummy;
         using ::testing::DoAll;
index 864de3926dd6c69e52432013560e73c3f0699f8d..4ab2853c7afd00cd667a6dc201bcc93ab0e47d46 100644 (file)
@@ -126,7 +126,7 @@ t_genalg *init_ga(FILE *fplog,const char *infile,int D,t_range range[])
 {
   FILE     *fpin_ptr;
   t_genalg *ga;
-  double   ff,cr;
+  double   ff = 0.0, cr = 0.0;
   int      i,j;
   
   /*------Initializations----------------------------*/
index e495b618620403606c43f000e56707c1bcd961af..3e9ec4f50ad5a16239a48802eab12ab954877039 100644 (file)
@@ -279,11 +279,11 @@ int gmx_h2order(int argc,char *argv[])
   char      *grpname,                      /* groupnames                 */
             *micname;
   int       ngx,                            /* nr. of atomsin sol group   */
-            nmic;                           /* nr. of atoms in micelle    */
+            nmic = 0;                       /* nr. of atoms in micelle    */
   t_topology *top;                         /* topology                   */ 
   int       ePBC;
   atom_id    *index,                       /* indices for solvent group  */
-             *micelle;
+             *micelle = NULL;
   gmx_bool       bMicel =  FALSE;               /* think we're a micel        */
   t_filenm  fnm[] = {                      /* files for g_order          */
     { efTRX, "-f", NULL,  ffREAD },                /* trajectory file            */
index 8df2b4fcb8c0e8aba52fc250759ff33cfee0424a..7278490aba740cacf45e3f9bef8c9c07c00e3720 100644 (file)
@@ -97,7 +97,7 @@ static void calc_com_pbc(int nrefat,t_topology *top,rvec x[],t_pbc *pbc,
 int gmx_sorient(int argc,char *argv[])
 {
   t_topology top;
-  int      ePBC;
+  int      ePBC = -1;
   char     title[STRLEN];
   t_trxstatus *status;
   int      natoms;