aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-03-02 09:59:09 -0500
committerMarcoFalke <falke.marco@gmail.com>2019-03-02 09:59:18 -0500
commit789b0bbf2afcbaa5ce2b99945aa4b02866a61972 (patch)
tree3d7ea837b88a8fae4dd96ef88106e44d499a513c /src/util/system.h
parent849f37fa22b039246bd9e154ab83a4031d13a7c1 (diff)
parent1a7ba84e1194aeeb3c2fc9d79337a84586b834fd (diff)
downloadbitcoin-789b0bbf2afcbaa5ce2b99945aa4b02866a61972.tar.xz
Merge #15335: Fix lack of warning of unrecognized section names
1a7ba84e11 Fix lack of warning of unrecognized section names (Akio Nakamura) Pull request description: In #14708, It was introduced that to warn when unrecognized section names are exist in the config file. But ```m_config_sections.clear()``` in ```ArgsManager::ReadConfigStream()``` is called every time when reading each configuration file, so it can warn about only last reading file if ```includeconf``` exists. This PR fix lack of warning by collecting all section names by moving ```m_config_sections.clear()``` to ```ArgsManager::ReadConfigFiles()``` . Also add a test code to confirm this situation. Tree-SHA512: 26aa0cbe3e4ae2e58cbe73d4492ee5cf465fd4c3e5df2c8ca7e282b627df9e637267af1e3816386b1dc6db2398b31936925ce0e432219fec3a9b3398f01e3e65
Diffstat (limited to 'src/util/system.h')
-rw-r--r--src/util/system.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/util/system.h b/src/util/system.h
index 69ae11d1ed..6899e38c9e 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -127,6 +127,13 @@ enum class OptionsCategory {
HIDDEN // Always the last option to avoid printing these in the help
};
+struct SectionInfo
+{
+ std::string m_name;
+ std::string m_file;
+ int m_line;
+};
+
class ArgsManager
{
protected:
@@ -147,9 +154,9 @@ protected:
std::string m_network GUARDED_BY(cs_args);
std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
- std::set<std::string> m_config_sections GUARDED_BY(cs_args);
+ std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args);
- NODISCARD bool ReadConfigStream(std::istream& stream, std::string& error, bool ignore_invalid_keys = false);
+ NODISCARD bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false);
public:
ArgsManager();
@@ -173,7 +180,7 @@ public:
/**
* Log warnings for unrecognized section names in the config file.
*/
- const std::set<std::string> GetUnrecognizedSections() const;
+ const std::list<SectionInfo> GetUnrecognizedSections() const;
/**
* Return a vector of strings of the given argument