4040#include < cstring>
4141#include < iostream>
4242#include < list>
43+ #include < memory>
4344#include < utility>
4445#include < vector>
4546
@@ -106,9 +107,9 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
106107
107108 if (parser.getShowErrorMessages ()) {
108109 mShowAllErrors = true ;
109- std::cout << ErrorLogger:: ErrorMessage::getXMLHeader ();
110+ std::cout << ErrorMessage::getXMLHeader ();
110111 cppcheck->getErrorMessages ();
111- std::cout << ErrorLogger:: ErrorMessage::getXMLFooter () << std::endl;
112+ std::cout << ErrorMessage::getXMLFooter () << std::endl;
112113 }
113114
114115 if (parser.exitAfterPrinting ()) {
@@ -851,8 +852,8 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
851852 for (const std::string &lib : settings.libraries ) {
852853 if (!tryLoadLibrary (settings.library , argv[0 ], lib.c_str ())) {
853854 const std::string msg (" Failed to load the library " + lib);
854- const std::list<ErrorLogger:: ErrorMessage::FileLocation> callstack;
855- ErrorLogger:: ErrorMessage errmsg (callstack, emptyString, Severity::information, msg, " failedToLoadCfg" , false );
855+ const std::list<ErrorMessage::FileLocation> callstack;
856+ ErrorMessage errmsg (callstack, emptyString, Severity::information, msg, " failedToLoadCfg" , false );
856857 reportErr (errmsg);
857858 return EXIT_FAILURE;
858859 }
@@ -866,7 +867,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
866867 windows = tryLoadLibrary (settings.library , argv[0 ], " windows.cfg" );
867868
868869 if (!std || !posix || !windows) {
869- const std::list<ErrorLogger:: ErrorMessage::FileLocation> callstack;
870+ const std::list<ErrorMessage::FileLocation> callstack;
870871 const std::string msg (" Failed to load " + std::string (!std ? " std.cfg" : !posix ? " posix.cfg" : " windows.cfg" ) + " . Your Cppcheck installation is broken, please re-install." );
871872#ifdef FILESDIR
872873 const std::string details (" The Cppcheck binary was compiled with FILESDIR set to \" "
@@ -878,7 +879,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
878879 " std.cfg should be available in " + cfgfolder + " or the FILESDIR "
879880 " should be configured." );
880881#endif
881- ErrorLogger:: ErrorMessage errmsg (callstack, emptyString, Severity::information, msg+" " +details, " failedToLoadCfg" , false );
882+ ErrorMessage errmsg (callstack, emptyString, Severity::information, msg+" " +details, " failedToLoadCfg" , false );
882883 reportErr (errmsg);
883884 return EXIT_FAILURE;
884885 }
@@ -891,7 +892,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
891892 }
892893
893894 if (settings.xml ) {
894- reportErr (ErrorLogger:: ErrorMessage::getXMLHeader ());
895+ reportErr (ErrorMessage::getXMLHeader ());
895896 }
896897
897898 if (!settings.buildDir .empty ()) {
@@ -980,24 +981,24 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
980981 cppcheck.tooManyConfigsError (" " ,0U );
981982
982983 if (settings.isEnabled (Settings::MISSING_INCLUDE) && (Preprocessor::missingIncludeFlag || Preprocessor::missingSystemIncludeFlag)) {
983- const std::list<ErrorLogger:: ErrorMessage::FileLocation> callStack;
984- ErrorLogger:: ErrorMessage msg (callStack,
985- emptyString,
986- Severity::information,
987- " Cppcheck cannot find all the include files (use --check-config for details)\n "
988- " Cppcheck cannot find all the include files. Cppcheck can check the code without the "
989- " include files found. But the results will probably be more accurate if all the include "
990- " files are found. Please check your project's include directories and add all of them "
991- " as include directories for Cppcheck. To see what files Cppcheck cannot find use "
992- " --check-config." ,
993- Preprocessor::missingIncludeFlag ? " missingInclude" : " missingIncludeSystem" ,
994- false );
984+ const std::list<ErrorMessage::FileLocation> callStack;
985+ ErrorMessage msg (callStack,
986+ emptyString,
987+ Severity::information,
988+ " Cppcheck cannot find all the include files (use --check-config for details)\n "
989+ " Cppcheck cannot find all the include files. Cppcheck can check the code without the "
990+ " include files found. But the results will probably be more accurate if all the include "
991+ " files are found. Please check your project's include directories and add all of them "
992+ " as include directories for Cppcheck. To see what files Cppcheck cannot find use "
993+ " --check-config." ,
994+ Preprocessor::missingIncludeFlag ? " missingInclude" : " missingIncludeSystem" ,
995+ false );
995996 reportInfo (msg);
996997 }
997998 }
998999
9991000 if (settings.xml ) {
1000- reportErr (ErrorLogger:: ErrorMessage::getXMLFooter ());
1001+ reportErr (ErrorMessage::getXMLFooter ());
10011002 }
10021003
10031004 mSettings = nullptr ;
@@ -1072,7 +1073,7 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
10721073 }
10731074}
10741075
1075- void CppCheckExecutor::reportInfo (const ErrorLogger:: ErrorMessage &msg)
1076+ void CppCheckExecutor::reportInfo (const ErrorMessage &msg)
10761077{
10771078 reportErr (msg);
10781079}
@@ -1089,7 +1090,7 @@ void CppCheckExecutor::reportStatus(std::size_t fileindex, std::size_t filecount
10891090 }
10901091}
10911092
1092- void CppCheckExecutor::reportErr (const ErrorLogger:: ErrorMessage &msg)
1093+ void CppCheckExecutor::reportErr (const ErrorMessage &msg)
10931094{
10941095 if (mShowAllErrors ) {
10951096 reportOut (msg.toXML ());
0 commit comments