diff --git a/src/lib/support/CHIPArgParser.cpp b/src/lib/support/CHIPArgParser.cpp index 91b6dfefb8ab74..d762da772d61f1 100644 --- a/src/lib/support/CHIPArgParser.cpp +++ b/src/lib/support/CHIPArgParser.cpp @@ -77,8 +77,6 @@ static void PutStringWithNewLine(FILE * s, const char * str); static void PutStringWithBlankLine(FILE * s, const char * str); #if CHIP_CONFIG_ENABLE_ARG_PARSER_VALIDITY_CHECKS static bool SanityCheckOptions(OptionSet * optSets[]); -static bool HelpTextContainsLongOption(const char * optName, const char * helpText); -static bool HelpTextContainsShortOption(char optChar, const char * helpText); #endif // CHIP_CONFIG_ENABLE_ARG_PARSER_VALIDITY_CHECKS static inline bool IsShortOptionChar(int ch) @@ -1511,53 +1509,9 @@ static bool SanityCheckOptions(OptionSet * optSets[]) } } - // Fail if the option help texts do not contain a description for each option, including both - // the option's long and short forms. - for (OptionSet ** optSetP = optSets; *optSetP != nullptr; optSetP++) - for (OptionDef * optionDef = (*optSetP)->OptionDefs; optionDef->Name != nullptr; optionDef++) - { - if (!HelpTextContainsLongOption(optionDef->Name, (*optSetP)->OptionHelp)) - { - PrintArgError("INTERNAL ERROR: No help text defined for option: --%s\n", optionDef->Name); - res = false; - } - - if (IsShortOptionChar(optionDef->Id) && - !HelpTextContainsShortOption(static_cast(optionDef->Id), (*optSetP)->OptionHelp)) - { - PrintArgError("INTERNAL ERROR: No help text defined for option: -%c\n", optionDef->Id); - res = false; - } - } - return res; } -static bool HelpTextContainsLongOption(const char * optName, const char * helpText) -{ - size_t nameLen = strlen(optName); - - for (const char * p = helpText; (p = strstr(p, optName)) != nullptr; p += nameLen) - if ((p - helpText) >= 2 && p[-1] == '-' && p[-2] == '-' && !isalnum(p[nameLen]) && p[nameLen] != '-') - return true; - - return false; -} - -static bool HelpTextContainsShortOption(char optChar, const char * helpText) -{ - char optStr[3]; - optStr[0] = '-'; - optStr[1] = optChar; - optStr[2] = 0; - - for (const char * p = helpText; (p = strstr(p, optStr)) != nullptr; p += 2) - if ((p == helpText || (!isalnum(p[-1]) && p[-1] != '-')) && !isalnum(p[2]) && p[2] != '-') - return true; - - return false; -} - #endif // CHIP_CONFIG_ENABLE_ARG_PARSER_VALIDITY_CHECKS } // namespace ArgParser