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

Method reportOutput

lib/preprocessor.cpp:951–989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

949}
950
951const simplecpp::Output* Preprocessor::reportOutput(const simplecpp::OutputList &outputList, bool showerror)
952{
953 const simplecpp::Output* out_ret = nullptr;
954
955 for (const simplecpp::Output &out : outputList) {
956 switch (out.type) {
957 case simplecpp::Output::ERROR:
958 out_ret = &out;
959 if (!startsWith(out.msg,"#error") || showerror)
960 error(out.location, out.msg, out.type);
961 break;
962 case simplecpp::Output::WARNING:
963 case simplecpp::Output::PORTABILITY_BACKSLASH:
964 break;
965 case simplecpp::Output::MISSING_HEADER: {
966 // not considered an "error"
967 const std::string::size_type pos1 = out.msg.find_first_of("<\"");
968 const std::string::size_type pos2 = out.msg.find_first_of(">\"", pos1 + 1U);
969 if (pos1 < pos2 && pos2 != std::string::npos)
970 missingInclude(out.location, out.msg.substr(pos1+1, pos2-pos1-1), out.msg[pos1] == '\"' ? UserHeader : SystemHeader);
971 }
972 break;
973 case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
974 case simplecpp::Output::SYNTAX_ERROR:
975 case simplecpp::Output::UNHANDLED_CHAR_ERROR:
976 out_ret = &out;
977 error(out.location, out.msg, out.type);
978 break;
979 case simplecpp::Output::EXPLICIT_INCLUDE_NOT_FOUND:
980 case simplecpp::Output::FILE_NOT_FOUND:
981 case simplecpp::Output::DUI_ERROR:
982 out_ret = &out;
983 error({}, out.msg, out.type);
984 break;
985 }
986 }
987
988 return out_ret;
989}
990
991static std::string simplecppErrToId(simplecpp::Output::Type type)
992{

Callers 8

checkInternalMethod · 0.80
expandMacrosMethod · 0.80
preprocessMethod · 0.80
getcodeMethod · 0.80
getConfigsStrMethod · 0.80
directiveDumpMethod · 0.80
notokensMethod · 0.80
preprocessMethod · 0.80

Calls 1

startsWithFunction · 0.70

Tested by 6

expandMacrosMethod · 0.64
preprocessMethod · 0.64
getcodeMethod · 0.64
getConfigsStrMethod · 0.64
directiveDumpMethod · 0.64
notokensMethod · 0.64