aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.h
diff options
context:
space:
mode:
authorAkio Nakamura <nakamura@dgtechnologies.co.jp>2019-02-04 12:53:19 +0900
committerAkio Nakamura <nakamura@dgtechnologies.co.jp>2019-02-19 10:49:19 +0900
commit1a7ba84e1194aeeb3c2fc9d79337a84586b834fd (patch)
tree806c355c4d3c01bfa2d6192007f221f206d3082a /src/util/system.h
parent904308dca3ff50afb704597c0a65d226dd40f635 (diff)
Fix lack of warning of unrecognized section names
1. Fix lack of warning by collecting all section names by moving m_config_sections.clear() to ArgsManager::ReadConfigFiles(). 2. Add info(file name, line number) to warning message. 3. Add a test code to confirm this situation. 3. Do clear() in ReadConfigString().
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 8867e49478..cb66c470a6 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -132,6 +132,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:
@@ -152,9 +159,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();
@@ -178,7 +185,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