1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2025-01-03 10:06:09 +01:00

Added cppcheck

This commit is contained in:
Anthony Scemama 2021-05-19 01:49:41 +02:00
parent 16595f898b
commit bbb6fac5db
3 changed files with 14 additions and 3 deletions

View File

@ -161,4 +161,16 @@ tests/chbrclf.h: $(qmckl_h)
generated.mk: $(ORG_FILES) generated.mk: $(ORG_FILES)
python $(srcdir)/tools/build_makefile.py python $(srcdir)/tools/build_makefile.py
cppcheck: cppcheck.out
cppcheck.out: $(qmckl_h)
cd src/ && \
cppcheck --addon=cert -q --error-exitcode=0 \
--enable=all \
--language=c --std=c99 -rp --platform=unix64 \
-I../include *.c *.h 2>../$@
.PHONY: cppcheck
endif endif

View File

@ -329,9 +329,9 @@ qmckl_get_electron_coord (const qmckl_context context, const char transp, double
double* ptr2 = coord; double* ptr2 = coord;
if (transp == 'N') { if (transp == 'N') {
qmckl_exit_code rc;
for (int64_t i=0 ; i<walk_num ; ++i) { for (int64_t i=0 ; i<walk_num ; ++i) {
qmckl_exit_code rc;
rc = qmckl_transpose(context, elec_num, 3, rc = qmckl_transpose(context, elec_num, 3,
ptr1, elec_num, ptr2, 3); ptr1, elec_num, ptr2, 3);
if (rc != QMCKL_SUCCESS) return rc; if (rc != QMCKL_SUCCESS) return rc;
@ -535,7 +535,6 @@ qmckl_set_electron_coord(qmckl_context context, const char transp, const double*
double* ptr1 = ctx->electron.coord_new; double* ptr1 = ctx->electron.coord_new;
if (transp == 'N') { if (transp == 'N') {
qmckl_exit_code rc;
for (int64_t i=0 ; i<walk_num ; ++i) { for (int64_t i=0 ; i<walk_num ; ++i) {
rc = qmckl_transpose(context, 3, elec_num, rc = qmckl_transpose(context, 3, elec_num,

View File

@ -340,7 +340,7 @@ qmckl_set_nucleus_charge(qmckl_context context, const double* charge) {
assert (ctx->nucleus.charge == NULL); assert (ctx->nucleus.charge == NULL);
ctx->nucleus.charge = (double*) qmckl_malloc(context, mem_info); ctx->nucleus.charge = (double*) qmckl_malloc(context, mem_info);
if (charge== NULL) { if (ctx->nucleus.charge == NULL) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED, QMCKL_ALLOCATION_FAILED,
"qmckl_set_nucleus_charge", "qmckl_set_nucleus_charge",