Skip to content

Commit c56d4db

Browse files
Merge branch 'main' into chr_11522
2 parents 0cde666 + d6f30e4 commit c56d4db

25 files changed

Lines changed: 208 additions & 35 deletions

.github/workflows/CI-unixish.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,15 @@ jobs:
571571
warnings="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar"
572572
g++ $warnings -c -Ilib -Iexternals/tinyxml2 democlient/democlient.cpp
573573
574+
- name: Test disabled executors
575+
if: matrix.os == 'ubuntu-22.04'
576+
run: |
577+
g++ -Ilib -c cli/threadexecutor.cpp -DDISALLOW_THREAD_EXECUTOR
578+
test -z "$(nm threadexecutor.o)"
579+
g++ -Ilib -c cli/processexecutor.cpp -DDISALLOW_PROCESS_EXECUTOR
580+
test -z "$(nm processexecutor.o)"
581+
# TODO: test NO_* defines
582+
574583
- name: Show all ignored files
575584
if: false # TODO: currently lists all the contents of ignored folders - we only need what actually matched
576585
run: |

.github/workflows/selfcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
122122
- name: Self check (unusedFunction / no test / no gui)
123123
run: |
124-
supprs="--suppress=unusedFunction:lib/errorlogger.h:193 --suppress=unusedFunction:lib/importproject.cpp:1508 --suppress=unusedFunction:lib/importproject.cpp:1532"
124+
supprs="--suppress=unusedFunction:lib/errorlogger.h:193 --suppress=unusedFunction:lib/importproject.cpp:1516 --suppress=unusedFunction:lib/importproject.cpp:1540"
125125
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib -D__CPPCHECK__ -D__GNUC__ --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest_nogui/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr $supprs
126126
env:
127127
DISABLE_VALUEFLOW: 1

cli/processexecutor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#include "processexecutor.h"
2424

25-
#if !defined(_WIN32) && !defined(__MINGW32__)
25+
#ifdef HAS_THREADING_MODEL_FORK
2626

2727
#include "cppcheck.h"
2828
#include "errorlogger.h"
@@ -471,4 +471,4 @@ void ProcessExecutor::reportInternalChildErr(const std::string &childname, const
471471
mErrorLogger.reportErr(errmsg);
472472
}
473473

474-
#endif // !WIN32
474+
#endif // HAS_THREADING_MODEL_FORK

cli/processexecutor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#ifndef PROCESSEXECUTOR_H
2020
#define PROCESSEXECUTOR_H
2121

22+
#include "config.h"
23+
24+
#ifdef HAS_THREADING_MODEL_FORK
25+
2226
#include "cppcheck.h"
2327
#include "executor.h"
2428

@@ -72,4 +76,6 @@ class ProcessExecutor : public Executor {
7276

7377
/// @}
7478

79+
#endif // HAS_THREADING_MODEL_FORK
80+
7581
#endif // PROCESSEXECUTOR_H

cli/threadexecutor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
#include "threadexecutor.h"
2020

21+
#ifdef HAS_THREADING_MODEL_THREAD
22+
2123
#include "config.h"
2224
#include "cppcheck.h"
2325
#include "errorlogger.h"
@@ -219,3 +221,5 @@ unsigned int ThreadExecutor::check()
219221

220222
return result;
221223
}
224+
225+
#endif // HAS_THREADING_MODEL_THREAD

cli/threadexecutor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#ifndef THREADEXECUTOR_H
2020
#define THREADEXECUTOR_H
2121

22+
#include "config.h"
23+
24+
#ifdef HAS_THREADING_MODEL_THREAD
25+
2226
#include "cppcheck.h"
2327
#include "executor.h"
2428

@@ -52,4 +56,6 @@ class ThreadExecutor : public Executor {
5256

5357
/// @}
5458

59+
#endif // HAS_THREADING_MODEL_THREAD
60+
5561
#endif // THREADEXECUTOR_H

cmake/compilerDefinitions.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ if(DISALLOW_THREAD_EXECUTOR)
5050
add_definitions(-DDISALLOW_THREAD_EXECUTOR)
5151
endif()
5252

53+
if(DISALLOW_PROCESS_EXECUTOR)
54+
add_definitions(-DDISALLOW_PROCESS_EXECUTOR)
55+
endif()
56+
5357
if(MSVC AND DISABLE_CRTDBG_MAP_ALLOC)
5458
add_definitions(-DDISABLE_CRTDBG_MAP_ALLOC)
5559
endif()

cmake/options.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ option(DISALLOW_THREAD_EXECUTOR "Disallow usage of ThreadExecutor for -j"
9292
if(DISALLOW_THREAD_EXECUTOR AND WIN32)
9393
message(FATAL_ERROR "Cannot disable usage of ThreadExecutor on Windows as no other executor implementation is currently available")
9494
endif()
95+
option(DISALLOW_PROCESS_EXECUTOR "Disallow usage of ProcessExecutor for -j" OFF)
96+
if(DISALLOW_THREAD_EXECUTOR AND DISALLOW_PROCESS_EXECUTOR)
97+
message(FATAL_ERROR "Cannot disable both ThreadExecutor and ProcessExecutor")
98+
endif()
9599
set(USE_BOOST "Auto" CACHE STRING "Usage of Boost")
96100
set_property(CACHE USE_BOOST PROPERTY STRINGS Auto Off On)
97101
option(USE_BOOST_INT128 "Usage of Boost.Multiprecision 128-bit integer for Mathlib" OFF)

cmake/printInfo.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ if(HAVE_RULES)
7878
endif()
7979
message(STATUS)
8080
message(STATUS "DISALLOW_THREAD_EXECUTOR = ${DISALLOW_THREAD_EXECUTOR}")
81+
message(STATUS "DISALLOW_PROCESS_EXECUTOR = ${DISALLOW_PROCESS_EXECUTOR}")
8182
message(STATUS "CMAKE_THREAD_LIBS_INIT = ${CMAKE_THREAD_LIBS_INIT}")
8283
message(STATUS)
8384
message(STATUS "USE_BUNDLED_TINYXML2 = ${USE_BUNDLED_TINYXML2}")

htmlreport/cppcheck-htmlreport

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def filter_button(enabled_filters, id, function):
412412
enabled = enabled_filters.get(id, False)
413413
if not id:
414414
id = 'None'
415-
return '\n <label class="checkBtn%s"><input type="checkbox" onclick="%s(this)" id="%s"%s/>%s</label>'\
415+
return '\n <label class="checkBtn%s"><input type="checkbox" onclick="%s(this)" id="%s" %s>%s</label>'\
416416
% (' disabled' if not enabled else '', function, id, 'checked' if enabled else 'disabled', id)
417417

418418
def filter_bar(enabled):
@@ -428,8 +428,8 @@ def filter_bar(enabled):
428428
, classification_bar
429429
,''.join([filter_button(enabled, tool, 'toggleTool') for tool in ['cppcheck', 'clang-tidy']])
430430
,'\n | '
431-
,'\n <label class="severityHeader">File: <input type="search" oninput="filterFile(this.value)"/></label>'
432-
,'\n <label class="severityHeader">Filter: <input type="search" oninput="filterText(this.value)"/></label>'
431+
,'\n <label class="severityHeader">File: <input type="search" oninput="filterFile(this.value)"></label>'
432+
,'\n <label class="severityHeader">Filter: <input type="search" oninput="filterText(this.value)"></label>'
433433
,'\n </div>\n'])
434434
def git_blame(errors, path, file, blame_options):
435435
last_line= errors[-1]['line']
@@ -837,8 +837,8 @@ def main() -> None:
837837
lexer = guess_lexer(content, stripnl=False)
838838
except ClassNotFound:
839839
sys.stderr.write("ERROR: Couldn't determine lexer for the file' " + source_filename + " '. Won't be able to syntax highlight this file.")
840-
output_file.write("\n <tr><td colspan=\"5\"> Could not generate content because pygments failed to determine the code type.</td></tr>")
841-
output_file.write("\n <tr><td colspan=\"5\"> Sorry about this.</td></tr>")
840+
output_file.write("\n <tr><td colspan=\"6\"> Could not generate content because pygments failed to determine the code type.</td></tr>")
841+
output_file.write("\n <tr><td colspan=\"6\"> Sorry about this.</td></tr>")
842842
continue
843843

844844
if options.source_encoding:
@@ -932,10 +932,10 @@ def main() -> None:
932932
htmlfile = data.get('htmlfile') if is_file else None
933933

934934
output_file.write("\n <tbody class=\"fileEntry\">")
935-
output_file.write("\n <tr><td colspan=\"5\">%s</td></tr>" % row_content)
935+
output_file.write("\n <tr><td colspan=\"6\">%s</td></tr>" % row_content)
936936

937937
if filename in decode_errors:
938-
output_file.write("\n <tr><td colspan=\"5\">Could not generated due to UnicodeDecodeError</td></tr>")
938+
output_file.write("\n <tr><td colspan=\"6\">Could not generated due to UnicodeDecodeError</td></tr>")
939939

940940
sorted_errors = sorted(data['errors'], key=lambda k: k['line'])
941941
blame_data = git_blame(sorted_errors, source_dir, filename, blame_options) if add_author_information else []

0 commit comments

Comments
 (0)