Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cppcheck suppresions set 59 #38747

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ GNU_DIAG_OFF("unused-local-typedef")
// Seen with GCC 7.1.1 and Boost 1.63.0
GNU_DIAG_OFF("conversion")
// define overloaded functions
// cppcheck-suppress unknownMacro
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be an issue with cppcheck not being able to find boost macros, will create an issue for it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that situation occurred for us as well.

BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getEulerAngles_overloads, Goniometer::getEulerAngles, 0, 1)
GNU_DIAG_ON("conversion")
GNU_DIAG_ON("unused-local-typedef")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ void export_Instrument() {
"represents the source")

.def("getComponentByName",
// cppcheck-suppress cstyleCast
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cstylecast used in all such exports, suspect it is not worth changing them all under the scope of this hackathon. Will raise an issue.

(std::shared_ptr<const IComponent>(Instrument::*)(const std::string &, int) const) &
Instrument::getComponentByName,
(arg("self"), arg("cname"), arg("nlevels") = 0), "Returns the named :class:`~mantid.geometry.Component`")

.def("getDetector",
// cppcheck-suppress cstyleCast
(std::shared_ptr<const IDetector>(Instrument::*)(const detid_t &) const) & Instrument::getDetector,
(arg("self"), arg("detector_id")), "Returns the :class:`~mantid.geometry.Detector` with the given ID")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using namespace boost::python;

GET_POINTER_SPECIALIZATION(MeshObject)

boost::python::object wrapMeshWithNDArray(MeshObject &self) {
boost::python::object wrapMeshWithNDArray(const MeshObject &self) {
// PyArray_SimpleNewFromData doesn't interact well with smart pointers so use raw pointer
const auto &vertices = self.getV3Ds();
const auto &triangles = self.getTriangles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ boost::python::list getUniqueHKLsDefaultFilter(const ReflectionGenerator &self,
return getListFromV3DVector(self.getUniqueHKLs(dMin, dMax));
}

boost::python::list getUniqueHKLsUsingFilter(ReflectionGenerator &self, double dMin, double dMax,
boost::python::list getUniqueHKLsUsingFilter(const ReflectionGenerator &self, double dMin, double dMax,
ReflectionConditionFilter filter) {
return getListFromV3DVector(self.getUniqueHKLs(dMin, dMax, self.getReflectionConditionFilter(std::move(filter))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ void export_UnitCell() {
(arg("self"), arg("h"), arg("k"), arg("l")),
"Returns :math:`d`-spacing for a given H, K, L coordinate in "
":math:`\\rm{\\AA}`.")
// cppcheck-suppress cstyleCast
.def("d", (double(UnitCell::*)(const V3D &) const) & UnitCell::d, (arg("self"), arg("hkl")),
"Returns :math:`d`-spacing for a given H, K, L coordinate in "
":math:`\\rm{\\AA}`.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ template <> std::string dtype(ArrayProperty<std::string> &self) {

// Loop for the number of strings
// For each string store the number of characters
for (auto val : values) {
for (auto const &val : values) {
auto size = val.size();
stringSizes.emplace_back(size);
}
Expand Down
7 changes: 0 additions & 7 deletions buildconfig/CMake/CppCheck_Suppressions.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -818,13 +818,6 @@ unknownMacro:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/api/src/Export
constParameterCallback:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp:80
unusedScopedObject:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp:113
syntaxError:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/dataobjects/src/Exports/EventList.cpp:37
unknownMacro:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp:31
cstyleCast:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp:49
cstyleCast:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp:54
constParameterCallback:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/MeshObject.cpp:29
constParameterCallback:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/ReflectionGenerator.cpp:40
cstyleCast:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/UnitCell.cpp:175
iterateByValue:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/kernel/src/Exports/ArrayProperty.cpp:52
adriazalvarez marked this conversation as resolved.
Show resolved Hide resolved
unknownMacro:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/kernel/src/Exports/ConfigService.cpp:73
cstyleCast:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/kernel/src/Exports/FacilityInfo.cpp:46
constVariablePointer:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp:46
Expand Down