diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-17 21:08:41 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-17 21:08:41 +0200 |
commit | 5b192beaa5cb8f007b04bb4c52fc2076c12107c6 (patch) | |
tree | ea316e7beb98cbf6b6870d0d545d89f77425d0c7 /src | |
parent | ef38330d748742945a781ef520ffd4de2d1f9301 (diff) |
config/Global: remove ConfigBlock::SetUsed() call, let caller do that
This fixes an old bug which caused the "unused" warnings to be
unreliable; only the first block in the list was marked as being
"used", no matter if it was really used, and the rest was never marked
as "used", suppressing all warnings for them.
Diffstat (limited to 'src')
-rw-r--r-- | src/config/Global.cxx | 5 | ||||
-rw-r--r-- | src/db/Configured.cxx | 5 | ||||
-rw-r--r-- | src/decoder/DecoderList.cxx | 3 | ||||
-rw-r--r-- | src/filter/LoadChain.cxx | 2 | ||||
-rw-r--r-- | src/input/Init.cxx | 2 | ||||
-rw-r--r-- | src/neighbor/Glue.cxx | 2 | ||||
-rw-r--r-- | src/output/MultipleOutputs.cxx | 1 | ||||
-rw-r--r-- | src/pcm/ConfiguredResampler.cxx | 1 | ||||
-rw-r--r-- | src/playlist/PlaylistRegistry.cxx | 3 |
9 files changed, 18 insertions, 6 deletions
diff --git a/src/config/Global.cxx b/src/config/Global.cxx index 64f7883a7..2b224c318 100644 --- a/src/config/Global.cxx +++ b/src/config/Global.cxx @@ -83,10 +83,7 @@ config_get_param(ConfigOption option) noexcept const ConfigBlock * config_get_block(ConfigBlockOption option) noexcept { - const auto *block = config_data.blocks[unsigned(option)]; - if (block != nullptr) - block->SetUsed(); - return block; + return config_data.blocks[unsigned(option)]; } const ConfigBlock * diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx index 3c3eb8632..3e8a6553f 100644 --- a/src/db/Configured.cxx +++ b/src/db/Configured.cxx @@ -38,10 +38,11 @@ CreateConfiguredDatabase(EventLoop &main_event_loop, EventLoop &io_event_loop, throw FormatRuntimeError("Found both 'database' (line %d) and 'db_file' (line %d) setting", param->line, path->line); - if (param != nullptr) + if (param != nullptr) { + param->SetUsed(); return DatabaseGlobalInit(main_event_loop, io_event_loop, listener, *param); - else if (path != nullptr) { + } else if (path != nullptr) { ConfigBlock block(path->line); block.AddBlockParam("path", path->value, path->line); return DatabaseGlobalInit(main_event_loop, io_event_loop, diff --git a/src/decoder/DecoderList.cxx b/src/decoder/DecoderList.cxx index b5c6264c8..7f1bafe7a 100644 --- a/src/decoder/DecoderList.cxx +++ b/src/decoder/DecoderList.cxx @@ -143,6 +143,9 @@ void decoder_plugin_init_all(void) /* the plugin is disabled in mpd.conf */ continue; + if (param != nullptr) + param->SetUsed(); + if (plugin.Init(*param)) decoder_plugins_enabled[i] = true; } diff --git a/src/filter/LoadChain.cxx b/src/filter/LoadChain.cxx index 558134b92..74c94a0a9 100644 --- a/src/filter/LoadChain.cxx +++ b/src/filter/LoadChain.cxx @@ -42,6 +42,8 @@ filter_chain_append_new(PreparedFilter &chain, const char *template_name) throw FormatRuntimeError("Filter template not found: %s", template_name); + cfg->SetUsed(); + // Instantiate one of those filter plugins with the template name as a hint auto f = filter_configured_new(*cfg); diff --git a/src/input/Init.cxx b/src/input/Init.cxx index f5b42b00b..12433175b 100644 --- a/src/input/Init.cxx +++ b/src/input/Init.cxx @@ -53,6 +53,8 @@ input_stream_global_init(EventLoop &event_loop) /* the plugin is disabled in mpd.conf */ continue; + block->SetUsed(); + try { if (plugin->init != nullptr) plugin->init(event_loop, *block); diff --git a/src/neighbor/Glue.cxx b/src/neighbor/Glue.cxx index b55b3d9ad..8ba1013c7 100644 --- a/src/neighbor/Glue.cxx +++ b/src/neighbor/Glue.cxx @@ -54,6 +54,8 @@ NeighborGlue::Init(EventLoop &loop, NeighborListener &listener) { for (const auto *block = config_get_block(ConfigBlockOption::NEIGHBORS); block != nullptr; block = block->next) { + block->SetUsed(); + try { explorers.emplace_front(CreateNeighborExplorer(loop, listener, diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index de60c8eb3..e9522aaef 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -92,6 +92,7 @@ MultipleOutputs::Configure(EventLoop &event_loop, { for (const auto *param = config_get_block(ConfigBlockOption::AUDIO_OUTPUT); param != nullptr; param = param->next) { + param->SetUsed(); auto *output = LoadOutputControl(event_loop, replay_gain_config, mixer_listener, diff --git a/src/pcm/ConfiguredResampler.cxx b/src/pcm/ConfiguredResampler.cxx index 5e2744ab2..509d2cb8a 100644 --- a/src/pcm/ConfiguredResampler.cxx +++ b/src/pcm/ConfiguredResampler.cxx @@ -125,6 +125,7 @@ GetResamplerConfig(ConfigBlock &buffer) throw FormatRuntimeError("Cannot use both 'resampler' (line %d) and 'samplerate_converter' (line %d)", block->line, old_param->line); + block->SetUsed(); return block; } diff --git a/src/playlist/PlaylistRegistry.cxx b/src/playlist/PlaylistRegistry.cxx index 446db1636..8736546b2 100644 --- a/src/playlist/PlaylistRegistry.cxx +++ b/src/playlist/PlaylistRegistry.cxx @@ -90,6 +90,9 @@ playlist_list_global_init(void) /* the plugin is disabled in mpd.conf */ continue; + if (param != nullptr) + param->SetUsed(); + playlist_plugins_enabled[i] = playlist_plugin_init(playlist_plugins[i], *param); } |