Skip to content

Commit 9503fe9

Browse files
committed
change option for controlling deduplication
deduplicate by default
1 parent ff51794 commit 9503fe9

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

cli/cmdlineparser.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
250250
fs.computeHash();
251251
}
252252

253-
if (mSettings.deduplicate) {
253+
if (!mSettings.recheckProjectDuplicates) {
254254
auto it = fileSettings.begin();
255255
while (it != fileSettings.end()) {
256256
fileSettings.erase(std::remove_if(std::next(it), fileSettings.end(), [&](const FileSettings& fs) {
@@ -651,8 +651,8 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
651651
else if (std::strcmp(argv[i], "--debug-clang-output") == 0)
652652
mSettings.debugClangOutput = true;
653653

654-
else if (std::strcmp(argv[i], "--deduplicate") == 0)
655-
mSettings.deduplicate = true;
654+
else if (std::strcmp(argv[i], "--recheck-project-duplicates") == 0)
655+
mSettings.recheckProjectDuplicates = true;
656656

657657
// Show debug messages for ignored files
658658
else if (std::strcmp(argv[i], "--debug-ignore") == 0)
@@ -1721,8 +1721,10 @@ void CmdLineParser::printHelp() const
17211721
" be considered for evaluation.\n"
17221722
" --config-excludes-file=<file>\n"
17231723
" A file that contains a list of config-excludes\n"
1724-
" --deduplicate Remove duplicate entries when reading project files.\n"
1725-
" Takes both compilation flags and filenames in to account.\n"
1724+
" --recheck-project-duplicates\n"
1725+
" When using the --project option, files with identical\n"
1726+
" names and compiler flags are deduplicated by default.\n"
1727+
" This option forces cppcheck to check all imported files.\n"
17261728
" --disable=<id> Disable individual checks.\n"
17271729
" Please refer to the documentation of --enable=<id>\n"
17281730
" for further details.\n"

lib/settings.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ class CPPCHECKLIB WARN_UNUSED Settings {
220220
/** @brief Do not filter duplicated errors. */
221221
bool emitDuplicates{};
222222

223-
/** @brief De-duplicate files with identical path and config. */
224-
bool deduplicate{};
223+
/** @brief Recheck project files with identical path and config. */
224+
bool recheckProjectDuplicates{};
225225

226226
/** @brief Name of the language that is enforced. Empty per default. */
227227
Standards::Language enforcedLang{};

man/cppcheck.1.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
151151
<option>--config-excludes-file=&lt;file&gt;</option>
152152
</arg>
153153
<arg choice="opt">
154-
<option>--deduplicate</option>
154+
<option>--recheck-project-duplicates</option>
155155
</arg>
156156
<arg choice="opt">
157157
<option>--include=&lt;file&gt;</option>
@@ -446,10 +446,10 @@ First given path is searched for contained header files first. If paths are rela
446446
</varlistentry>
447447
<varlistentry>
448448
<term>
449-
<option>--deduplicate</option>
449+
<option>--recheck-project-duplicates</option>
450450
</term>
451451
<listitem>
452-
<para>Remove duplicate entries when reading project files. Takes both compilation flags and filenames in to account.</para>
452+
<para>When using the --project option, files with identical names and compiler flags are deduplicated by default. This option forces cppcheck to check all imported files.</para>
453453
</listitem>
454454
</varlistentry>
455455
<varlistentry>

0 commit comments

Comments
 (0)