Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cppcheck for openSUSE:Factory checked in at 2025-09-12 21:10:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cppcheck (Old) and /work/SRC/openSUSE:Factory/.cppcheck.new.1977 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cppcheck" Fri Sep 12 21:10:05 2025 rev:54 rq:1304153 version:2.18.3 Changes: -------- --- /work/SRC/openSUSE:Factory/cppcheck/cppcheck.changes 2025-07-31 17:50:19.270426907 +0200 +++ /work/SRC/openSUSE:Factory/.cppcheck.new.1977/cppcheck.changes 2025-09-12 21:10:25.381486359 +0200 @@ -1,0 +2,10 @@ +Thu Sep 11 20:17:25 UTC 2025 - Dirk Müller <[email protected]> + +- update to 2.18.3: + * pathmatch.cpp: fixed reference to invalid container entry + * Fix #14067 (cmdlineparser: tweaks to --premium) + * Fix #14064 Files are reanalyzed with --cppcheck-build-dir + * Fix #14095 (TemplateSimplifier: store location of template argument + * Fix #14107 (GUI: add menu option to show EULA for cppcheck premium) + +------------------------------------------------------------------- Old: ---- cppcheck-2.18.0.tar.gz New: ---- cppcheck-2.18.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cppcheck.spec ++++++ --- /var/tmp/diff_new_pack.MwErJF/_old 2025-09-12 21:10:25.969511154 +0200 +++ /var/tmp/diff_new_pack.MwErJF/_new 2025-09-12 21:10:25.969511154 +0200 @@ -1,7 +1,7 @@ # # spec file for package cppcheck # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,7 +22,7 @@ %bcond_without rules %endif Name: cppcheck -Version: 2.18.0 +Version: 2.18.3 Release: 0 Summary: A tool for static C/C++ code analysis License: GPL-3.0-or-later ++++++ cppcheck-2.18.0.tar.gz -> cppcheck-2.18.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/CMakeLists.txt new/cppcheck-2.18.3/CMakeLists.txt --- old/cppcheck-2.18.0/CMakeLists.txt 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/CMakeLists.txt 2025-09-02 21:12:05.000000000 +0200 @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.13) -project(Cppcheck VERSION 2.18.0 LANGUAGES CXX) +project(Cppcheck VERSION 2.18.3 LANGUAGES CXX) include(cmake/options.cmake) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/cli/cmdlineparser.cpp new/cppcheck-2.18.3/cli/cmdlineparser.cpp --- old/cppcheck-2.18.0/cli/cmdlineparser.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/cli/cmdlineparser.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -1103,12 +1103,14 @@ mSettings.premiumArgs += " "; const std::string p(argv[i] + 10); const std::string p2(p.find('=') != std::string::npos ? p.substr(0, p.find('=')) : ""); - if (!valid.count(p) && !valid2.count(p2)) { + const bool isCodingStandard = startsWith(p, "autosar") || startsWith(p,"cert-") || startsWith(p,"misra-"); + const std::string p3(endsWith(p,":all") && isCodingStandard ? p.substr(0,p.rfind(':')) : p); + if (!valid.count(p3) && !valid2.count(p2)) { mLogger.printError("invalid --premium option '" + (p2.empty() ? p : p2) + "'."); return Result::Fail; } mSettings.premiumArgs += "--" + p; - if (startsWith(p, "autosar") || startsWith(p, "cert") || startsWith(p, "misra")) { + if (isCodingStandard) { // All checkers related to the coding standard should be enabled. The coding standards // do not all undefined behavior or portability issues. mSettings.addEnabled("warning"); @@ -1862,9 +1864,13 @@ " * misra-c-2025 Misra C 2025\n" " * misra-c++-2008 Misra C++ 2008\n" " * misra-c++-2023 Misra C++ 2023\n" + " By default 'Misra/Cert C' only checks C files.\n" + " By default 'Autosar/Misra/Cert C++' only checks C++ files.\n" + " To check all files, append \":all\" i.e. --premium=misra-c++-2023:all.\n" " Other:\n" " * bughunting Soundy analysis\n" " * cert-c-int-precision=BITS Integer precision to use in Cert C analysis.\n" + " * metrics Calculate metrics. Metrics are only reported in xmlv3 output.\n" " * safety Turn on safety certified behavior (ON by default)\n" " * safety-off Turn off safety certified behavior\n"; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/cli/main.cpp new/cppcheck-2.18.3/cli/main.cpp --- old/cppcheck-2.18.0/cli/main.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/cli/main.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -20,7 +20,7 @@ /** * * @mainpage Cppcheck - * @version 2.18.0 + * @version 2.18.3 * * @section overview_sec Overview * Cppcheck is a simple tool for static analysis of C/C++ code. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/gui/mainwindow.cpp new/cppcheck-2.18.3/gui/mainwindow.cpp --- old/cppcheck-2.18.0/gui/mainwindow.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/gui/mainwindow.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -76,6 +76,7 @@ #include <QCloseEvent> #include <QCoreApplication> #include <QDateTime> +#include <QDesktopServices> #include <QDebug> #include <QDialog> #include <QDir> @@ -193,6 +194,8 @@ // About menu connect(mUI->mActionAbout, &QAction::triggered, this, &MainWindow::about); connect(mUI->mActionLicense, &QAction::triggered, this, &MainWindow::showLicense); + mUI->mActionEULA->setVisible(isCppcheckPremium()); + connect(mUI->mActionEULA, &QAction::triggered, this, &MainWindow::showEULA); // View > Toolbar menu connect(mUI->mActionToolBarMain, SIGNAL(toggled(bool)), this, SLOT(toggleMainToolBar())); @@ -1643,6 +1646,11 @@ dlg->exec(); } +void MainWindow::showEULA() +{ + QDesktopServices::openUrl(QUrl("https://www.cppcheck.com/EULA")); +} + void MainWindow::performSelectedFilesCheck(const QStringList &selectedFilesList) { reAnalyzeSelected(selectedFilesList); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/gui/mainwindow.h new/cppcheck-2.18.3/gui/mainwindow.h --- old/cppcheck-2.18.0/gui/mainwindow.h 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/gui/mainwindow.h 2025-09-02 21:12:05.000000000 +0200 @@ -170,6 +170,9 @@ /** @brief Slot to to show authors list */ void showAuthors(); + /** @brief Slot to to show EULA */ + void showEULA(); + /** @brief Slot to save results */ void save(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/gui/mainwindow.ui new/cppcheck-2.18.3/gui/mainwindow.ui --- old/cppcheck-2.18.0/gui/mainwindow.ui 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/gui/mainwindow.ui 2025-09-02 21:12:05.000000000 +0200 @@ -124,7 +124,7 @@ <x>0</x> <y>0</y> <width>640</width> - <height>30</height> + <height>22</height> </rect> </property> <widget class="QMenu" name="mMenuFile"> @@ -200,6 +200,7 @@ <addaction name="mActionHelpContents"/> <addaction name="mActionLicense"/> <addaction name="mActionAuthors"/> + <addaction name="mActionEULA"/> <addaction name="separator"/> <addaction name="mActionAbout"/> </widget> @@ -1025,6 +1026,11 @@ <string>Autosar</string> </property> </action> + <action name="mActionEULA"> + <property name="text"> + <string>EULA...</string> + </property> + </action> </widget> <customwidgets> <customwidget> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/cppcheck.cpp new/cppcheck-2.18.3/lib/cppcheck.cpp --- old/cppcheck-2.18.0/lib/cppcheck.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/cppcheck.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -850,7 +850,7 @@ return {filename, files, outputList}; } -std::size_t CppCheck::calculateHash(const Preprocessor& preprocessor, const simplecpp::TokenList& tokens) const +std::size_t CppCheck::calculateHash(const Preprocessor& preprocessor, const simplecpp::TokenList& tokens, const std::string& filePath) const { std::ostringstream toolinfo; toolinfo << (mSettings.cppcheckCfgProductName.empty() ? CPPCHECK_VERSION_STRING : mSettings.cppcheckCfgProductName); @@ -867,7 +867,7 @@ } toolinfo << mSettings.premiumArgs; // TODO: do we need to add more options? - mSuppressions.nomsg.dump(toolinfo); + mSuppressions.nomsg.dump(toolinfo, filePath); return preprocessor.calculateHash(tokens, toolinfo.str()); } @@ -1020,7 +1020,7 @@ if (analyzerInformation) { // Calculate hash so it can be compared with old hash / future hashes - const std::size_t hash = calculateHash(preprocessor, tokens1); + const std::size_t hash = calculateHash(preprocessor, tokens1, file.spath()); std::list<ErrorMessage> errors; if (!analyzerInformation->analyzeFile(mSettings.buildDir, file.spath(), cfgname, fileIndex, hash, errors)) { while (!errors.empty()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/cppcheck.h new/cppcheck-2.18.3/lib/cppcheck.h --- old/cppcheck-2.18.0/lib/cppcheck.h 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/cppcheck.h 2025-09-02 21:12:05.000000000 +0200 @@ -171,7 +171,7 @@ * @param tokens Token list from preprocessed file. * @return hash */ - std::size_t calculateHash(const Preprocessor &preprocessor, const simplecpp::TokenList &tokens) const; + std::size_t calculateHash(const Preprocessor &preprocessor, const simplecpp::TokenList &tokens, const std::string& filePath = {}) const; /** * @brief Check a file using stream diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/pathmatch.cpp new/cppcheck-2.18.3/lib/pathmatch.cpp --- old/cppcheck-2.18.0/lib/pathmatch.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/pathmatch.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -113,7 +113,7 @@ /* No match, try to backtrack */ if (!b.empty()) { - const auto &bp = b.top(); + const auto bp = b.top(); b.pop(); s.setpos(bp.first); t.setpos(bp.second); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/suppressions.cpp new/cppcheck-2.18.3/lib/suppressions.cpp --- old/cppcheck-2.18.0/lib/suppressions.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/suppressions.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -512,12 +512,14 @@ return isSuppressed(SuppressionList::ErrorMessage::fromErrorMessage(errmsg, macroNames)); } -void SuppressionList::dump(std::ostream & out) const +void SuppressionList::dump(std::ostream & out, const std::string& filePath) const { std::lock_guard<std::mutex> lg(mSuppressionsSync); out << " <suppressions>" << std::endl; for (const Suppression &suppression : mSuppressions) { + if (suppression.isInline && !suppression.fileName.empty() && !filePath.empty() && filePath != suppression.fileName) + continue; out << " <suppression"; out << " errorId=\"" << ErrorLogger::toxml(suppression.errorId) << '"'; if (!suppression.fileName.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/suppressions.h new/cppcheck-2.18.3/lib/suppressions.h --- old/cppcheck-2.18.0/lib/suppressions.h 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/suppressions.h 2025-09-02 21:12:05.000000000 +0200 @@ -252,7 +252,7 @@ * @brief Create an xml dump of suppressions * @param out stream to write XML to */ - void dump(std::ostream &out) const; + void dump(std::ostream &out, const std::string& filePath = {}) const; /** * @brief Returns list of unmatched local (per-file) suppressions. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/templatesimplifier.cpp new/cppcheck-2.18.3/lib/templatesimplifier.cpp --- old/cppcheck-2.18.0/lib/templatesimplifier.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/templatesimplifier.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -1766,7 +1766,7 @@ dst->previous()->linenr(start->linenr()); dst->previous()->column(start->column()); Token *previous = dst->previous(); - previous->isTemplateArg(true); + previous->templateArgFrom(typetok); previous->isSigned(typetok->isSigned()); previous->isUnsigned(typetok->isUnsigned()); previous->isLong(typetok->isLong()); @@ -2016,7 +2016,7 @@ Token::createMutualLinks(brackets1.top(), back); brackets1.pop(); } - back->isTemplateArg(true); + back->templateArgFrom(typetok); back->isUnsigned(typetok->isUnsigned()); back->isSigned(typetok->isSigned()); back->isLong(typetok->isLong()); @@ -2120,7 +2120,7 @@ Token::createMutualLinks(par1, mTokenList.back()); mTokenList.addtoken(typetok, tok3); for (Token* t = par1; t; t = t->next()) - t->isTemplateArg(true); + t->templateArgFrom(typetok); continue; } } @@ -2174,7 +2174,7 @@ brackets1.pop(); } if (copy) - back->isTemplateArg(true); + back->templateArgFrom(typetok); } if (pointerType && Token::simpleMatch(beforeTypeToken, "const")) { mTokenList.addtoken(beforeTypeToken); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/token.cpp new/cppcheck-2.18.3/lib/token.cpp --- old/cppcheck-2.18.0/lib/token.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/token.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -2720,3 +2720,10 @@ const Token* findLambdaEndScope(const Token* tok) { return findLambdaEndScope(const_cast<Token*>(tok)); } + +void Token::templateArgFrom(const Token* fromToken) { + setFlag(fIsTemplateArg, fromToken != nullptr); + mImpl->mTemplateArgFileIndex = fromToken ? fromToken->mImpl->mFileIndex : -1; + mImpl->mTemplateArgLineNumber = fromToken ? fromToken->mImpl->mLineNumber : -1; + mImpl->mTemplateArgColumn = fromToken ? fromToken->mImpl->mColumn : -1; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/token.h new/cppcheck-2.18.3/lib/token.h --- old/cppcheck-2.18.0/lib/token.h 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/token.h 2025-09-02 21:12:05.000000000 +0200 @@ -70,6 +70,11 @@ nonneg int mColumn{}; nonneg int mExprId{}; + // original template argument location + int mTemplateArgFileIndex{-1}; + int mTemplateArgLineNumber{-1}; + int mTemplateArgColumn{-1}; + /** * A value from 0-100 that provides a rough idea about where in the token * list this token is located. @@ -821,8 +826,15 @@ bool isTemplateArg() const { return getFlag(fIsTemplateArg); } - void isTemplateArg(const bool value) { - setFlag(fIsTemplateArg, value); + void templateArgFrom(const Token* fromToken); + int templateArgFileIndex() const { + return mImpl->mTemplateArgFileIndex; + } + int templateArgLineNumber() const { + return mImpl->mTemplateArgLineNumber; + } + int templateArgColumn() const { + return mImpl->mTemplateArgColumn; } const std::string& getMacroName() const { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/tokenize.cpp new/cppcheck-2.18.3/lib/tokenize.cpp --- old/cppcheck-2.18.0/lib/tokenize.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/tokenize.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -6076,8 +6076,12 @@ outs += " externLang=\"C\""; if (tok->isExpandedMacro()) outs += " macroName=\"" + tok->getMacroName() + "\""; - if (tok->isTemplateArg()) + if (tok->isTemplateArg()) { outs += " isTemplateArg=\"true\""; + outs += " templateArgFileIndex=\"" + std::to_string(tok->templateArgFileIndex()) + "\""; + outs += " templateArgLineNumber=\"" + std::to_string(tok->templateArgLineNumber()) + "\""; + outs += " templateArgColumn=\"" + std::to_string(tok->templateArgColumn()) + "\""; + } if (tok->isRemovedVoidParameter()) outs += " isRemovedVoidParameter=\"true\""; if (tok->isSplittedVarDeclComma()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/lib/version.h new/cppcheck-2.18.3/lib/version.h --- old/cppcheck-2.18.0/lib/version.h 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/lib/version.h 2025-09-02 21:12:05.000000000 +0200 @@ -30,11 +30,11 @@ #define STRINGIFY(x) STRING(x) #define STRING(VER) #VER #if CPPCHECK_BUGFIX_VERSION < 99 -#define CPPCHECK_VERSION_STRING STRINGIFY(CPPCHECK_MAJOR_VERSION) "." STRINGIFY(CPPCHECK_MINOR_VERSION) "." STRINGIFY(CPPCHECK_BUGFIX_VERSION) -#define CPPCHECK_VERSION CPPCHECK_MAJOR_VERSION,CPPCHECK_MINOR_VERSION,CPPCHECK_BUGFIX_VERSION,0 +#define CPPCHECK_VERSION_STRING "2.18.3" +#define CPPCHECK_VERSION 2,18,3,0 #else -#define CPPCHECK_VERSION_STRING STRINGIFY(CPPCHECK_MAJOR_VERSION) "." STRINGIFY(CPPCHECK_DEVMINOR_VERSION) " dev" -#define CPPCHECK_VERSION CPPCHECK_MAJOR_VERSION,CPPCHECK_MINOR_VERSION,99,0 +#define CPPCHECK_VERSION_STRING "2.18.3" +#define CPPCHECK_VERSION 2,18,3,0 #endif #define LEGALCOPYRIGHT L"Copyright (C) 2007-2025 Cppcheck team." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/man/manual-premium.md new/cppcheck-2.18.3/man/manual-premium.md --- old/cppcheck-2.18.0/man/manual-premium.md 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/man/manual-premium.md 2025-09-02 21:12:05.000000000 +0200 @@ -1272,6 +1272,21 @@ cppcheck --premium=misra-c++-2023 .... +### Checking all C and C++ files + +The `cert-c` and `misra-c-*` coding standards target C and therefore the checkers only check C files by default. + +The `autosar`, `cert-c++` and `misra-c++-*` coding standards target C++ and therefore the checkers only check C++ files by default. + +If you want to check all files you can append ":all" to the coding standard. Example: + + # Misra C checkers are executed on C files, not on C++ files + cppcheck --premium=misra-c-2025 path + + # Misra C checkers are executed on C and C++ files + cppcheck --premium=misra-c-2025:all path + + ## Compliance report ### Graphical user interface diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/man/manual.md new/cppcheck-2.18.3/man/manual.md --- old/cppcheck-2.18.0/man/manual.md 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/man/manual.md 2025-09-02 21:12:05.000000000 +0200 @@ -1,6 +1,6 @@ --- title: Cppcheck manual -subtitle: Version 2.18 +subtitle: Version 2.18.3 author: Cppcheck team lang: en documentclass: report diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/man/reference-cfg-format.md new/cppcheck-2.18.3/man/reference-cfg-format.md --- old/cppcheck-2.18.0/man/reference-cfg-format.md 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/man/reference-cfg-format.md 2025-09-02 21:12:05.000000000 +0200 @@ -1,6 +1,6 @@ --- title: Cppcheck .cfg format -subtitle: Version 2.18 +subtitle: Version 2.18.3 author: Cppcheck team lang: en documentclass: report diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/man/writing-addons.md new/cppcheck-2.18.3/man/writing-addons.md --- old/cppcheck-2.18.0/man/writing-addons.md 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/man/writing-addons.md 2025-09-02 21:12:05.000000000 +0200 @@ -1,6 +1,6 @@ --- title: Writing addons -subtitle: Version 2.18 +subtitle: Version 2.18.3 author: Cppcheck team lang: en documentclass: report diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/test/cli/inline-suppress_test.py new/cppcheck-2.18.3/test/cli/inline-suppress_test.py --- old/cppcheck-2.18.0/test/cli/inline-suppress_test.py 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/test/cli/inline-suppress_test.py 2025-09-02 21:12:05.000000000 +0200 @@ -1,10 +1,11 @@ -# python -m pytest test-inline-suppress.py +# python -m pytest inline-suppress_test.py import json import os import pytest import sys +import time from testutils import cppcheck __script_dir = os.path.dirname(os.path.abspath(__file__)) @@ -247,6 +248,35 @@ assert stdout == '' assert ret == 0, stdout +def test_build_dir_jobs_suppressions(tmpdir): #14064 + args = [ + '-q', + '--template=simple', + '--cppcheck-build-dir={}'.format(tmpdir), + '--enable=style', + '--inline-suppr', + '-j4', + 'reanalysis' + ] + + ret, stdout, stderr = cppcheck(args, cwd=__script_dir) + lines = stderr.splitlines() + assert lines == [] + assert stdout == '' + assert ret == 0, stdout + + a1Path = os.path.join(tmpdir, 'd.a1') + assert os.path.exists(a1Path) + mtimeOld = os.path.getmtime(a1Path) + + time.sleep(1) + + for _ in range(1, 10): + cppcheck(args, cwd=__script_dir) + + mtimeNew = os.path.getmtime(a1Path) + assert mtimeOld == mtimeNew + def __test_build_dir_unused_template(tmpdir, extra_args): args = [ @@ -470,4 +500,4 @@ '{}cfg.c:14:0: information: Unmatched suppression: id [unmatchedSuppression]'.format(__proj_inline_suppres_path), ] assert stdout == '' - assert ret == 0, stdout \ No newline at end of file + assert ret == 0, stdout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/test/cli/reanalysis/a.cpp new/cppcheck-2.18.3/test/cli/reanalysis/a.cpp --- old/cppcheck-2.18.0/test/cli/reanalysis/a.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/cppcheck-2.18.3/test/cli/reanalysis/a.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -0,0 +1,4 @@ +int main() { + int i; // cppcheck-suppress unusedVariable +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/test/cli/reanalysis/b.cpp new/cppcheck-2.18.3/test/cli/reanalysis/b.cpp --- old/cppcheck-2.18.0/test/cli/reanalysis/b.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/cppcheck-2.18.3/test/cli/reanalysis/b.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -0,0 +1,2 @@ +int main() {} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/test/cli/reanalysis/c.cpp new/cppcheck-2.18.3/test/cli/reanalysis/c.cpp --- old/cppcheck-2.18.0/test/cli/reanalysis/c.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/cppcheck-2.18.3/test/cli/reanalysis/c.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -0,0 +1,2 @@ +int main() {} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/test/cli/reanalysis/d.cpp new/cppcheck-2.18.3/test/cli/reanalysis/d.cpp --- old/cppcheck-2.18.0/test/cli/reanalysis/d.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/cppcheck-2.18.3/test/cli/reanalysis/d.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -0,0 +1,2 @@ +int main() {} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/test/testcmdlineparser.cpp new/cppcheck-2.18.3/test/testcmdlineparser.cpp --- old/cppcheck-2.18.0/test/testcmdlineparser.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/test/testcmdlineparser.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -236,6 +236,7 @@ TEST_CASE(premiumOptions3); TEST_CASE(premiumOptions4); TEST_CASE(premiumOptions5); + TEST_CASE(premiumOptionsAll); TEST_CASE(premiumOptionsMetrics); TEST_CASE(premiumOptionsCertCIntPrecision); TEST_CASE(premiumOptionsLicenseFile); @@ -1456,6 +1457,23 @@ ASSERT_EQUALS(false, settings->severity.isEnabled(Severity::warning)); } + void premiumOptionsAll() { + REDIRECT; + asPremium(); + const char * const argv[] = { + "cppcheck", + "--premium=autosar:all", + "--premium=cert-c:all", + "--premium=cert-c++:all", + "--premium=misra-c-2023:all", + "--premium=misra-c++-2023:all", + "file.c" + }; + ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parseFromArgs(argv)); + ASSERT_EQUALS("--autosar:all --cert-c:all --cert-c++:all --misra-c-2023:all --misra-c++-2023:all", + settings->premiumArgs); + } + void premiumOptionsMetrics() { REDIRECT; asPremium(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/test/testsimplifytemplate.cpp new/cppcheck-2.18.3/test/testsimplifytemplate.cpp --- old/cppcheck-2.18.0/test/testsimplifytemplate.cpp 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/test/testsimplifytemplate.cpp 2025-09-02 21:12:05.000000000 +0200 @@ -314,6 +314,8 @@ TEST_CASE(explicitBool2); TEST_CASE(templateArgPreserveType); // #13882 - type of template argument + + TEST_CASE(dumpTemplateArgFrom); } struct CheckOptions @@ -333,6 +335,20 @@ return tokenizer.tokens()->stringifyList(nullptr, true); } +#define dump(...) dump_(__FILE__, __LINE__, __VA_ARGS__) + template<size_t size> + std::string dump_(const char* file, int line, const char (&code)[size], const CheckOptions& options = make_default_obj()) { + const Settings settings1 = settingsBuilder(settings).library("std.cfg").debugwarnings(options.debugwarnings).build(); + SimpleTokenizer tokenizer(settings1, *this); + + ASSERT_LOC(tokenizer.tokenize(code), file, line); + + std::ostringstream ostr; + (tokenizer.dump)(ostr); + + return ostr.str(); + } + void template1() { const char code[] = "template <class T> T f(T val) { T a; }\n" "f<int>(10);"; @@ -6623,6 +6639,30 @@ "class Test<64> { uint32_t i ; i = ( uint32_t ) 64 ; } ;", tok(code)); } + + void dumpTemplateArgFrom() { + const char code[] = "template<class T> void foo(T t) {}\n" + "foo<int>(23);"; + const std::string d = dump(code); + ASSERT(!d.empty()); + + // Assert that first 'int' token has templateArg location info + const std::string::size_type strpos1 = d.find(" str=\"int\" "); + ASSERT(strpos1 < d.size()); + const std::string::size_type endpos1 = d.find('>', strpos1); + const std::string::size_type templateArgPos1 = d.find(" templateArgFileIndex=\"0\" templateArgLineNumber=\"2\" templateArgColumn=\"5\""); + ASSERT(templateArgPos1 > strpos1 && templateArgPos1 < endpos1); + + // Assert that second 'int' token has templateArg location info + const std::string::size_type strpos2 = d.find(" str=\"int\" ", endpos1); + ASSERT(strpos2 < d.size()); + const std::string::size_type endpos2 = d.find('>', strpos2); + const std::string::size_type templateArgPos2 = d.find(" templateArgFileIndex=\"0\" templateArgLineNumber=\"2\" templateArgColumn=\"5\"", endpos1); + ASSERT(templateArgPos2 > strpos2 && templateArgPos2 < endpos2); + + // Assert there is no further unexpected templateArg location info + ASSERT(d.find(" templateArg", endpos2) == std::string::npos); + } }; REGISTER_TEST(TestSimplifyTemplate) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cppcheck-2.18.0/win_installer/productInfo.wxi new/cppcheck-2.18.3/win_installer/productInfo.wxi --- old/cppcheck-2.18.0/win_installer/productInfo.wxi 2025-07-20 12:15:59.000000000 +0200 +++ new/cppcheck-2.18.3/win_installer/productInfo.wxi 2025-09-02 21:12:05.000000000 +0200 @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <Include> - <?define ProductName = "Cppcheck $(var.Platform) 2.18.0.0" ?> + <?define ProductName = "Cppcheck $(var.Platform) 2.18.3" ?> <?define ProductNameShort = "Cppcheck" ?> - <?define ProductVersion = "2.18.0.0" ?> + <?define ProductVersion = "2.18.3" ?> <?define ProductManufacturer = "The Cppcheck team" ?> <?define ProductDescription = "Cppcheck is a tool for static analysis of C/C++ code" ?>
