static void setInputFileParametersCommon (inputFileInfo *finfo, vString *const fileName, const langType language, stringList *holder) { if (finfo->name != NULL) vStringDelete (finfo->name); finfo->name = fileName; if (finfo->tagPath != NULL) { if (holder) stringListAdd (holder, finfo->tagPath); else vStringDelete (finfo->tagPath); } if (0) ; else if ( Option.tagRelative == TREL_ALWAYS ) finfo->tagPath = vStringNewOwn (relativeFilename (vStringValue (fileName), getTagFileDirectory ())); else if ( Option.tagRelative == TREL_NEVER ) finfo->tagPath = vStringNewOwn (absoluteFilename (vStringValue (fileName))); else if ( Option.tagRelative == TREL_NO || isAbsolutePath (vStringValue (fileName)) ) finfo->tagPath = vStringNewCopy (fileName); else finfo->tagPath = vStringNewOwn (relativeFilename (vStringValue (fileName), getTagFileDirectory ())); finfo->isHeader = isIncludeFile (vStringValue (fileName)); }
static void setSourceFileParameters (vString *const fileName) { if (File.source.name != NULL) vStringDelete (File.source.name); File.source.name = fileName; if (File.source.tagPath != NULL) eFree (File.source.tagPath); if (! Option.tagRelative || isAbsolutePath (vStringValue (fileName))) File.source.tagPath = eStrdup (vStringValue (fileName)); else File.source.tagPath = relativeFilename (vStringValue (fileName), TagFile.directory); if (vStringLength (fileName) > TagFile.max.file) TagFile.max.file = vStringLength (fileName); File.source.isHeader = isIncludeFile (vStringValue (fileName)); File.source.language = getFileLanguage (vStringValue (fileName)); }
static void setInputFileParametersCommon (inputFileInfo *finfo, vString *const fileName, const langType language, stringList *holder) { if (finfo->name != NULL) vStringDelete (finfo->name); finfo->name = fileName; if (finfo->tagPath != NULL) { if (holder) stringListAdd (holder, finfo->tagPath); else vStringDelete (finfo->tagPath); } if (! Option.tagRelative || isAbsolutePath (vStringValue (fileName))) finfo->tagPath = vStringNewCopy (fileName); else finfo->tagPath = vStringNewOwn (relativeFilename (vStringValue (fileName), TagFile.directory)); finfo->isHeader = isIncludeFile (vStringValue (fileName)); finfo->language = language; }
static void inlineSuppressions(const simplecpp::TokenList &tokens, Settings &_settings) { std::list<std::string> suppressionIDs; for (const simplecpp::Token *tok = tokens.cfront(); tok; tok = tok->next) { if (tok->comment) { std::istringstream iss(tok->str.substr(2)); std::string word; iss >> word; if (word != "cppcheck-suppress") continue; iss >> word; if (iss) suppressionIDs.push_back(word); continue; } if (suppressionIDs.empty()) continue; // Relative filename std::string relativeFilename(tok->location.file()); if (_settings.relativePaths) { for (std::size_t j = 0U; j < _settings.basePaths.size(); ++j) { const std::string bp = _settings.basePaths[j] + "/"; if (relativeFilename.compare(0,bp.size(),bp)==0) { relativeFilename = relativeFilename.substr(bp.size()); } } } // Add the suppressions. for (std::list<std::string>::const_iterator it = suppressionIDs.begin(); it != suppressionIDs.end(); ++it) { _settings.nomsg.addSuppression(*it, relativeFilename, tok->location.line); } suppressionIDs.clear(); }