lsmo-epfl / zeopp-lsmo

zeo++ fork of the LSMO
http://www.zeoplusplus.org
Other
9 stars 1 forks source link

potential issues flagged by cppcheck #5

Closed ltalirz closed 1 year ago

ltalirz commented 3 years ago
- cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]

voro++/examples/no_release/import_freeman.cc:53:1: error: Resource leak: outputFile [resourceLeak]
}
^
zeo++/Eigen/src/plugins/CommonCwiseBinaryOps.h:19:1: error: syntax error [syntaxError]
EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op)
^
zeo++/holo_similarity.h:18:3: error: Code 'std::vector' is invalid C code. Use --std or --language to configure the language. [syntaxError]
  std::vector<coords_int> grid_points;
  ^
nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]

zeo++/holo_similarity.h:18:3: error: Code 'std::vector' is invalid C code. Use --std or --language to configure the language. [syntaxError]
  std::vector<coords_int> grid_points;
  ^
nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]

nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]

zeo++/psd.cc:822:15: error: Uninitialized variable: volFraction [uninitvar]
          if (volFraction >= TOL) {
              ^
nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]

zeo++/Eigen/src/plugins/CommonCwiseBinaryOps.h:19:1: error: syntax error [syntaxError]
EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op)
^
nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]

zeo++/holograms.cc:946:9: error: Uninitialized variable: int_edge_radii_bins [uninitvar]
        int_edge_radii_bins[bin_index] += 100;  // 100 so we can get percentages
        ^
nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]

nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]

Most of them are complaints about too many ifdefs and complaints about C++ code in .h files.

The interesting ones are:

voro++/examples/no_release/import_freeman.cc:53:1: error: Resource leak: outputFile [resourceLeak]
}
^

zeo++/psd.cc:822:15: error: Uninitialized variable: volFraction [uninitvar]
          if (volFraction >= TOL) {
              ^
zeo++/holograms.cc:946:9: error: Uninitialized variable: int_edge_radii_bins [uninitvar]
        int_edge_radii_bins[bin_index] += 100;  // 100 so we can get percentages
        ^
ltalirz commented 1 year ago
zeo++/psd.cc:822:15: error: Uninitialized variable: volFraction [uninitvar]
          if (volFraction >= TOL) {
              ^

is a false alarm

but

zeo++/holograms.cc:946:9: error: Uninitialized variable: int_edge_radii_bins [uninitvar]
        int_edge_radii_bins[bin_index] += 100;  // 100 so we can get percentages
        ^

looks real

ltalirz commented 1 year ago

The two issues mentioned above are fixed.

We don't care about the resource leak in the voro++ example.