@@ -307,7 +307,7 @@ void Preprocessor::inlineSuppressions(SuppressionList &suppressions)
307307 ::addInlineSuppressions (filedata->tokens, mSettings , suppressions, err);
308308 }
309309 for (const BadInlineSuppression &bad : err) {
310- error (bad.file , bad.line , bad.col , bad.errmsg , simplecpp::Output::ERROR ); // TODO: use individual (non-fatal) ID
310+ invalidSuppression (bad.file , bad.line , bad.col , bad.errmsg ); // TODO: column is always 0
311311 }
312312}
313313
@@ -927,6 +927,11 @@ static std::string simplecppErrToId(simplecpp::Output::Type type)
927927}
928928
929929void Preprocessor::error (const std::string &filename, unsigned int linenr, unsigned int col, const std::string &msg, simplecpp::Output::Type type)
930+ {
931+ error (filename, linenr, col, msg, simplecppErrToId (type));
932+ }
933+
934+ void Preprocessor::error (const std::string &filename, unsigned int linenr, unsigned int col, const std::string &msg, const std::string& id)
930935{
931936 std::list<ErrorMessage::FileLocation> locationList;
932937 if (!filename.empty ()) {
@@ -940,7 +945,7 @@ void Preprocessor::error(const std::string &filename, unsigned int linenr, unsig
940945 mFile0 ,
941946 Severity::error,
942947 msg,
943- simplecppErrToId (type) ,
948+ id ,
944949 Certainty::normal));
945950}
946951
@@ -952,6 +957,7 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line
952957
953958 std::list<ErrorMessage::FileLocation> locationList;
954959 if (!filename.empty ()) {
960+ // TODO: add relative path handling?
955961 locationList.emplace_back (filename, linenr, col);
956962 }
957963 ErrorMessage errmsg (std::move (locationList), mFile0 , Severity::information,
@@ -963,6 +969,11 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line
963969 mErrorLogger .reportErr (errmsg);
964970}
965971
972+ void Preprocessor::invalidSuppression (const std::string &filename, unsigned int linenr, unsigned int col, const std::string &msg)
973+ {
974+ error (filename, linenr, col, msg, " invalidSuppression" );
975+ }
976+
966977void Preprocessor::getErrorMessages (ErrorLogger &errorLogger, const Settings &settings)
967978{
968979 std::vector<std::string> files;
@@ -975,6 +986,7 @@ void Preprocessor::getErrorMessages(ErrorLogger &errorLogger, const Settings &se
975986 preprocessor.error (" " , 1 , 2 , " message" , simplecpp::Output::UNHANDLED_CHAR_ERROR);
976987 preprocessor.error (" " , 1 , 2 , " message" , simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY);
977988 preprocessor.error (" " , 1 , 2 , " message" , simplecpp::Output::FILE_NOT_FOUND);
989+ preprocessor.invalidSuppression (" " , 1 , 2 , " message" );
978990}
979991
980992void Preprocessor::dump (std::ostream &out) const
0 commit comments