|
25 | 25 |
|
26 | 26 | #include <algorithm> |
27 | 27 | #include <sstream> |
28 | | -#include <fstream> |
29 | 28 | #include <cstdlib> |
30 | 29 | #include <cctype> |
31 | 30 | #include <vector> |
32 | 31 | #include <set> |
33 | | -#include <stack> |
34 | 32 |
|
35 | 33 | /** |
36 | 34 | * Remove heading and trailing whitespaces from the input parameter. |
@@ -69,21 +67,6 @@ Preprocessor::~Preprocessor() |
69 | 67 | delete it->second; |
70 | 68 | } |
71 | 69 |
|
72 | | -void Preprocessor::writeError(const std::string &fileName, const unsigned int linenr, ErrorLogger *errorLogger, const std::string &errorType, const std::string &errorText) |
73 | | -{ |
74 | | - if (!errorLogger) |
75 | | - return; |
76 | | - |
77 | | - std::list<ErrorLogger::ErrorMessage::FileLocation> locationList; |
78 | | - ErrorLogger::ErrorMessage::FileLocation loc(fileName, linenr); |
79 | | - locationList.push_back(loc); |
80 | | - errorLogger->reportErr(ErrorLogger::ErrorMessage(locationList, |
81 | | - Severity::error, |
82 | | - errorText, |
83 | | - errorType, |
84 | | - false)); |
85 | | -} |
86 | | - |
87 | 70 |
|
88 | 71 | static void inlineSuppressions(const simplecpp::TokenList &tokens, Settings &_settings) |
89 | 72 | { |
@@ -657,6 +640,7 @@ void Preprocessor::error(const std::string &filename, unsigned int linenr, const |
657 | 640 | locationList.push_back(loc); |
658 | 641 | } |
659 | 642 | _errorLogger->reportErr(ErrorLogger::ErrorMessage(locationList, |
| 643 | + file0, |
660 | 644 | Severity::error, |
661 | 645 | msg, |
662 | 646 | "preprocessorErrorDirective", |
@@ -685,13 +669,12 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line |
685 | 669 | loc.setfile(Path::toNativeSeparators(filename)); |
686 | 670 | locationList.push_back(loc); |
687 | 671 | } |
688 | | - ErrorLogger::ErrorMessage errmsg(locationList, Severity::information, |
| 672 | + ErrorLogger::ErrorMessage errmsg(locationList, file0, Severity::information, |
689 | 673 | (headerType==SystemHeader) ? |
690 | 674 | "Include file: <" + header + "> not found. Please note: Cppcheck does not need standard library headers to get proper results." : |
691 | 675 | "Include file: \"" + header + "\" not found.", |
692 | 676 | (headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude", |
693 | 677 | false); |
694 | | - errmsg.file0 = file0; |
695 | 678 | _errorLogger->reportInfo(errmsg); |
696 | 679 | } |
697 | 680 | } |
@@ -763,7 +746,7 @@ void Preprocessor::validateCfgError(const std::string &cfg, const std::string &m |
763 | 746 | std::list<ErrorLogger::ErrorMessage::FileLocation> locationList; |
764 | 747 | ErrorLogger::ErrorMessage::FileLocation loc(file0, 1); |
765 | 748 | locationList.push_back(loc); |
766 | | - ErrorLogger::ErrorMessage errmsg(locationList, Severity::information, "Skipping configuration '" + cfg + "' since the value of '" + macro + "' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.", id, false); |
| 749 | + ErrorLogger::ErrorMessage errmsg(locationList, file0, Severity::information, "Skipping configuration '" + cfg + "' since the value of '" + macro + "' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.", id, false); |
767 | 750 | _errorLogger->reportInfo(errmsg); |
768 | 751 | } |
769 | 752 |
|
|
0 commit comments