diff --git a/src/EXTRA-COMPUTE/compute_ackland_atom.cpp b/src/EXTRA-COMPUTE/compute_ackland_atom.cpp index 2a16db638f..46a7818fd5 100644 --- a/src/EXTRA-COMPUTE/compute_ackland_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_ackland_atom.cpp @@ -346,8 +346,8 @@ void ComputeAcklandAtom::compute_peratom() 2nd routine sorts auxiliary array at same time ------------------------------------------------------------------------- */ -#define SWAP(a,b) tmp = a; a = b; b = tmp; -#define ISWAP(a,b) itmp = a; a = b; b = itmp; +#define SWAP(a,b) tmp = a; (a) = b; (b) = tmp; +#define ISWAP(a,b) itmp = a; (a) = b; (b) = itmp; void ComputeAcklandAtom::select(int k, int n, double *arr) { diff --git a/src/EXTRA-COMPUTE/compute_basal_atom.cpp b/src/EXTRA-COMPUTE/compute_basal_atom.cpp index a16c4f8330..7b2e7b0770 100644 --- a/src/EXTRA-COMPUTE/compute_basal_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_basal_atom.cpp @@ -432,8 +432,8 @@ void ComputeBasalAtom::compute_peratom() 2nd routine sorts auxiliary array at same time ------------------------------------------------------------------------- */ -#define SWAP(a,b) tmp = a; a = b; b = tmp; -#define ISWAP(a,b) itmp = a; a = b; b = itmp; +#define SWAP(a,b) tmp = a; (a) = b; (b) = tmp; +#define ISWAP(a,b) itmp = a; (a) = b; (b) = itmp; void ComputeBasalAtom::select(int k, int n, double *arr) { diff --git a/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp b/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp index c2ccb3ca47..4d7ce9643b 100644 --- a/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_hexorder_atom.cpp @@ -267,8 +267,8 @@ inline void ComputeHexOrderAtom::calc_qn_trig(double delx, double dely, double & sort auxiliary array at same time ------------------------------------------------------------------------- */ -#define SWAP(a,b) tmp = a; a = b; b = tmp; -#define ISWAP(a,b) itmp = a; a = b; b = itmp; +#define SWAP(a,b) tmp = a; (a) = b; (b) = tmp; +#define ISWAP(a,b) itmp = a; (a) = b; (b) = itmp; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-DUMP/dump_xtc.cpp b/src/EXTRA-DUMP/dump_xtc.cpp index 41b78ab64c..01683b504c 100644 --- a/src/EXTRA-DUMP/dump_xtc.cpp +++ b/src/EXTRA-DUMP/dump_xtc.cpp @@ -381,7 +381,7 @@ static int *buf = nullptr; | with some routines to assist in this task (those are marked | static and cannot be called from user programs) */ -#define MAXABS INT_MAX-2 +#define MAXABS (INT_MAX-2) #ifndef SQR #define SQR(x) ((x)*(x)) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 1039067ac7..013c63172d 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -47,7 +47,7 @@ using namespace MathSpecial; #define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) #define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) #define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS 4.0/3.0 // 4/3 +#define FOURTHIRDS (4.0/3.0) // 4/3 #define THREEQUARTERS 0.75 // 3/4 #define EPSILON 1e-10 diff --git a/src/KSPACE/ewald_dipole_spin.cpp b/src/KSPACE/ewald_dipole_spin.cpp index 8bad7b87a0..cd5f2209c9 100644 --- a/src/KSPACE/ewald_dipole_spin.cpp +++ b/src/KSPACE/ewald_dipole_spin.cpp @@ -76,7 +76,7 @@ void EwaldDipoleSpin::init() if (!atom->sp) error->all(FLERR,"Kspace style requires atom attribute sp"); - if ((spinflag && strcmp(update->unit_style,"metal")) != 0) + if ((spinflag && strcmp(update->unit_style,"metal") != 0) != 0) error->all(FLERR,"'metal' units have to be used with spins"); if (slabflag == 0 && domain->nonperiodic > 0) diff --git a/src/MISC/fix_ipi.cpp b/src/MISC/fix_ipi.cpp index 290ce38c02..65e431146e 100644 --- a/src/MISC/fix_ipi.cpp +++ b/src/MISC/fix_ipi.cpp @@ -186,7 +186,7 @@ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) : if (atom->tag_consecutive() == 0) error->all(FLERR,"Fix ipi requires consecutive atom IDs"); - if (strcmp(arg[1],"all")) + if (strcmp(arg[1],"all") != 0) error->warning(FLERR,"Fix ipi always uses group all"); host = strdup(arg[3]); diff --git a/src/MOLFILE/molfile_interface.cpp b/src/MOLFILE/molfile_interface.cpp index a83d8ed46c..1844afc55e 100644 --- a/src/MOLFILE/molfile_interface.cpp +++ b/src/MOLFILE/molfile_interface.cpp @@ -564,10 +564,10 @@ int MolfileInterface::timestep(float *coords, float *vels, // functions to read properties from molfile structure #define PROPUPDATE(PROP,ENTRY,VAL) \ - if (propid == PROP) { VAL = a.ENTRY; } + if (propid == (PROP)) { (VAL) = a.ENTRY; } #define PROPSTRCPY(PROP,ENTRY,VAL) \ - if (propid == PROP) { strcpy(VAL,a.ENTRY); } + if (propid == (PROP)) { strcpy(VAL,a.ENTRY); } // single precision floating point props static float read_float_property(molfile_atom_t &a, const int propid) @@ -645,10 +645,10 @@ static const char *read_string_property(molfile_atom_t &a, // functions to store properties into molfile structure #define PROPUPDATE(PROP,ENTRY,VAL) \ - if ((propid & PROP) == PROP) { a.ENTRY = VAL; plist |= PROP; } + if ((propid & (PROP)) == (PROP)) { a.ENTRY = VAL; plist |= (PROP); } #define PROPSTRCPY(PROP,ENTRY,VAL) \ - if ((propid & PROP) == PROP) { strcpy(a.ENTRY,VAL); plist |= PROP; } + if ((propid & (PROP)) == (PROP)) { strcpy(a.ENTRY,VAL); plist |= (PROP); } // floating point props static int write_atom_property(molfile_atom_t &a, diff --git a/src/MPIIO/dump_cfg_mpiio.cpp b/src/MPIIO/dump_cfg_mpiio.cpp index 7f2048861c..540492b6f4 100644 --- a/src/MPIIO/dump_cfg_mpiio.cpp +++ b/src/MPIIO/dump_cfg_mpiio.cpp @@ -252,7 +252,7 @@ void DumpCFGMPIIO::init_style() if (multifile == 0 && !multifile_override) error->all(FLERR,"Dump cfg requires one snapshot per file"); - DumpCustom::init_style(); + DumpCFG::init_style(); // setup function ptrs diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index 446e306675..7e048aa78f 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -323,12 +323,12 @@ void ComputeCentroAtom::compute_peratom() #define SWAP(a, b) \ tmp = a; \ - a = b; \ - b = tmp; + (a) = b; \ + (b) = tmp; #define ISWAP(a, b) \ itmp = a; \ - a = b; \ - b = itmp; + (a) = b; \ + (b) = itmp; void ComputeCentroAtom::select(int k, int n, double *arr) { diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index b63ab23739..4bc92ea476 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -46,7 +46,7 @@ enum { NODISCARD, MIXED, YESDISCARD }; enum { ONCE, NFREQ, EVERY }; // used in several files enum { LIMITMAX, LIMITEXACT }; -#define IDMAX 1024 * 1024 +#define IDMAX (1024 * 1024) /* ---------------------------------------------------------------------- */ diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 125c7ad941..7cb9886ac2 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -334,28 +334,28 @@ double ComputeOrientOrderAtom::memory_usage() #define SWAP(a, b) \ do { \ tmp = a; \ - a = b; \ - b = tmp; \ + (a) = b; \ + (b) = tmp; \ } while (0) #define ISWAP(a, b) \ do { \ itmp = a; \ - a = b; \ - b = itmp; \ + (a) = b; \ + (b) = itmp; \ } while (0) #define SWAP3(a, b) \ do { \ - tmp = a[0]; \ - a[0] = b[0]; \ - b[0] = tmp; \ - tmp = a[1]; \ - a[1] = b[1]; \ - b[1] = tmp; \ - tmp = a[2]; \ - a[2] = b[2]; \ - b[2] = tmp; \ + tmp = (a)[0]; \ + (a)[0] = (b)[0]; \ + (b)[0] = tmp; \ + tmp = (a)[1]; \ + (a)[1] = (b)[1]; \ + (b)[1] = tmp; \ + tmp = (a)[2]; \ + (a)[2] = (b)[2]; \ + (b)[2] = tmp; \ } while (0) /* ---------------------------------------------------------------------- */ diff --git a/src/region_cone.cpp b/src/region_cone.cpp index 9ee909a5d7..b838154034 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -40,7 +40,7 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : if (openflag && (open_faces[3] || open_faces[4] || open_faces[5])) error->all(FLERR,"Invalid region cone open setting"); - if (strcmp(arg[2],"x") && strcmp(arg[2],"y") && strcmp(arg[2],"z")) + if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") && strcmp(arg[2],"z") != 0) error->all(FLERR,"Illegal region cylinder command"); axis = arg[2][0]; diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index 033a2eeae4..c37bcb4be0 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -40,7 +40,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : if (openflag && (open_faces[3] || open_faces[4] || open_faces[5])) error->all(FLERR,"Invalid region cylinder open setting"); - if (strcmp(arg[2],"x") && strcmp(arg[2],"y") && strcmp(arg[2],"z")) + if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") && strcmp(arg[2],"z") != 0) error->all(FLERR,"Illegal region cylinder command"); axis = arg[2][0]; diff --git a/src/variable.cpp b/src/variable.cpp index 81ec3ced17..51c216fab0 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -51,7 +51,7 @@ using namespace MathConst; #define CHUNK 1024 #define MAXFUNCARG 6 -#define MYROUND(a) (( a-floor(a) ) >= .5) ? ceil(a) : floor(a) +#define MYROUND(a) (( (a)-floor(a) ) >= .5) ? ceil(a) : floor(a) enum{ARG,OP}; @@ -3252,20 +3252,20 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree { // word not a match to any math function - if (strcmp(word,"sqrt") && strcmp(word,"exp") && - strcmp(word,"ln") && strcmp(word,"log") && - strcmp(word,"abs") && - strcmp(word,"sin") && strcmp(word,"cos") && - strcmp(word,"tan") && strcmp(word,"asin") && - strcmp(word,"acos") && strcmp(word,"atan") && - strcmp(word,"atan2") && strcmp(word,"random") && - strcmp(word,"normal") && strcmp(word,"ceil") && - strcmp(word,"floor") && strcmp(word,"round") && - strcmp(word,"ramp") && strcmp(word,"stagger") && - strcmp(word,"logfreq") && strcmp(word,"logfreq2") && - strcmp(word,"logfreq3") && strcmp(word,"stride") && - strcmp(word,"stride2") && strcmp(word,"vdisplace") && - strcmp(word,"swiggle") && strcmp(word,"cwiggle")) + if (strcmp(word,"sqrt") != 0 && strcmp(word,"exp") && + strcmp(word,"ln") != 0 && strcmp(word,"log") != 0 && + strcmp(word,"abs") != 0 && + strcmp(word,"sin") != 0 && strcmp(word,"cos") != 0 && + strcmp(word,"tan") != 0 && strcmp(word,"asin") != 0 && + strcmp(word,"acos") != 0 && strcmp(word,"atan") != 0 && + strcmp(word,"atan2") != 0 && strcmp(word,"random") != 0 && + strcmp(word,"normal") != 0 && strcmp(word,"ceil") != 0 && + strcmp(word,"floor") != 0 && strcmp(word,"round") != 0 && + strcmp(word,"ramp") != 0 && strcmp(word,"stagger") != 0 && + strcmp(word,"logfreq") != 0 && strcmp(word,"logfreq2") != 0 && + strcmp(word,"logfreq3") != 0 && strcmp(word,"stride") != 0 && + strcmp(word,"stride2") != 0 && strcmp(word,"vdisplace") != 0 && + strcmp(word,"swiggle") != 0 && strcmp(word,"cwiggle") != 0) return 0; // parse contents for comma-separated args @@ -3676,13 +3676,13 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre { // word not a match to any group function - if (strcmp(word,"count") && strcmp(word,"mass") && - strcmp(word,"charge") && strcmp(word,"xcm") && - strcmp(word,"vcm") && strcmp(word,"fcm") && - strcmp(word,"bound") && strcmp(word,"gyration") && - strcmp(word,"ke") && strcmp(word,"angmom") && - strcmp(word,"torque") && strcmp(word,"inertia") && - strcmp(word,"omega")) + if (strcmp(word,"count") != 0 && strcmp(word,"mass") && + strcmp(word,"charge") != 0 && strcmp(word,"xcm") != 0 && + strcmp(word,"vcm") != 0 && strcmp(word,"fcm") != 0 && + strcmp(word,"bound") != 0 && strcmp(word,"gyration") != 0 && + strcmp(word,"ke") != 0 && strcmp(word,"angmom") != 0 && + strcmp(word,"torque") != 0 && strcmp(word,"inertia") != 0 && + strcmp(word,"omega") != 0) return 0; // parse contents for comma-separated args @@ -3925,11 +3925,11 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // word not a match to any special function - if (strcmp(word,"sum") && strcmp(word,"min") && strcmp(word,"max") && strcmp(word,"ave") && - strcmp(word,"trap") && strcmp(word,"slope") && strcmp(word,"gmask") && strcmp(word,"rmask") && - strcmp(word,"grmask") && strcmp(word,"next") && strcmp(word,"is_active") && - strcmp(word,"is_defined") && strcmp(word,"is_available") && strcmp(word,"is_file") && - strcmp(word,"extract_setting")) + if (strcmp(word,"sum") != 0 && strcmp(word,"min") && strcmp(word,"max") != 0 && strcmp(word,"ave") != 0 && + strcmp(word,"trap") != 0 && strcmp(word,"slope") != 0 && strcmp(word,"gmask") != 0 && strcmp(word,"rmask") != 0 && + strcmp(word,"grmask") != 0 && strcmp(word,"next") != 0 && strcmp(word,"is_active") != 0 && + strcmp(word,"is_defined") != 0 && strcmp(word,"is_available") != 0 && strcmp(word,"is_file") != 0 && + strcmp(word,"extract_setting") != 0) return 0; // parse contents for comma-separated args