MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / hasDefine

Function hasDefine

lib/preprocessor.cpp:519–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517}
518
519static bool hasDefine(const std::string &userDefines, const std::string &cfgStr)
520{
521 if (cfgStr.empty()) {
522 return false;
523 }
524
525 std::string::size_type pos = 0;
526 const std::string cfgname = cfgStr.substr(0, cfgStr.find('='));
527 while (pos < userDefines.size()) {
528 pos = userDefines.find(cfgname, pos);
529 if (pos == std::string::npos)
530 break;
531 const std::string::size_type pos2 = pos + cfgname.size();
532 if ((pos == 0 || userDefines[pos-1U] == ';') && (pos2 == userDefines.size() || userDefines[pos2] == '='))
533 return true;
534 pos = pos2;
535 }
536 return false;
537}
538
539static std::string cfg(const std::vector<std::string> &configs, const std::string &userDefines)
540{

Callers 2

cfgFunction · 0.85
getConfigsElseIsFalseFunction · 0.85

Calls 3

emptyMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected