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

Fix #13265 (generate lib/checkers.cpp, update id mappings) #6953

Merged
merged 3 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ LIBOBJ = $(libcppdir)/valueflow.o \
$(libcppdir)/checkclass.o \
$(libcppdir)/checkcondition.o \
$(libcppdir)/checkers.o \
$(libcppdir)/checkersidmapping.o \
$(libcppdir)/checkersreport.o \
$(libcppdir)/checkexceptionsafety.o \
$(libcppdir)/checkfunctions.o \
Expand Down Expand Up @@ -529,6 +530,9 @@ $(libcppdir)/checkcondition.o: lib/checkcondition.cpp lib/addoninfo.h lib/astuti
$(libcppdir)/checkers.o: lib/checkers.cpp lib/checkers.h lib/config.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkers.cpp

$(libcppdir)/checkersidmapping.o: lib/checkersidmapping.cpp lib/checkers.h lib/config.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkersidmapping.cpp

$(libcppdir)/checkersreport.o: lib/checkersreport.cpp lib/addoninfo.h lib/checkers.h lib/checkersreport.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkersreport.cpp

Expand Down
18 changes: 6 additions & 12 deletions gui/resultstree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,25 +262,19 @@ void ResultsTree::keyPressEvent(QKeyEvent *event)
void ResultsTree::setReportType(ReportType reportType) {
mReportType = reportType;

auto readInfo = [this](const std::vector<checkers::Info>& info) {
for (const auto& i: info)
for (const QString& cppcheckId: QString(i.cppcheckIds).split(","))
mGuideline[cppcheckId] = QString(i.guideline).toUpper();
};

auto readIdMapping = [this](const std::vector<checkers::IdMapping>& idMapping) {
auto readIdMapping = [this](const std::vector<checkers::IdMapping>& idMapping, const char* ext = "") {
for (const auto& i: idMapping)
for (const QString& cppcheckId: QString(i.cppcheckId).split(","))
mGuideline[cppcheckId] = i.guideline;
mGuideline[cppcheckId] = QString(i.guideline) + ext;
};

if (reportType == ReportType::autosar)
readInfo(checkers::autosarInfo);
readIdMapping(checkers::idMappingAutosar);
else if (reportType == ReportType::certC)
readInfo(checkers::certCInfo);
readIdMapping(checkers::idMappingCertC, "-C");
else if (reportType == ReportType::certCpp) {
readInfo(checkers::certCInfo);
readInfo(checkers::certCppInfo);
readIdMapping(checkers::idMappingCertC, "-C");
readIdMapping(checkers::idMappingCertCpp, "-CPP");
}
else if (reportType == ReportType::misraC)
readIdMapping(checkers::idMappingMisraC);
Expand Down
1 change: 1 addition & 0 deletions gui/test/resultstree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ add_executable(test-resultstree
${CMAKE_SOURCE_DIR}/gui/report.cpp
${CMAKE_SOURCE_DIR}/gui/xmlreportv2.cpp
${CMAKE_SOURCE_DIR}/lib/checkers.cpp
${CMAKE_SOURCE_DIR}/lib/checkersidmapping.cpp
)
target_include_directories(test-resultstree PRIVATE ${CMAKE_SOURCE_DIR}/gui ${CMAKE_SOURCE_DIR}/lib)
target_compile_definitions(test-resultstree PRIVATE SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
3 changes: 2 additions & 1 deletion gui/test/resultstree/resultstree.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ SOURCES += testresultstree.cpp \
../../showtypes.cpp \
../../report.cpp \
../../xmlreportv2.cpp \
../../../lib/checkers.cpp
../../../lib/checkers.cpp \
../../../lib/checkersidmapping.cpp

HEADERS += testresultstree.h \
../../resultstree.h \
Expand Down
Loading
Loading