From ca0f9b1b86b448fb586b7b928fc77756c6f0834d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Heusipp?= Date: Mon, 23 Sep 2024 20:41:03 +0000 Subject: [PATCH] [Ref] openmpt123: Clang 6 does support [[maybe_unused]], however Clang in general gets angry and confused when a scope guard is used with a dummy implementation class which has no actual side effects. Mark all of them [[maybe_unused]]. git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@21719 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- openmpt123/openmpt123.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/openmpt123/openmpt123.cpp b/openmpt123/openmpt123.cpp index 8120f67aac..b632d9f008 100644 --- a/openmpt123/openmpt123.cpp +++ b/openmpt123/openmpt123.cpp @@ -2264,26 +2264,21 @@ static mpt::uint8 main( std::vector args ) { const FILE_mode stdin_mode = mpt::contains( flags.filenames, MPT_NATIVE_PATH("-") ) ? FILE_mode::binary : FILE_mode::text; const FILE_mode stdout_mode = flags.use_stdout ? FILE_mode::binary : FILE_mode::text; - const bool stdin_text = ( stdin_mode == FILE_mode::text ); - const bool stdin_data = ( stdin_mode == FILE_mode::binary ); - const bool stdout_text = ( stdout_mode == FILE_mode::text ); - const bool stdout_data = ( stdout_mode == FILE_mode::binary ); + [[maybe_unused]] const bool stdin_text = ( stdin_mode == FILE_mode::text ); + [[maybe_unused]] const bool stdin_data = ( stdin_mode == FILE_mode::binary ); + [[maybe_unused]] const bool stdout_text = ( stdout_mode == FILE_mode::text ); + [[maybe_unused]] const bool stdout_data = ( stdout_mode == FILE_mode::binary ); // set stdin/stdout to binary for data input/output - std::optional stdin_guard{ stdin_data ? std::make_optional( stdin, FILE_mode::binary ) : std::nullopt }; - std::optional stdout_guard{ stdout_data ? std::make_optional( stdout, FILE_mode::binary ) : std::nullopt }; + [[maybe_unused]] std::optional stdin_guard{ stdin_data ? std::make_optional( stdin, FILE_mode::binary ) : std::nullopt }; + [[maybe_unused]] std::optional stdout_guard{ stdout_data ? std::make_optional( stdout, FILE_mode::binary ) : std::nullopt }; // setup terminal - std::optional input_guard{ stdin_text && ( flags.mode == Mode::UI ) ? std::make_optional() : std::nullopt }; + [[maybe_unused]] std::optional input_guard{ stdin_text && ( flags.mode == Mode::UI ) ? std::make_optional() : std::nullopt }; // choose text output between quiet/stdout/stderr textout & log = flags.quiet ? static_cast( dummy_log ) : stdout_text ? static_cast( std_out ) : static_cast( std_err ); - MPT_UNUSED( stdin_text ); - MPT_UNUSED( stdin_data ); - MPT_UNUSED( stdout_text ); - MPT_UNUSED( stdout_data ); - show_banner( log, flags.banner ); if ( !flags.warnings.empty() ) {