if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION MATCHES "^6\.0")
target_compile_options(libgromacs PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Weverything ${IGNORED_CLANG_ALL_WARNINGS}>)
endif()
+if (MSVC)
+ target_compile_options(libgromacs PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/analyze /analyze:stacksize 70000
+ #Control flow warnings are disabled because the commond line output is insufficient. There is no tool
+ #to convert the xml report to e.g. HTML and even in Visual Studio the viewer doesn't work with cmake support.
+ /wd6001 #unitialized memory
+ /wd6011 #derefencing NULL
+ /wd6053 #prior call not zero-terminate
+ /wd6054 #might not be zero-terminated
+ /wd6385 #reading invalid data
+ /wd6386 #buffer overrun
+ /wd6387 #could be '0'
+ /wd28199 #uninitialized memory
+ # For compile time constant (e.g. templates) the following warnings have flase postives
+ /wd6239 #(<non-zero> && <expr>)
+ /wd6294 #Ill-defined for-loop
+ /wd6326 #comparison of constant with other constant
+ /wd28020 #expression involving paramter is not true
+ # Misc
+ /wd6330 #incorrect type to function (warns for char (instead of unsigned) for isspace/isalpha/isdigit/..))
+ /wd6993 #OpenMP ignored
+ #TODO
+ /wd6031 #return value ignored (important - mostly warnigns about sscanf)
+ /wd6244 #hides declaration (known issue - we ingore similar warnings for other compilers)
+ /wd6246 #hides declaration
+ >
+ )
+endif()
if (GMX_CLANG_TIDY)
set(CLANG_TIDY "clang-tidy" CACHE STRING "Name of clang-tidy executable")
find_program(CLANG_TIDY_EXE NAMES "${CLANG_TIDY}"
if (debug)
{
fprintf(debug, "FFT5D: N: %d, M: %d, K: %d, P: %dx%d, real2complex: %d, backward: %d, order yz: %d, debug %d\n",
- NG, MG, KG, P[0], P[1], (flags&FFT5D_REALCOMPLEX) > 0, (flags&FFT5D_BACKWARD) > 0, (flags&FFT5D_ORDER_YZ) > 0, (flags&FFT5D_DEBUG) > 0);
+ NG, MG, KG, P[0], P[1], int((flags&FFT5D_REALCOMPLEX) > 0), int((flags&FFT5D_BACKWARD) > 0), int((flags&FFT5D_ORDER_YZ) > 0), int((flags&FFT5D_DEBUG) > 0));
}
/* The check below is not correct, one prime factor 11 or 13 is ok.
if (fft5d_fmax(fft5d_fmax(lpfactor(NG),lpfactor(MG)),lpfactor(KG))>7) {
fprintf(fp, "%10g %10g\n", phi, psi);
if (bViol)
{
- fprintf(gp, "%d\n", (bAllowed(dih[Phi][j], RAD2DEG*dih[Psi][j]) == FALSE) );
+ fprintf(gp, "%d\n", int{(bAllowed(dih[Phi][j], RAD2DEG*dih[Psi][j]) == FALSE)} );
}
if (bOm)
{
{
gmx_fatal(FARGS, "Could not allocate enough memory for hbmap");
}
- for (j = 0; (j > hb->a.nra); j++)
+ for (j = 0; j < hb->a.nra; j++)
{
hb->hbmap[i][j] = nullptr;
}
}
f_thread_t *f_t = &bt->f_t[thread];
- const int nelem_fa = sizeof(*f_t->f)/sizeof(real);
+ const int nelem_fa = sizeof(f_t->f[0])/sizeof(real);
for (int i = 0; i < f_t->nblock_used; i++)
{
if (debug && bPLINCS)
{
fprintf(debug, "PLINCS communication before each iteration: %d\n",
- li->bCommIter);
+ int{li->bCommIter});
}
/* LINCS can run on any number of threads.
if (debug && vsite->nthreads > 1)
{
fprintf(debug, "virtual site useInterdependentTask %d, nuse:\n",
- vsite->tData[0]->useInterdependentTask);
+ int{vsite->tData[0]->useInterdependentTask});
for (int th = 0; th < vsite->nthreads + 1; th++)
{
fprintf(debug, " %4d", vsite->tData[th]->idTask.nuse);
nthreads_omp_mpi_ok_min = nthreads_omp_mpi_ok_min_gpu;
}
- if (DOMAINDECOMP(cr) && cr->nnodes > 1)
+ if (DOMAINDECOMP(cr))
{
if (nth_omp_max < nthreads_omp_mpi_ok_min ||
nth_omp_max > nthreads_omp_mpi_ok_max)
{
if (index != -1)
{
- fprintf(fp, "%s[%d] (%d - %d)\n", s, index, i1, i2);
+ fprintf(fp, "%s[%d] (%d - %d)\n", s, index, int{i1}, int{i2});
}
else
{
- fprintf(fp, "%s (%d - %d)\n", s, i1, i2);
+ fprintf(fp, "%s (%d - %d)\n", s, int{i1}, int{i2});
}
}
}
#ifdef GMX_DISABLE_ASSERTS
#define GMX_RELEASE_ASSERT(condition, msg)
#else
+#ifdef _MSC_VER
+#define GMX_RELEASE_ASSERT(condition, msg) \
+ ((void) ((condition) ? (void)0 : \
+ ::gmx::internal::assertHandler(#condition, msg, \
+ GMX_CURRENT_FUNCTION, __FILE__, __LINE__)))
+#else
// Use an "immediately invoked function expression" to allow being
// used in constexpr context with older GCC versions
// https://akrzemi1.wordpress.com/2017/05/18/asserts-in-constexpr-functions/
[&](){::gmx::internal::assertHandler(#condition, msg, \
GMX_CURRENT_FUNCTION, __FILE__, __LINE__); } ()))
#endif
+#endif
/*! \def GMX_ASSERT
* \brief
* Macro for debug asserts.