mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#19131: Fix unreachable code in init arg checks
This commit is contained in:
parent
6e93df5db6
commit
405b44e211
@ -427,6 +427,7 @@ if test "x$enable_werror" = "xyes"; then
|
|||||||
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010
|
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010
|
||||||
AX_CHECK_COMPILE_FLAG([-Werror=suggest-override],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=suggest-override"],,[[$CXXFLAG_WERROR]],
|
AX_CHECK_COMPILE_FLAG([-Werror=suggest-override],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=suggest-override"],,[[$CXXFLAG_WERROR]],
|
||||||
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
|
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Werror=unreachable-code-loop-increment],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=unreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$CXXFLAGS_overridden" = "xno"; then
|
if test "x$CXXFLAGS_overridden" = "xno"; then
|
||||||
@ -445,6 +446,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
|
|||||||
AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]])
|
AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wsuggest-override],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"],,[[$CXXFLAG_WERROR]],
|
AX_CHECK_COMPILE_FLAG([-Wsuggest-override],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"],,[[$CXXFLAG_WERROR]],
|
||||||
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
|
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wunreachable-code-loop-increment],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]])
|
||||||
|
|
||||||
## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
|
## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
|
||||||
## unknown options if any other warning is produced. Test the -Wfoo case, and
|
## unknown options if any other warning is produced. Test the -Wfoo case, and
|
||||||
|
16
src/init.cpp
16
src/init.cpp
@ -1262,17 +1262,27 @@ bool AppInitParameterInteraction()
|
|||||||
|
|
||||||
// also see: InitParameterInteraction()
|
// 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
|
// specified in default section of config file, but not overridden
|
||||||
// on the command line or in this network's section of the config file.
|
// on the command line or in this network's section of the config file.
|
||||||
std::string network = gArgs.GetChainName();
|
std::string network = gArgs.GetChainName();
|
||||||
|
bilingual_str errors;
|
||||||
for (const auto& arg : gArgs.GetUnsuitableSectionOnlyArgs()) {
|
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.
|
// Warn if unrecognized section name are present in the config file.
|
||||||
|
bilingual_str warnings;
|
||||||
for (const auto& section : gArgs.GetUnrecognizedSections()) {
|
for (const auto& section : 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())) {
|
if (!fs::is_directory(GetBlocksDir())) {
|
||||||
|
@ -24,6 +24,11 @@ struct bilingual_str {
|
|||||||
translated += rhs.translated;
|
translated += rhs.translated;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool empty() const
|
||||||
|
{
|
||||||
|
return original.empty();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bilingual_str operator+(bilingual_str lhs, const bilingual_str& rhs)
|
inline bilingual_str operator+(bilingual_str lhs, const bilingual_str& rhs)
|
||||||
|
@ -70,7 +70,7 @@ class ConfArgsTest(BitcoinTestFramework):
|
|||||||
with open(inc_conf_file2_path, 'w', encoding='utf-8') as conf:
|
with open(inc_conf_file2_path, 'w', encoding='utf-8') as conf:
|
||||||
conf.write('[testnet]\n')
|
conf.write('[testnet]\n')
|
||||||
self.restart_node(0)
|
self.restart_node(0)
|
||||||
self.nodes[0].stop_node(expected_stderr='Warning: ' + inc_conf_file_path + ':1 Section [testnot] is not recognized.' + os.linesep + 'Warning: ' + inc_conf_file2_path + ':1 Section [testnet] is not recognized.')
|
self.nodes[0].stop_node(expected_stderr='Warning: ' + inc_conf_file_path + ':1 Section [testnot] is not recognized.' + os.linesep + inc_conf_file2_path + ':1 Section [testnet] is not recognized.')
|
||||||
|
|
||||||
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
|
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
|
||||||
conf.write('') # clear
|
conf.write('') # clear
|
||||||
|
Loading…
Reference in New Issue
Block a user