Examples of errors detected by the V766 diagnostic
V766. An item with the same key has already been added.
Chromium
V766 An item with the same key '"colorSectionBorder"' has already been added. ntp_resource_cache.cc 581
void NTPResourceCache::CreateNewTabCSS()
{
....
// Colors.
substitutions["colorBackground"] =
SkColorToRGBAString(color_background);
substitutions["backgroundBarDetached"] =
GetNewTabBackgroundCSS(tp, false);
substitutions["backgroundBarAttached"] =
GetNewTabBackgroundCSS(tp, true);
substitutions["backgroundTiling"] =
GetNewTabBackgroundTilingCSS(tp);
substitutions["colorTextRgba"] =
SkColorToRGBAString(color_text);
substitutions["colorSectionBorder"] =
SkColorToRGBAString(color_section_border); // <=
substitutions["colorTextLight"] =
SkColorToRGBAString(color_text_light);
substitutions["colorSectionBorder"] =
SkColorToRGBComponents(color_section_border); // <=
substitutions["colorText"] =
SkColorToRGBComponents(color_text);
....
}
MuseScore
V766 An item with the same key '"mrcs"' has already been added. importgtp-gp6.cpp 100
const static std::map<QString, QString> instrumentMapping = {
....
{"e-piano-gs", "electric-piano"},
{"e-piano-ss", "electric-piano"},
{"hrpch-gs", "harpsichord"},
{"hrpch-ss", "harpsichord"},
{"mrcs", "maracas"}, // <=
{"mrcs", "oboe"}, // <=
{"mrcs", "oboe"}, // <= using of Copy-Paste
....
};
Android
V766 CWE-462 An item with the same key '"oem_lpass_cfg"' has already been added. bootstat.cpp 264
const std::map<std::string, int32_t> kBootReasonMap = {
....
{"watchdog_sdi_apps_reset", 106},
{"smpl", 107},
{"oem_modem_failed_to_powerup", 108},
{"reboot_normal", 109},
{"oem_lpass_cfg", 110}, // <=
{"oem_xpu_ns_error", 111}, // <=
{"power_key_press", 112},
{"hardware_reset", 113},
{"reboot_by_powerkey", 114},
{"reboot_verity", 115},
{"oem_rpm_undef_error", 116},
{"oem_crash_on_the_lk", 117},
{"oem_rpm_reset", 118},
{"oem_lpass_cfg", 119}, // <=
{"oem_xpu_ns_error", 120}, // <=
{"factory_cable", 121},
{"oem_ar6320_failed_to_powerup", 122},
{"watchdog_rpm_bite", 123},
{"power_on_cable", 124},
{"reboot_unknown", 125},
....
};
Similar errors can be found in some other places:
- V766 CWE-462 An item with the same key '"oem_xpu_ns_error"' has already been added. bootstat.cpp 265
NCBI Genome Workbench
V766 An item with the same key 'kArgRemote' has already been added. blast_args.cpp 3262
void
CBlastAppArgs::x_IssueWarningsForIgnoredOptions(const CArgs& args)
{
set<string> can_override;
....
can_override.insert(kArgOutputFormat);
can_override.insert(kArgNumDescriptions);
can_override.insert(kArgNumAlignments);
can_override.insert(kArgMaxTargetSequences);
can_override.insert(kArgRemote); // <=
can_override.insert(kArgNumThreads);
can_override.insert(kArgInputSearchStrategy);
can_override.insert(kArgRemote); // <=
can_override.insert("remote_verbose");
can_override.insert("verbose");
....
}
RPCS3
V766 An item with the same key '0x120' has already been added. evdev_joystick_handler.h 135
class evdev_joystick_handler final : public PadHandlerBase
{
const std::unordered_map<u32, std::string> button_list =
{
// ....
{ 0x11d , "0x11d" },
{ 0x11e , "0x11e" },
{ 0x11f , "0x11f" },
{ BTN_JOYSTICK , "Joystick" }, // <=
{ BTN_TRIGGER , "Trigger" }, // <=
{ BTN_THUMB , "Thumb" },
{ BTN_THUMB2 , "Thumb 2" },
{ BTN_TOP , "Top" },
{ BTN_TOP2 , "Top 2" },
{ BTN_PINKIE , "Pinkie" },
// ....
}
}
At first glance at code, it is not clear which two keys are the same. It turns out that BTN_JOYSTICK and BTN_TRIGGER are Linux API constants that equals 0x120. (https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/input-event-codes.h#L365) BTN_JOYSTICK is the starting value of the joystick signal constant group and BTN_TRIGGER is the very first constant in the list of that group. Therefore, their values are the same.
CodeLite
V766 An item with the same key ''.'' has already been added. wxCodeCompletionBoxManager.cpp:19
std::unordered_set<wxChar> delimiters =
{ ':', '@', '.', '!', ' ', '\t', '.', '\\',
'+', '*', '-', '<', '>', '[', ']', '(',
')', '{', '}', '=', '%', '#', '^', '&',
'\'', '"', '/', '|', ',', '~', ';', '`' };
Similar errors can be found in some other places:
- V766 An item with the same key '"MSYS2/GCC"' has already been added. compiler.cpp:621, compiler.cpp:620
OpenVINO
V766 An item with the same key '"Abs"' has already been added. cpu_types.cpp 178
static const TypeToNameMap& get_type_to_name_tbl() {
static const TypeToNameMap type_to_name_tbl = {
....,
{"Abs", Type::Eltwise},
....,
{"SoftPlus", Type::Eltwise},
....,
{"Abs", Type::Math},
....,
{"SoftPlus", Type::Math},
....,
};
return type_to_name_tbl;
}
Similar errors can be found in some other places:
- V766 An item with the same key '"SoftPlus"' has already been added. cpu_types.cpp 198