diff --git a/sbs b/sbs index 50d9e66d0ccd8b8f6749156d6e7a346778161300..85483b9b86995236ee12c41ea6be12b227e4252c 100755 --- a/sbs +++ b/sbs @@ -226,9 +226,9 @@ lint_cppcheck() { declare -a opts=() [ -n "$jobs" ] && opts+=("-j $jobs") - cppcheck --language=c++ --std=c++11 --enable=all --inline-suppr \ + cppcheck --language=c++ --std=c++17 --template=gcc --enable=all --inline-suppr --force \ --suppress=unmatchedSuppression --suppress=unusedFunction \ - --suppress=missingInclude --error-exitcode=1 "${opts[@]}" \ + --suppress=missingInclude --suppress=unknownMacro --error-exitcode=1 "${opts[@]}" \ "$source_dir/src" } diff --git a/scripts/linter.py b/scripts/linter.py index a0c8297311cc4c8ccd1331675cc38081a1dc40b2..83277ed93f60bb6bcf404ac6e9456ccb354e0f32 100755 --- a/scripts/linter.py +++ b/scripts/linter.py @@ -272,8 +272,8 @@ def check_cppcheck(directory): linter_print(Colors.GREEN + 'cppcheck' + Colors.RESET) # Run cppcheck on the directory try: - result = check_output(['cppcheck', '-q', '--language=c++', '--template=gcc', '--std=c++11', '--enable=all', '--inline-suppr', - '--suppress=unmatchedSuppression', '--suppress=unusedFunction', '--suppress=missingInclude', + result = check_output(['cppcheck', '-q', '--language=c++', '--std=c++17', '--template=gcc', '--enable=all', '--inline-suppr', '--force', + '--suppress=unmatchedSuppression', '--suppress=unusedFunction', '--suppress=missingInclude', '--suppress=unknownMacro', directory], stderr=STDOUT) # Parse results and count errors diff --git a/src/shared/Core/Message/Message.cpp b/src/shared/Core/Message/Message.cpp index 08f21073de7f53fbfc3b2d027eb926a55ad517ef..136726c87872a1e0b2a3087bae0e69a158df9021 100644 --- a/src/shared/Core/Message/Message.cpp +++ b/src/shared/Core/Message/Message.cpp @@ -67,6 +67,7 @@ QString Message::toString() const str += "{\n"; for (auto key : fields.keys()) + // cppcheck-suppress useStlAlgorithm str += " " + key + ": " + fields[key].toString() + "\n"; str.append("}"); diff --git a/src/shared/Core/QCustomPlot/QCustomPlot.cpp b/src/shared/Core/QCustomPlot/QCustomPlot.cpp index d96e14f5f5ad7a52cbdc0e1a722c736d1df1698c..44e767d1df2afdfa04559bdb6c9e715c0c88fb1a 100644 --- a/src/shared/Core/QCustomPlot/QCustomPlot.cpp +++ b/src/shared/Core/QCustomPlot/QCustomPlot.cpp @@ -5795,8 +5795,8 @@ void QCPLineEnding::draw(QCPPainter *painter, const QCPVector2D &pos, { QCPVector2D widthVecPerp = widthVec.perpendicular(); QPointF points[4] = { - (pos - widthVecPerp).toPointF(), (pos - widthVec).toPointF(), - (pos + widthVecPerp).toPointF(), (pos + widthVec).toPointF()}; + (pos - widthVecPerp).toPointF(), (pos - widthVec).toPointF(), + (pos + widthVecPerp).toPointF(), (pos + widthVec).toPointF()}; painter->setPen(miterPen); painter->setBrush(brush); painter->drawConvexPolygon(points, 4); diff --git a/src/shared/Modules/Mavlink/MavlinkVersionHeader.h b/src/shared/Modules/Mavlink/MavlinkVersionHeader.h index 6a8ebf1206471d4faa4d3fba8ebc60c560a2d913..ed3776284b58ee378a8d0431d1047fc28f11e3eb 100644 --- a/src/shared/Modules/Mavlink/MavlinkVersionHeader.h +++ b/src/shared/Modules/Mavlink/MavlinkVersionHeader.h @@ -20,7 +20,9 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" +#if __GNUC_PREREQ(9, 0) #pragma GCC diagnostic ignored "-Waddress-of-packed-member" +#endif #include <mavlink_lib/pyxis/mavlink.h> #pragma GCC diagnostic pop