clang: undefined-reinterpret-cast, comma, extra-semi
authorRoland Schulz <roland.schulz@intel.com>
Fri, 6 Jul 2018 03:46:17 +0000 (20:46 -0700)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 11 Jul 2018 21:14:55 +0000 (23:14 +0200)
Change-Id: I8581f68ea62f34818c856e9ff2809f087e352dec

26 files changed:
src/gromacs/CMakeLists.txt
src/gromacs/analysisdata/datamodule.h
src/gromacs/awh/biasstate.h
src/gromacs/awh/coordstate.h
src/gromacs/awh/correlationgrid.h
src/gromacs/awh/correlationtensor.h
src/gromacs/awh/dimparams.h
src/gromacs/awh/histogramsize.h
src/gromacs/awh/pointstate.h
src/gromacs/commandline/cmdlinehelpmodule.cpp
src/gromacs/domdec/domdec_internal.h
src/gromacs/gmxana/anadih.cpp
src/gromacs/gmxana/gmx_clustsize.cpp
src/gromacs/gmxana/gmx_enemat.cpp
src/gromacs/gmxana/gmx_mdmat.cpp
src/gromacs/gmxana/gmx_rmsdist.cpp
src/gromacs/gmxana/hxprops.cpp
src/gromacs/hardware/cpuinfo.cpp
src/gromacs/mdlib/repl_ex.h
src/gromacs/mdlib/simulationsignal.h
src/gromacs/mdtypes/iforceprovider.h
src/gromacs/pulling/pull_internal.h
src/gromacs/simd/simd.h
src/gromacs/topology/block.h
src/gromacs/trajectoryanalysis/modules/freevolume.cpp
src/gromacs/utility/stringstream.h

index f1e7baba5e62a6c3e9f1363234d3252fac0651e0..4ed2e40d6dce846dd5a8a26875d1de0b172e3147 100644 (file)
@@ -280,14 +280,11 @@ set(IGNORED_CLANG_ALL_WARNINGS
     #Following ones are undecided/TODO
     "-Wno-disabled-macro-expansion"
     "-Wno-cast-align"
-    "-Wno-undefined-reinterpret-cast"
     "-Wno-reserved-id-macro"
     "-Wno-global-constructors"
-    "-Wno-comma"
     "-Wno-exit-time-destructors"
     "-Wno-unused-macros"
     "-Wno-weak-vtables"
-    "-Wno-extra-semi"
     "-Wno-conditional-uninitialized"
     "-Wno-format-nonliteral"
     "-Wno-shadow"
index 255f00a2c57e2ac8c5368a112381c625ef7dddd6..e3113d226150c7d5829d4b005e144adc7098611a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -98,7 +98,7 @@ class IAnalysisDataModule
             efAllowMultipleDataSets     = 1<<4
         };
 
-        virtual ~IAnalysisDataModule() {};
+        virtual ~IAnalysisDataModule() {}
 
         /*! \brief
          * Returns properties supported by the module.
index b4750e4708243a25362269d4d8aaa023b04f69e9..92f320bd4e31e84e1d2de33413d808965bd5e4a2 100644 (file)
@@ -379,7 +379,7 @@ class BiasState
                            const awh_dvec  coordValue)
         {
             coordState_.setCoordValue(grid, coordValue);
-        };
+        }
 
         /*! \brief
          * Performs an update of the bias.
@@ -497,28 +497,28 @@ class BiasState
         const CoordState &coordState() const
         {
             return coordState_;
-        };
+        }
 
         /*! \brief Returns a const reference to the point state.
          */
         const std::vector<PointState> &points() const
         {
             return points_;
-        };
+        }
 
         /*! \brief Returns true if we are in the initial stage.
          */
         bool inInitialStage() const
         {
             return histogramSize_.inInitialStage();
-        };
+        }
 
         /*! \brief Returns the current histogram size.
          */
         inline HistogramSize histogramSize() const
         {
             return histogramSize_;
-        };
+        }
 
         /* Data members */
     private:
index 3df240ac1d30545929231ce29193a9c0d81dd203..55a0faeead3c947ed2731309985f4ed3f9cb3fb8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -120,7 +120,7 @@ class CoordState
         const awh_dvec &coordValue() const
         {
             return coordValue_;
-        };
+        }
 
         /*! \brief Returns the grid point index for the current coordinate value.
          */
@@ -134,7 +134,7 @@ class CoordState
         int umbrellaGridpoint() const
         {
             return umbrellaGridpoint_;
-        };
+        }
 
     private:
         awh_dvec coordValue_;        /**< Current coordinate value in (nm or rad) */
index ca6088c22938ba7482e84e51b0cb991288fd0590..ecfb5288d7684b76714a79f83afa9f20bde727c9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -105,7 +105,7 @@ class CorrelationGrid
                      double                       t)
         {
             tensors_[pointIndex].addData(weight, data, blockLengthMeasure == BlockLengthMeasure::Weight, t);
-        };
+        }
 
         /*! \brief Restores the correlation grid state from the correlation grid history.
          *
index 5e743138f73ddada5a4f690b22e4b75579e17cb5..0072d49b944a97c1056e3b42c80a29f1c13a4c81 100644 (file)
@@ -74,7 +74,7 @@ class CorrelationBlockData
                 blockSumWeightX(0),
                 sumOverBlocksBlockWeightBlockWeightX(0)
             {
-            };
+            }
 
             double blockSumWeightX;                      /**< Weighted sum of x for current block. */
             double sumOverBlocksBlockWeightBlockWeightX; /**< Sum over all blocks in the simulation of block weight times sum_wx. */
@@ -96,7 +96,7 @@ class CorrelationBlockData
             coordData_(numDim),
             correlationIntegral_(numDim*(numDim + 1)/2)
         {
-        };
+        }
 
         /*! \brief Restore the state from history.
          *
@@ -125,7 +125,7 @@ class CorrelationBlockData
             {
                 coordData_[d].blockSumWeightX += weight*data[d];
             }
-        };
+        }
 
         /*! \brief Adds a filled data block to correlation time integral.
          */
@@ -135,37 +135,37 @@ class CorrelationBlockData
         double blockSumWeight() const
         {
             return blockSumWeight_;
-        };
+        }
 
         /*! \brief Returns the sum weights^2 for current block. */
         double blockSumSquareWeight() const
         {
             return blockSumSquareWeight_;
-        };
+        }
 
         /*! \brief Returns the sum over blocks of block weight^2. */
         double sumOverBlocksSquareBlockWeight() const
         {
             return sumOverBlocksSquareBlockWeight_;
-        };
+        }
 
         /*! \brief Returns the sum over blocks of weight^2. */
         double sumOverBlocksBlockSquareWeight() const
         {
             return sumOverBlocksBlockSquareWeight_;
-        };
+        }
 
         /*! \brief Returns the length of each block used for block averaging. */
         double blockLength() const
         {
             return blockLength_;
-        };
+        }
 
         /*! \brief Double the length of each block used for block averaging. */
         void doubleBlockLength()
         {
             blockLength_ *= 2;
-        };
+        }
 
         /*! \brief Return the last block index data was added to (needed only for block length in terms of time). */
         int previousBlockIndex() const
@@ -186,13 +186,13 @@ class CorrelationBlockData
         const std::vector<CoordData> &coordData() const
         {
             return coordData_;
-        };
+        }
 
         /*! \brief Return the correlation integral tensor. */
         const std::vector<double> &correlationIntegral() const
         {
             return correlationIntegral_;
-        };
+        }
 
     private:
         /* Weight sum data, indentical for all dimensions */
@@ -256,7 +256,7 @@ class CorrelationTensor
         {
             /* The last blockdata has only 1 block containing all data */
             return blockDataList().back().blockSumWeight();
-        };
+        }
 
         /*! \brief Restore a correlation element from history.
          *
index 8abf5aa5c924ee004f4ba749ec30f58368356038..303dd32f18d34f9794a5bd3a1856dd5568d8810f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -84,7 +84,7 @@ struct DimParams
         betak(beta*forceConstant),
         userCoordUnitsToInternal(conversionFactor)
     {
-    };
+    }
 
     /*! \brief Convert internal coordinate units to external, user coordinate units.
      *
index 8145e5408275616b69eb8dd7ae3385551f867160..4ad7bcdc11fee3e0e88ec9a007814ddf94657e51 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -146,7 +146,7 @@ class HistogramSize
         int numUpdates() const
         {
             return numUpdates_;
-        };
+        }
 
         /*! \brief Increments the number of updates by 1.
          */
@@ -160,7 +160,7 @@ class HistogramSize
         double histogramSize() const
         {
             return histogramSize_;
-        };
+        }
 
         /*! \brief Sets the histogram size.
          *
@@ -175,14 +175,14 @@ class HistogramSize
         bool inInitialStage() const
         {
             return inInitialStage_;
-        };
+        }
 
         /*! \brief Returns The log of the current sample weight, scaled because of the histogram rescaling.
          */
         double logScaledSampleWeight() const
         {
             return logScaledSampleWeight_;
-        };
+        }
 
     private:
         gmx_int64_t numUpdates_; /**< The number of updates performed since the start of the simulation. */
index 288c8da7bf59909ab566b0a390a30c2765aea9d5..5f8a5d17655a48705a41c69e3bf9e97f2afc4da5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -94,7 +94,7 @@ class PointState
                        numVisitsIteration_(0),
                        numVisitsTot_(0)
         {
-        };
+        }
 
         /*! \brief
          * Set all values in the state to those from a history.
index da8043a3ca27e19187ef7589d52ba40b6837a980..dba1408a969c74ef316816ee9aaaaba01b29582f 100644 (file)
@@ -182,7 +182,7 @@ class IHelpExport
         //! Shorthand for a list of modules contained in a group.
         typedef CommandLineModuleGroupData::ModuleList ModuleGroupContents;
 
-        virtual ~IHelpExport() {};
+        virtual ~IHelpExport() {}
 
         /*! \brief
          * Called once before exporting individual modules.
index 9e9ecffe39914541b5f273b7891d80981ec45bf5..16bb545212bc4a05679c465a83c4a4b542e6db5d 100644 (file)
@@ -180,19 +180,19 @@ class DDAtomRanges
             {
                 return end_[static_cast<int>(rangeType) - 1];
             }
-        };
+        }
 
         /*! \brief Returns the end atom index for range \p rangeType */
         int end(Type rangeType) const
         {
             return end_[static_cast<int>(rangeType)];
-        };
+        }
 
         /*! \brief Returns the number of home atoms */
         int numHomeAtoms() const
         {
             return end_[static_cast<int>(Type::Home)];
-        };
+        }
 
         /*! \brief Returns the total number of atoms */
         int numAtomsTotal() const
@@ -217,7 +217,7 @@ class DDAtomRanges
             }
 
             lastTypeSet_ = rangeType;
-        };
+        }
 
     private:
         /*! \brief The list of end atom indices */
index 5fa6873fc1dd4b74404c924ee525f7feae5bb2e7..bc524a5890d8955a4492e729f2a065012b60cbf5 100644 (file)
@@ -648,7 +648,7 @@ void calc_distribution_props(int nh, const int histo[], real start,
         kkk[i].Jc    = 0;
         kkk[i].Jcsig = 0;
     }
-    tdc = 0, tds = 0;
+    tdc = 0; tds = 0;
     for (j = 0; (j < nh); j++)
     {
         d    = invth*histo[j];
index d758f3d59e3758c1dcded16529ba2248fca974fe..ad72756453d662abcc6bd1cc5a94c439558a442c 100644 (file)
@@ -532,8 +532,8 @@ int gmx_clustsize(int argc, char *argv[])
     }
 
     fnNDX   = ftp2fn_null(efNDX, NFILE, fnm);
-    rgblo.r = rlo[XX], rgblo.g = rlo[YY], rgblo.b = rlo[ZZ];
-    rgbhi.r = rhi[XX], rgbhi.g = rhi[YY], rgbhi.b = rhi[ZZ];
+    rgblo.r = rlo[XX]; rgblo.g = rlo[YY]; rgblo.b = rlo[ZZ];
+    rgbhi.r = rhi[XX]; rgbhi.g = rhi[YY]; rgbhi.b = rhi[ZZ];
 
     fnTPR = ftp2fn_null(efTPR, NFILE, fnm);
     if (bMol && !fnTPR)
index b8ac16387014075efdf18d4c7ff872e316c8ac47..98083e5fc526d220898854ce757c651e2355ba84 100644 (file)
@@ -339,9 +339,9 @@ int gmx_enemat(int argc, char *argv[])
     {
         groupnr[i] = i+1;
     }
-    rlo.r  = 1.0, rlo.g  = 0.0, rlo.b  = 0.0;
-    rmid.r = 1.0, rmid.g = 1.0, rmid.b = 1.0;
-    rhi.r  = 0.0, rhi.g  = 0.0, rhi.b  = 1.0;
+    rlo.r  = 1.0; rlo.g  = 0.0; rlo.b  = 0.0;
+    rmid.r = 1.0; rmid.g = 1.0; rmid.b = 1.0;
+    rhi.r  = 0.0; rhi.g  = 0.0; rhi.b  = 1.0;
     if (bMeanEmtx)
     {
         snew(e, ngroups);
index 9603303c7164f356f2b1e95e78cfdb7056cec913..621166afc464cd96137232c291031076ef09767b 100644 (file)
@@ -305,8 +305,8 @@ int gmx_mdmat(int argc, char *argv[])
 
     nframes = 0;
 
-    rlo.r = 1.0, rlo.g = 1.0, rlo.b = 1.0;
-    rhi.r = 0.0, rhi.g = 0.0, rhi.b = 0.0;
+    rlo.r = 1.0; rlo.g = 1.0; rlo.b = 1.0;
+    rhi.r = 0.0; rhi.g = 0.0; rhi.b = 0.0;
 
     gpbc = gmx_rmpbc_init(&top.idef, ePBC, trxnat);
 
index 6431b17e2ab84d42732f9d38cf368ce1158da3cb..7027c241ff49cde99e3b05c2728c0361e05712b2 100644 (file)
@@ -843,8 +843,8 @@ int gmx_rmsdist(int argc, char *argv[])
         calc_noe(isize, noe_index, dtot1_3, dtot1_6, gnr, noe);
     }
 
-    rlo.r = 1.0, rlo.g = 1.0, rlo.b = 1.0;
-    rhi.r = 0.0, rhi.g = 0.0, rhi.b = 0.0;
+    rlo.r = 1.0; rlo.g = 1.0; rlo.b = 1.0;
+    rhi.r = 0.0; rhi.g = 0.0; rhi.b = 0.0;
 
     if (bRMS)
     {
index 667c8f456ffd43d45e1242168622b987b2a01bdc..4d6ba7a21bb67a2e0a0bdf0b35246a2c0b5f018a 100644 (file)
@@ -356,7 +356,7 @@ t_bb *mkbbind(const char *fn, int *nres, int *nbb, int res0,
     snew(bb, rnr);
     for (i = 0; (i < rnr); i++)
     {
-        bb[i].N = bb[i].H = bb[i].CA = bb[i].C = bb[i].O = -1, bb[i].resno = res0+i;
+        bb[i].N = bb[i].H = bb[i].CA = bb[i].C = bb[i].O = -1; bb[i].resno = res0+i;
     }
 
     for (i = j = 0; (i < gnx); i++)
index 09aca854a88f137011cb642e9e41990dba92992e..87d32d2a1373f3eb6648cc7dc5a301805a685ff1 100644 (file)
@@ -604,7 +604,7 @@ detectX86LogicalProcessors()
     }
     else
     {
-        haveX2Apic = false,
+        haveX2Apic = false;
         haveApic   = false;
     }
 
index 81e6de3ad3f53484476486158932f1f5c27fc9d7..468eb7dee1250243bf7d14d12e46fefb720be44c 100644 (file)
@@ -57,7 +57,7 @@ struct ReplicaExchangeParameters
         numExchanges(0),
         randomSeed(-1)
     {
-    };
+    }
 
     int exchangeInterval; /* Interval in steps at which to attempt exchanges, 0 means no replica exchange */
     int numExchanges;     /* The number of exchanges to attempt at an exchange step */
index 151a0d68b327217c6e4ce5ed157f528d51389df4..5dc1138fabf099f0e02c4cb70ff4147ab19780b8 100644 (file)
@@ -88,7 +88,7 @@ class SimulationSignal
 {
     public:
         //! Constructor
-        SimulationSignal(bool isSignalLocal = true) : sig(0), set(0), isLocal(isSignalLocal) {};
+        SimulationSignal(bool isSignalLocal = true) : sig(0), set(0), isLocal(isSignalLocal) {}
         //! The signal set by this rank in do_md().
         signed char sig;
         //! The communicated signal that triggers action, which will be equal for all ranks, once communication has occured.
index 0430196b2d81481bc78b8ac4c91c0fbf791bfd45..dda2fbee0ea2d27a140a2a6d31d948c1726c6ab2 100644 (file)
@@ -95,7 +95,7 @@ class ForceProviderInput
             : x_(x), mdatoms_(mdatoms), t_(time), cr_(cr)
         {
             copy_mat(box, box_);
-        };
+        }
 
         ArrayRef<const RVec> x_;                                        //!< The atomic positions
         const t_mdatoms     &mdatoms_;                                  //!< Atomic data
@@ -129,7 +129,7 @@ class ForceProviderOutput
                             gmx_enerdata_t  *enerd)
             : forceWithVirial_(makeRefFromPointer(forceWithVirial)), enerd_(makeRefFromPointer(enerd))
         {
-        };
+        }
 
         ForceWithVirial &forceWithVirial_; //!< Container for force and virial
         gmx_enerdata_t  &enerd_;           //!< Structure containing energy data
index b77893cedae503da7f19a65ca41dd5cc9142a7df..183407aea0012f8c27a7317e5691c85821c22003 100644 (file)
@@ -124,7 +124,7 @@ struct pull_coord_work_t
         scalarForce(0),
         bExternalPotentialProviderHasBeenRegistered(false)
     {
-    };
+    }
 
     const t_pull_coord    params;      /* Pull coordinate parameters */
 
index a7ff54e1b418c257f106afa46ae7ad74d921937a..e5ad8278bb875cf4b2203191c4bd6e51a2497904 100644 (file)
@@ -108,6 +108,17 @@ struct SimdDInt32Tag {};
  *  \{
  */
 
+#ifdef __clang__
+#pragma clang diagnostic push
+/* reinterpret_cast is used for SIMD->scalar conversion
+ *
+ * In general using reinterpret_cast for bit_cast is UB but
+ * for intrinsics types it works for all known compilers
+ * and not all compilers produce as good code for memcpy.
+ */
+#pragma clang diagnostic ignored "-Wundefined-reinterpret-cast"
+#endif
+
 #if GMX_SIMD_X86_SSE2
 #    include "impl_x86_sse2/impl_x86_sse2.h"
 #elif GMX_SIMD_X86_SSE4_1
@@ -140,6 +151,10 @@ struct SimdDInt32Tag {};
 #    include "impl_none/impl_none.h"
 #endif
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 // The scalar SIMD-mimicking functions are always included so we can use
 // templated functions even without SIMD support.
 #include "gromacs/simd/scalar/scalar.h"
index adbe11ada7215d0868afb666ad878613b80840f4..e07003a90b5e49a1ba286570c41322bf81070613 100644 (file)
@@ -93,9 +93,9 @@ class RangePartitioning
                 }
 
                 /*! \brief Begin iterator/value */
-                const iterator begin() const { return begin_; };
+                const iterator begin() const { return begin_; }
                 /*! \brief End iterator/value */
-                const iterator end() const { return end_; };
+                const iterator end() const { return end_; }
 
                 /*! \brief The number of items in the block */
                 int size() const
index ed54bd60ec26b4a2e2348d88a750bd8f22c49a42..b32eeade290ea6305fda2f8a479615d2411e817d 100644 (file)
@@ -90,7 +90,7 @@ class FreeVolume : public TrajectoryAnalysisModule
 {
     public:
         FreeVolume();
-        virtual ~FreeVolume() {};
+        virtual ~FreeVolume() {}
 
         virtual void initOptions(IOptionsContainer          *options,
                                  TrajectoryAnalysisSettings *settings);
index 3c62eebfe297c4fb1064600dae6d4480f045ea9d..e92f0e009f4b7254ebb4ce7d980ad9bcc6146d46 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -112,7 +112,7 @@ class StringInputStream : public TextInputStream
 
         // From TextInputStream
         virtual bool readLine(std::string *line);
-        virtual void close() {};
+        virtual void close() {}
     private:
         std::string input_;
         size_t      pos_;