diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -214,6 +214,7 @@ -Wshadow-field -Wrange-loop-analysis -Wredundant-decls + -Wunreachable-code-loop-increment ) add_compiler_flag_group(-Wformat -Wformat-security) add_cxx_compiler_flags( diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -1682,21 +1682,33 @@ // also see: InitParameterInteraction() - // Warn if network-specific options (-addnode, -connect, etc) are + // Error if network-specific options (-addnode, -connect, etc) are // specified in default section of config file, but not overridden // on the command line or in this network's section of the config file. std::string network = gArgs.GetChainName(); + bilingual_str errors; for (const auto &arg : gArgs.GetUnsuitableSectionOnlyArgs()) { - return InitError(strprintf(_("Config setting for %s only applied on %s " - "network when in [%s] section."), - arg, network, network)); + errors += strprintf(_("Config setting for %s only applied on %s " + "network when in [%s] section.") + + Untranslated("\n"), + arg, network, network); + } + + if (!errors.empty()) { + return InitError(errors); } // Warn if unrecognized section name are present in the config file. + bilingual_str warnings; for (const auto §ion : gArgs.GetUnrecognizedSections()) { - InitWarning(strprintf(Untranslated("%s:%i ") + - _("Section [%s] is not recognized."), - section.m_file, section.m_line, section.m_name)); + warnings += strprintf(Untranslated("%s:%i ") + + _("Section [%s] is not recognized.") + + Untranslated("\n"), + section.m_file, section.m_line, section.m_name); + } + + if (!warnings.empty()) { + InitWarning(warnings); } if (!fs::is_directory(GetBlocksDir())) { diff --git a/src/util/translation.h b/src/util/translation.h --- a/src/util/translation.h +++ b/src/util/translation.h @@ -23,6 +23,8 @@ translated += rhs.translated; return *this; } + + bool empty() const { return original.empty(); } }; inline bilingual_str operator+(bilingual_str lhs, const bilingual_str &rhs) { diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -85,7 +85,6 @@ inc_conf_file_path + ':1 Section [testnot] is not recognized.' + os.linesep + - 'Warning: ' + inc_conf_file2_path + ':1 Section [testnet] is not recognized.')