Skip to content

Commit 95ea2ae

Browse files
authored
Merge pull request #2745 from Nekto89/feature/cppcheck_2_15
Cppcheck 2.15.0 support
2 parents 68854cc + af3f198 commit 95ea2ae

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

cxx-sensors/src/main/resources/cppcheck.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8111,6 +8111,20 @@ Pointer arithmetic overflow.
81118111
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
81128112
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
81138113
</rule>
8114+
<!-- ########### New in Cppcheck 2.15.0 ########### -->
8115+
<rule>
8116+
<key>suspiciousFloatingPointCast</key>
8117+
<name>Floating-point cast causes loss of precision</name>
8118+
<description><![CDATA[
8119+
<p>
8120+
If this cast is not intentional, remove it to avoid loss of precision
8121+
</p>
8122+
<h2>References</h2>
8123+
<p><a href="https://cwe.mitre.org/data/definitions/398.html" target="_blank">CWE-398</a></p>
8124+
]]></description>
8125+
<tag>cwe</tag>
8126+
<severity>MINOR</severity>
8127+
</rule>
81148128
<!-- ########### Internal Cppcheck errors (not in errorlist) ########### -->
81158129
<rule>
81168130
<key>internalAstError</key>

cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void createRulesTest() {
3737
def.define(context);
3838

3939
RulesDefinition.Repository repo = context.repository(CxxCppCheckRuleRepository.KEY);
40-
assertThat(repo.rules()).hasSize(685);
40+
assertThat(repo.rules()).hasSize(686);
4141
}
4242

4343
}

cxx-sensors/src/tools/generate_cppcheck_resources.cmd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ SET SCRIPT_DIR=%~dp0
55
SET CPPCHECK_DIR=C:\Program Files\Cppcheck\
66
SET PYTHON_DIR=C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\
77

8-
SET CPPCHECK_LIBRARY_ARGS=--library=avr.cfg --library=bento4.cfg --library=boost.cfg --library=bsd.cfg --library=cairo.cfg --library=cppcheck-lib.cfg --library=cppunit.cfg --library=dpdk.cfg --library=embedded_sql.cfg --library=emscripten.cfg --library=ginac.cfg --library=gnu.cfg --library=googletest.cfg --library=gtk.cfg --library=icu.cfg --library=kde.cfg --library=libcerror.cfg --library=libcurl.cfg --library=libsigc++.cfg --library=lua.cfg --library=mfc.cfg --library=microsoft_atl.cfg --library=microsoft_sal.cfg --library=microsoft_unittest.cfg --library=motif.cfg --library=nspr.cfg --library=ntl.cfg --library=opencv2.cfg --library=opengl.cfg --library=openmp.cfg --library=openssl.cfg --library=pcre.cfg --library=posix.cfg --library=python.cfg --library=qt.cfg --library=ruby.cfg --library=sdl.cfg --library=sfml.cfg --library=sqlite3.cfg --library=std.cfg --library=tinyxml2.cfg --library=vcl.cfg --library=windows.cfg --library=wxsqlite3.cfg --library=wxsvg.cfg --library=wxwidgets.cfg --library=zlib.cfg
8+
setlocal ENABLEDELAYEDEXPANSION
9+
10+
SET CPPCHECK_LIBRARY_ARGS=
11+
12+
for %%i in ("%CPPCHECK_DIR%cfg\*.cfg") do (
13+
SET CPPCHECK_LIBRARY_ARGS=!CPPCHECK_LIBRARY_ARGS! "--library=%%~nxi"
14+
)
915

1016
rem download cwec_latest.xml.zip and extract it to unzip cwec_vx.y.xml
1117
rem wget https://cwe.mitre.org/data/xml/cwec_latest.xml.zip --output-document=cwec_latest.xml.zip && unzip -j -o cwec_latest.xml.zip

0 commit comments

Comments
 (0)