From 97425d56e7ad0ce19357b5d8984de082c0dacffc Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 12 Mar 2020 12:56:11 -0700 Subject: [PATCH] remove gcc_unused [[maybe_unused]] (introduced in C++17) is standard C++. https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused says that this is equivalent to the GNU unused attribute. Signed-off-by: Rosen Penev --- src/Instance.cxx | 4 +- src/LogInit.cxx | 2 +- src/command/AllCommands.cxx | 8 ++-- src/command/ClientCommands.cxx | 8 ++-- src/command/MessageCommands.cxx | 4 +- src/command/NeighborCommands.cxx | 2 +- src/command/OtherCommands.cxx | 14 +++--- src/command/OutputCommands.cxx | 2 +- src/command/PlayerCommands.cxx | 44 +++++++++---------- src/command/PlaylistCommands.cxx | 24 +++++----- src/command/QueueCommands.cxx | 24 +++++----- src/command/StorageCommands.cxx | 2 +- src/db/Interface.hxx | 4 +- src/db/plugins/ProxyDatabasePlugin.cxx | 2 +- .../plugins/simple/SimpleDatabasePlugin.cxx | 6 +-- src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 2 +- src/db/update/InotifySource.cxx | 2 +- src/db/update/InotifyUpdate.cxx | 2 +- src/db/update/Walk.hxx | 8 ++-- src/decoder/plugins/FlacDecoderPlugin.cxx | 4 +- src/decoder/plugins/FlacInput.cxx | 12 ++--- .../plugins/FluidsynthDecoderPlugin.cxx | 2 +- src/decoder/plugins/GmeDecoderPlugin.cxx | 2 +- src/decoder/plugins/Mpg123DecoderPlugin.cxx | 2 +- src/decoder/plugins/OpusDecoderPlugin.cxx | 2 +- src/decoder/plugins/SndfileDecoderPlugin.cxx | 8 ++-- src/decoder/plugins/VorbisDecoderPlugin.cxx | 2 +- src/decoder/plugins/WavpackDecoderPlugin.cxx | 2 +- src/encoder/EncoderInterface.hxx | 2 +- src/encoder/plugins/FlacEncoderPlugin.cxx | 4 +- src/encoder/plugins/NullEncoderPlugin.cxx | 2 +- src/encoder/plugins/WaveEncoderPlugin.cxx | 2 +- src/event/Loop.cxx | 2 +- src/event/PollGroupEpoll.hxx | 2 +- src/event/ServerSocket.cxx | 2 +- src/filter/Observer.cxx | 2 +- src/filter/plugins/NormalizeFilterPlugin.cxx | 2 +- src/filter/plugins/NullFilterPlugin.cxx | 2 +- src/fs/io/FileOutputStream.cxx | 2 +- src/input/InputStream.cxx | 2 +- src/input/plugins/AlsaInputPlugin.cxx | 2 +- src/lib/curl/Global.cxx | 4 +- src/lib/ffmpeg/LogCallback.cxx | 2 +- src/lib/nfs/Connection.cxx | 6 +-- src/lib/smbclient/Init.cxx | 10 ++--- src/lib/sqlite/Util.hxx | 2 +- src/lib/upnp/Action.hxx | 2 +- src/lib/xiph/FlacIOHandle.cxx | 2 +- src/mixer/plugins/AlsaMixerPlugin.cxx | 2 +- src/mixer/plugins/HaikuMixerPlugin.cxx | 4 +- src/mixer/plugins/NullMixerPlugin.cxx | 6 +-- src/mixer/plugins/OSXMixerPlugin.cxx | 4 +- src/mixer/plugins/OssMixerPlugin.cxx | 4 +- src/mixer/plugins/PulseMixerPlugin.cxx | 6 +-- src/mixer/plugins/SndioMixerPlugin.cxx | 4 +- src/mixer/plugins/SoftwareMixerPlugin.cxx | 6 +-- src/mixer/plugins/WinmmMixerPlugin.cxx | 4 +- .../plugins/SmbclientNeighborPlugin.cxx | 4 +- src/neighbor/plugins/UdisksNeighborPlugin.cxx | 2 +- src/neighbor/plugins/UpnpNeighborPlugin.cxx | 2 +- src/output/Interface.cxx | 4 +- src/output/SharedPipeConsumer.hxx | 4 +- src/output/plugins/HaikuOutputPlugin.cxx | 6 +-- src/output/plugins/NullOutputPlugin.cxx | 2 +- src/output/plugins/OSXOutputPlugin.cxx | 6 +-- src/output/plugins/PipeOutputPlugin.cxx | 2 +- src/output/plugins/PulseOutputPlugin.cxx | 12 ++--- .../plugins/httpd/HttpdOutputPlugin.cxx | 2 +- src/output/plugins/sles/SlesOutputPlugin.cxx | 2 +- .../plugins/EmbeddedCuePlaylistPlugin.cxx | 2 +- src/playlist/plugins/XspfPlaylistPlugin.cxx | 2 +- src/storage/MemoryDirectoryReader.cxx | 2 +- src/storage/StorageInterface.cxx | 2 +- src/storage/plugins/CurlStorage.cxx | 4 +- src/storage/plugins/NfsStorage.cxx | 4 +- src/storage/plugins/SmbclientStorage.cxx | 6 +-- src/system/EventFD.cxx | 2 +- src/system/EventPipe.cxx | 2 +- src/tag/Handler.cxx | 2 +- src/tag/Handler.hxx | 2 +- src/thread/Name.hxx | 2 +- src/util/Compiler.h | 8 ---- src/util/UTF8.cxx | 2 +- src/win32/Win32Main.cxx | 6 +-- src/zeroconf/ZeroconfAvahi.cxx | 4 +- src/zeroconf/ZeroconfBonjour.cxx | 12 ++--- src/zeroconf/ZeroconfGlue.cxx | 2 +- test/DumpDecoderClient.cxx | 12 ++--- test/MakeTag.hxx | 2 +- test/ReadApeTags.cxx | 2 +- test/read_mixer.cxx | 4 +- test/run_avahi.cxx | 2 +- test/run_convert.cxx | 4 +- test/run_filter.cxx | 4 +- test/run_gunzip.cxx | 2 +- test/run_gzip.cxx | 2 +- test/run_inotify.cxx | 4 +- test/run_normalize.cxx | 2 +- test/software_volume.cxx | 2 +- test/test_translate_song.cxx | 6 +-- test/test_vorbis_encoder.cxx | 2 +- 101 files changed, 226 insertions(+), 234 deletions(-) diff --git a/src/Instance.cxx b/src/Instance.cxx index cf25ca201..2f5261a71 100644 --- a/src/Instance.cxx +++ b/src/Instance.cxx @@ -150,13 +150,13 @@ Instance::OnDatabaseSongRemoved(const char *uri) noexcept #ifdef ENABLE_NEIGHBOR_PLUGINS void -Instance::FoundNeighbor(gcc_unused const NeighborInfo &info) noexcept +Instance::FoundNeighbor([[maybe_unused]] const NeighborInfo &info) noexcept { EmitIdle(IDLE_NEIGHBOR); } void -Instance::LostNeighbor(gcc_unused const NeighborInfo &info) noexcept +Instance::LostNeighbor([[maybe_unused]] const NeighborInfo &info) noexcept { EmitIdle(IDLE_NEIGHBOR); } diff --git a/src/LogInit.cxx b/src/LogInit.cxx index eb2bcc3f0..ad3b8672b 100644 --- a/src/LogInit.cxx +++ b/src/LogInit.cxx @@ -46,7 +46,7 @@ #define LOG_DATE_BUF_SIZE 16 #define LOG_DATE_LEN (LOG_DATE_BUF_SIZE - 1) -gcc_unused +[[maybe_unused]] static constexpr Domain log_domain("log"); #ifndef ANDROID diff --git a/src/command/AllCommands.cxx b/src/command/AllCommands.cxx index ba9fc2f62..8797543a6 100644 --- a/src/command/AllCommands.cxx +++ b/src/command/AllCommands.cxx @@ -216,8 +216,8 @@ static constexpr unsigned num_commands = std::size(commands); gcc_pure static bool -command_available(gcc_unused const Partition &partition, - gcc_unused const struct command *cmd) noexcept +command_available([[maybe_unused]] const Partition &partition, + [[maybe_unused]] const struct command *cmd) noexcept { #ifdef ENABLE_SQLITE if (StringIsEqual(cmd->cmd, "sticker")) @@ -272,14 +272,14 @@ PrintUnavailableCommands(Response &r, unsigned permission) noexcept /* don't be fooled, this is the command handler for "commands" command */ static CommandResult -handle_commands(Client &client, gcc_unused Request request, Response &r) +handle_commands(Client &client, [[maybe_unused]] Request request, Response &r) { return PrintAvailableCommands(r, client.GetPartition(), client.GetPermission()); } static CommandResult -handle_not_commands(Client &client, gcc_unused Request request, Response &r) +handle_not_commands(Client &client, [[maybe_unused]] Request request, Response &r) { return PrintUnavailableCommands(r, client.GetPermission()); } diff --git a/src/command/ClientCommands.cxx b/src/command/ClientCommands.cxx index 3128b54e3..90ac993f2 100644 --- a/src/command/ClientCommands.cxx +++ b/src/command/ClientCommands.cxx @@ -27,15 +27,15 @@ #include "util/StringAPI.hxx" CommandResult -handle_close(gcc_unused Client &client, gcc_unused Request args, - gcc_unused Response &r) +handle_close([[maybe_unused]] Client &client, [[maybe_unused]] Request args, + [[maybe_unused]] Response &r) { return CommandResult::FINISH; } CommandResult -handle_ping(gcc_unused Client &client, gcc_unused Request args, - gcc_unused Response &r) +handle_ping([[maybe_unused]] Client &client, [[maybe_unused]] Request args, + [[maybe_unused]] Response &r) { return CommandResult::OK; } diff --git a/src/command/MessageCommands.cxx b/src/command/MessageCommands.cxx index 1478d401b..5e7f7a212 100644 --- a/src/command/MessageCommands.cxx +++ b/src/command/MessageCommands.cxx @@ -72,7 +72,7 @@ handle_unsubscribe(Client &client, Request args, Response &r) } CommandResult -handle_channels(Client &client, gcc_unused Request args, Response &r) +handle_channels(Client &client, [[maybe_unused]] Request args, Response &r) { assert(args.empty()); @@ -92,7 +92,7 @@ handle_channels(Client &client, gcc_unused Request args, Response &r) CommandResult handle_read_messages(Client &client, - gcc_unused Request args, Response &r) + [[maybe_unused]] Request args, Response &r) { assert(args.empty()); diff --git a/src/command/NeighborCommands.cxx b/src/command/NeighborCommands.cxx index 729b3c540..f4dfb5472 100644 --- a/src/command/NeighborCommands.cxx +++ b/src/command/NeighborCommands.cxx @@ -34,7 +34,7 @@ neighbor_commands_available(const Instance &instance) noexcept } CommandResult -handle_listneighbors(Client &client, gcc_unused Request args, Response &r) +handle_listneighbors(Client &client, [[maybe_unused]] Request args, Response &r) { const NeighborGlue *const neighbors = client.GetInstance().neighbors.get(); diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx index 7b2dfe511..2bf858d90 100644 --- a/src/command/OtherCommands.cxx +++ b/src/command/OtherCommands.cxx @@ -69,7 +69,7 @@ print_spl_list(Response &r, const PlaylistVector &list) } CommandResult -handle_urlhandlers(Client &client, gcc_unused Request args, Response &r) +handle_urlhandlers(Client &client, [[maybe_unused]] Request args, Response &r) { if (client.IsLocal()) r.Format("handler: file://\n"); @@ -78,7 +78,7 @@ handle_urlhandlers(Client &client, gcc_unused Request args, Response &r) } CommandResult -handle_decoders(gcc_unused Client &client, gcc_unused Request args, +handle_decoders([[maybe_unused]] Client &client, [[maybe_unused]] Request args, Response &r) { decoder_list_print(r); @@ -86,8 +86,8 @@ handle_decoders(gcc_unused Client &client, gcc_unused Request args, } CommandResult -handle_kill(gcc_unused Client &client, gcc_unused Request request, - gcc_unused Response &r) +handle_kill([[maybe_unused]] Client &client, [[maybe_unused]] Request request, + [[maybe_unused]] Response &r) { return CommandResult::KILL; } @@ -307,7 +307,7 @@ handle_update(Client &client, Request args, Response &r, bool discard) } CommandResult -handle_update(Client &client, Request args, gcc_unused Response &r) +handle_update(Client &client, Request args, [[maybe_unused]] Response &r) { return handle_update(client, args, r, false); } @@ -360,14 +360,14 @@ handle_volume(Client &client, Request args, Response &r) } CommandResult -handle_stats(Client &client, gcc_unused Request args, Response &r) +handle_stats(Client &client, [[maybe_unused]] Request args, Response &r) { stats_print(r, client.GetPartition()); return CommandResult::OK; } CommandResult -handle_config(Client &client, gcc_unused Request args, Response &r) +handle_config(Client &client, [[maybe_unused]] Request args, Response &r) { if (!client.IsLocal()) { r.Error(ACK_ERROR_PERMISSION, diff --git a/src/command/OutputCommands.cxx b/src/command/OutputCommands.cxx index 4558f69be..298a38469 100644 --- a/src/command/OutputCommands.cxx +++ b/src/command/OutputCommands.cxx @@ -118,7 +118,7 @@ handle_outputset(Client &client, Request request, Response &response) } CommandResult -handle_devices(Client &client, gcc_unused Request args, Response &r) +handle_devices(Client &client, [[maybe_unused]] Request args, Response &r) { assert(args.empty()); diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx index 7f3b4f296..551a67905 100644 --- a/src/command/PlayerCommands.cxx +++ b/src/command/PlayerCommands.cxx @@ -60,7 +60,7 @@ #define COMMAND_STATUS_UPDATING_DB "updating_db" CommandResult -handle_play(Client &client, Request args, gcc_unused Response &r) +handle_play(Client &client, Request args, [[maybe_unused]] Response &r) { int song = args.ParseOptional(0, -1); @@ -69,7 +69,7 @@ handle_play(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_playid(Client &client, Request args, gcc_unused Response &r) +handle_playid(Client &client, Request args, [[maybe_unused]] Response &r) { int id = args.ParseOptional(0, -1); @@ -78,21 +78,21 @@ handle_playid(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_stop(Client &client, gcc_unused Request args, gcc_unused Response &r) +handle_stop(Client &client, [[maybe_unused]] Request args, [[maybe_unused]] Response &r) { client.GetPartition().Stop(); return CommandResult::OK; } CommandResult -handle_currentsong(Client &client, gcc_unused Request args, Response &r) +handle_currentsong(Client &client, [[maybe_unused]] Request args, Response &r) { playlist_print_current(r, client.GetPlaylist()); return CommandResult::OK; } CommandResult -handle_pause(Client &client, Request args, gcc_unused Response &r) +handle_pause(Client &client, Request args, [[maybe_unused]] Response &r) { auto &pc = client.GetPlayerControl(); @@ -106,7 +106,7 @@ handle_pause(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_status(Client &client, gcc_unused Request args, Response &r) +handle_status(Client &client, [[maybe_unused]] Request args, Response &r) { auto &partition = client.GetPartition(); auto &pc = partition.pc; @@ -216,7 +216,7 @@ handle_status(Client &client, gcc_unused Request args, Response &r) } CommandResult -handle_next(Client &client, gcc_unused Request args, gcc_unused Response &r) +handle_next(Client &client, [[maybe_unused]] Request args, [[maybe_unused]] Response &r) { playlist &playlist = client.GetPlaylist(); @@ -234,15 +234,15 @@ handle_next(Client &client, gcc_unused Request args, gcc_unused Response &r) } CommandResult -handle_previous(Client &client, gcc_unused Request args, - gcc_unused Response &r) +handle_previous(Client &client, [[maybe_unused]] Request args, + [[maybe_unused]] Response &r) { client.GetPartition().PlayPrevious(); return CommandResult::OK; } CommandResult -handle_repeat(Client &client, Request args, gcc_unused Response &r) +handle_repeat(Client &client, Request args, [[maybe_unused]] Response &r) { bool status = args.ParseBool(0); client.GetPartition().SetRepeat(status); @@ -250,7 +250,7 @@ handle_repeat(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_single(Client &client, Request args, gcc_unused Response &r) +handle_single(Client &client, Request args, [[maybe_unused]] Response &r) { auto new_mode = SingleFromString(args.front()); client.GetPartition().SetSingle(new_mode); @@ -258,7 +258,7 @@ handle_single(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_consume(Client &client, Request args, gcc_unused Response &r) +handle_consume(Client &client, Request args, [[maybe_unused]] Response &r) { bool status = args.ParseBool(0); client.GetPartition().SetConsume(status); @@ -266,7 +266,7 @@ handle_consume(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_random(Client &client, Request args, gcc_unused Response &r) +handle_random(Client &client, Request args, [[maybe_unused]] Response &r) { bool status = args.ParseBool(0); auto &partition = client.GetPartition(); @@ -276,15 +276,15 @@ handle_random(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_clearerror(Client &client, gcc_unused Request args, - gcc_unused Response &r) +handle_clearerror(Client &client, [[maybe_unused]] Request args, + [[maybe_unused]] Response &r) { client.GetPlayerControl().LockClearError(); return CommandResult::OK; } CommandResult -handle_seek(Client &client, Request args, gcc_unused Response &r) +handle_seek(Client &client, Request args, [[maybe_unused]] Response &r) { unsigned song = args.ParseUnsigned(0); SongTime seek_time = args.ParseSongTime(1); @@ -294,7 +294,7 @@ handle_seek(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_seekid(Client &client, Request args, gcc_unused Response &r) +handle_seekid(Client &client, Request args, [[maybe_unused]] Response &r) { unsigned id = args.ParseUnsigned(0); SongTime seek_time = args.ParseSongTime(1); @@ -304,7 +304,7 @@ handle_seekid(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_seekcur(Client &client, Request args, gcc_unused Response &r) +handle_seekcur(Client &client, Request args, [[maybe_unused]] Response &r) { const char *p = args.front(); bool relative = *p == '+' || *p == '-'; @@ -315,7 +315,7 @@ handle_seekcur(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_crossfade(Client &client, Request args, gcc_unused Response &r) +handle_crossfade(Client &client, Request args, [[maybe_unused]] Response &r) { FloatDuration duration{args.ParseUnsigned(0)}; client.GetPlayerControl().SetCrossFade(duration); @@ -323,7 +323,7 @@ handle_crossfade(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_mixrampdb(Client &client, Request args, gcc_unused Response &r) +handle_mixrampdb(Client &client, Request args, [[maybe_unused]] Response &r) { float db = args.ParseFloat(0); client.GetPlayerControl().SetMixRampDb(db); @@ -331,7 +331,7 @@ handle_mixrampdb(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_mixrampdelay(Client &client, Request args, gcc_unused Response &r) +handle_mixrampdelay(Client &client, Request args, [[maybe_unused]] Response &r) { FloatDuration delay_secs{args.ParseFloat(0)}; client.GetPlayerControl().SetMixRampDelay(delay_secs); @@ -349,7 +349,7 @@ handle_replay_gain_mode(Client &client, Request args, Response &) } CommandResult -handle_replay_gain_status(Client &client, gcc_unused Request args, +handle_replay_gain_status(Client &client, [[maybe_unused]] Request args, Response &r) { r.Format("replay_gain_mode: %s\n", diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx index 2d80d9ded..74aa9596c 100644 --- a/src/command/PlaylistCommands.cxx +++ b/src/command/PlaylistCommands.cxx @@ -60,14 +60,14 @@ print_spl_list(Response &r, const PlaylistVector &list) } CommandResult -handle_save(Client &client, Request args, gcc_unused Response &r) +handle_save(Client &client, Request args, [[maybe_unused]] Response &r) { spl_save_playlist(args.front(), client.GetPlaylist()); return CommandResult::OK; } CommandResult -handle_load(Client &client, Request args, gcc_unused Response &r) +handle_load(Client &client, Request args, [[maybe_unused]] Response &r) { const auto uri = LocateUri(UriPluginKind::PLAYLIST, args.front(), &client @@ -132,7 +132,7 @@ handle_listplaylistinfo(Client &client, Request args, Response &r) } CommandResult -handle_rm(gcc_unused Client &client, Request args, gcc_unused Response &r) +handle_rm([[maybe_unused]] Client &client, Request args, [[maybe_unused]] Response &r) { const char *const name = args.front(); @@ -141,7 +141,7 @@ handle_rm(gcc_unused Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_rename(gcc_unused Client &client, Request args, gcc_unused Response &r) +handle_rename([[maybe_unused]] Client &client, Request args, [[maybe_unused]] Response &r) { const char *const old_name = args[0]; const char *const new_name = args[1]; @@ -151,8 +151,8 @@ handle_rename(gcc_unused Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_playlistdelete(gcc_unused Client &client, - Request args, gcc_unused Response &r) +handle_playlistdelete([[maybe_unused]] Client &client, + Request args, [[maybe_unused]] Response &r) { const char *const name = args[0]; unsigned from = args.ParseUnsigned(1); @@ -162,8 +162,8 @@ handle_playlistdelete(gcc_unused Client &client, } CommandResult -handle_playlistmove(gcc_unused Client &client, - Request args, gcc_unused Response &r) +handle_playlistmove([[maybe_unused]] Client &client, + Request args, [[maybe_unused]] Response &r) { const char *const name = args.front(); unsigned from = args.ParseUnsigned(1); @@ -174,8 +174,8 @@ handle_playlistmove(gcc_unused Client &client, } CommandResult -handle_playlistclear(gcc_unused Client &client, - Request args, gcc_unused Response &r) +handle_playlistclear([[maybe_unused]] Client &client, + Request args, [[maybe_unused]] Response &r) { const char *const name = args.front(); @@ -184,7 +184,7 @@ handle_playlistclear(gcc_unused Client &client, } CommandResult -handle_playlistadd(Client &client, Request args, gcc_unused Response &r) +handle_playlistadd(Client &client, Request args, [[maybe_unused]] Response &r) { const char *const playlist = args[0]; const char *const uri = args[1]; @@ -209,7 +209,7 @@ handle_playlistadd(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_listplaylists(gcc_unused Client &client, gcc_unused Request args, +handle_listplaylists([[maybe_unused]] Client &client, [[maybe_unused]] Request args, Response &r) { print_spl_list(r, ListPlaylistFiles()); diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx index 7bc1c51ad..5b099c16c 100644 --- a/src/command/QueueCommands.cxx +++ b/src/command/QueueCommands.cxx @@ -51,7 +51,7 @@ AddUri(Client &client, const LocatedUri &uri) static CommandResult AddDatabaseSelection(Client &client, const char *uri, - gcc_unused Response &r) + [[maybe_unused]] Response &r) { #ifdef ENABLE_DATABASE auto &partition = client.GetPartition(); @@ -179,7 +179,7 @@ handle_rangeid(Client &client, Request args, Response &r) } CommandResult -handle_delete(Client &client, Request args, gcc_unused Response &r) +handle_delete(Client &client, Request args, [[maybe_unused]] Response &r) { RangeArg range = args.ParseRange(0); client.GetPartition().DeleteRange(range.start, range.end); @@ -187,7 +187,7 @@ handle_delete(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_deleteid(Client &client, Request args, gcc_unused Response &r) +handle_deleteid(Client &client, Request args, [[maybe_unused]] Response &r) { unsigned id = args.ParseUnsigned(0); client.GetPartition().DeleteId(id); @@ -195,14 +195,14 @@ handle_deleteid(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_playlist(Client &client, gcc_unused Request args, Response &r) +handle_playlist(Client &client, [[maybe_unused]] Request args, Response &r) { playlist_print_uris(r, client.GetPlaylist()); return CommandResult::OK; } CommandResult -handle_shuffle(gcc_unused Client &client, Request args, gcc_unused Response &r) +handle_shuffle([[maybe_unused]] Client &client, Request args, [[maybe_unused]] Response &r) { RangeArg range = args.ParseOptional(0, RangeArg::All()); client.GetPartition().Shuffle(range.start, range.end); @@ -210,7 +210,7 @@ handle_shuffle(gcc_unused Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_clear(Client &client, gcc_unused Request args, gcc_unused Response &r) +handle_clear(Client &client, [[maybe_unused]] Request args, [[maybe_unused]] Response &r) { client.GetPartition().ClearQueue(); return CommandResult::OK; @@ -291,7 +291,7 @@ handle_playlistsearch(Client &client, Request args, Response &r) } CommandResult -handle_prio(Client &client, Request args, gcc_unused Response &r) +handle_prio(Client &client, Request args, [[maybe_unused]] Response &r) { unsigned priority = args.ParseUnsigned(0, 0xff); args.shift(); @@ -307,7 +307,7 @@ handle_prio(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_prioid(Client &client, Request args, gcc_unused Response &r) +handle_prioid(Client &client, Request args, [[maybe_unused]] Response &r) { unsigned priority = args.ParseUnsigned(0, 0xff); args.shift(); @@ -323,7 +323,7 @@ handle_prioid(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_move(Client &client, Request args, gcc_unused Response &r) +handle_move(Client &client, Request args, [[maybe_unused]] Response &r) { RangeArg range = args.ParseRange(0); int to = args.ParseInt(1); @@ -332,7 +332,7 @@ handle_move(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_moveid(Client &client, Request args, gcc_unused Response &r) +handle_moveid(Client &client, Request args, [[maybe_unused]] Response &r) { unsigned id = args.ParseUnsigned(0); int to = args.ParseInt(1); @@ -341,7 +341,7 @@ handle_moveid(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_swap(Client &client, Request args, gcc_unused Response &r) +handle_swap(Client &client, Request args, [[maybe_unused]] Response &r) { unsigned song1 = args.ParseUnsigned(0); unsigned song2 = args.ParseUnsigned(1); @@ -350,7 +350,7 @@ handle_swap(Client &client, Request args, gcc_unused Response &r) } CommandResult -handle_swapid(Client &client, Request args, gcc_unused Response &r) +handle_swapid(Client &client, Request args, [[maybe_unused]] Response &r) { unsigned id1 = args.ParseUnsigned(0); unsigned id2 = args.ParseUnsigned(1); diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx index 5cce791c7..8809fa995 100644 --- a/src/command/StorageCommands.cxx +++ b/src/command/StorageCommands.cxx @@ -143,7 +143,7 @@ print_storage_uri(Client &client, Response &r, const Storage &storage) } CommandResult -handle_listmounts(Client &client, gcc_unused Request args, Response &r) +handle_listmounts(Client &client, [[maybe_unused]] Request args, Response &r) { Storage *_composite = client.GetInstance().storage; if (_composite == nullptr) { diff --git a/src/db/Interface.hxx b/src/db/Interface.hxx index 8f3a47eb0..708eb240c 100644 --- a/src/db/Interface.hxx +++ b/src/db/Interface.hxx @@ -126,8 +126,8 @@ public: * * @return the job id or 0 if not implemented */ - virtual unsigned Update(gcc_unused const char *uri_utf8, - gcc_unused bool discard) { + virtual unsigned Update([[maybe_unused]] const char *uri_utf8, + [[maybe_unused]] bool discard) { /* not implemented: return 0 */ return 0; } diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 703cf88af..0bc318b6e 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -575,7 +575,7 @@ ProxyDatabase::Disconnect() noexcept } bool -ProxyDatabase::OnSocketReady(gcc_unused unsigned flags) noexcept +ProxyDatabase::OnSocketReady([[maybe_unused]] unsigned flags) noexcept { assert(connection != nullptr); diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index 57c4ad47e..4cd1ea892 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -70,7 +70,7 @@ inline SimpleDatabase::SimpleDatabase(const ConfigBlock &block) inline SimpleDatabase::SimpleDatabase(AllocatedPath &&_path, #ifndef ENABLE_ZLIB - gcc_unused + [[maybe_unused]] #endif bool _compress) noexcept :Database(simple_db_plugin), @@ -85,7 +85,7 @@ inline SimpleDatabase::SimpleDatabase(AllocatedPath &&_path, DatabasePtr SimpleDatabase::Create(EventLoop &, EventLoop &, - gcc_unused DatabaseListener &listener, + [[maybe_unused]] DatabaseListener &listener, const ConfigBlock &block) { return std::make_unique(block); @@ -248,7 +248,7 @@ SimpleDatabase::GetSong(const char *uri) const } void -SimpleDatabase::ReturnSong(gcc_unused const LightSong *song) const noexcept +SimpleDatabase::ReturnSong([[maybe_unused]] const LightSong *song) const noexcept { assert(song != nullptr); assert(song == prefixed_light_song || song == &light_song.Get()); diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 208a0cb4c..597c67fa0 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -145,7 +145,7 @@ private: DatabasePtr UpnpDatabase::Create(EventLoop &, EventLoop &io_event_loop, - gcc_unused DatabaseListener &listener, + [[maybe_unused]] DatabaseListener &listener, const ConfigBlock &) noexcept { return std::make_unique(io_event_loop); diff --git a/src/db/update/InotifySource.cxx b/src/db/update/InotifySource.cxx index d45764f24..e6508f463 100644 --- a/src/db/update/InotifySource.cxx +++ b/src/db/update/InotifySource.cxx @@ -31,7 +31,7 @@ #include bool -InotifySource::OnSocketReady(gcc_unused unsigned flags) noexcept +InotifySource::OnSocketReady([[maybe_unused]] unsigned flags) noexcept { uint8_t buffer[4096]; static_assert(sizeof(buffer) >= sizeof(struct inotify_event) + NAME_MAX + 1, diff --git a/src/db/update/InotifyUpdate.cxx b/src/db/update/InotifyUpdate.cxx index 5d0154969..8df7bad8d 100644 --- a/src/db/update/InotifyUpdate.cxx +++ b/src/db/update/InotifyUpdate.cxx @@ -236,7 +236,7 @@ WatchDirectory::GetDepth() const noexcept static void mpd_inotify_callback(int wd, unsigned mask, - gcc_unused const char *name, gcc_unused void *ctx) + [[maybe_unused]] const char *name, [[maybe_unused]] void *ctx) { WatchDirectory *directory; diff --git a/src/db/update/Walk.hxx b/src/db/update/Walk.hxx index 0b9649a3d..3d0793e38 100644 --- a/src/db/update/Walk.hxx +++ b/src/db/update/Walk.hxx @@ -111,10 +111,10 @@ private: #else - bool UpdateArchiveFile(gcc_unused Directory &directory, - gcc_unused const char *name, - gcc_unused const char *suffix, - gcc_unused const StorageFileInfo &info) noexcept { + bool UpdateArchiveFile([[maybe_unused]] Directory &directory, + [[maybe_unused]] const char *name, + [[maybe_unused]] const char *suffix, + [[maybe_unused]] const StorageFileInfo &info) noexcept { return false; } #endif diff --git a/src/decoder/plugins/FlacDecoderPlugin.cxx b/src/decoder/plugins/FlacDecoderPlugin.cxx index ca36180ad..e1c06c5a6 100644 --- a/src/decoder/plugins/FlacDecoderPlugin.cxx +++ b/src/decoder/plugins/FlacDecoderPlugin.cxx @@ -53,7 +53,7 @@ static void flacPrintErroredState(FLAC__StreamDecoderState state) LogError(flac_domain, FLAC__StreamDecoderStateString[state]); } -static void flacMetadata(gcc_unused const FLAC__StreamDecoder * dec, +static void flacMetadata([[maybe_unused]] const FLAC__StreamDecoder * dec, const FLAC__StreamMetadata * block, void *vdata) { auto &fd = *(FlacDecoder *)vdata; @@ -307,7 +307,7 @@ flac_decode(DecoderClient &client, InputStream &input_stream) } static bool -oggflac_init(gcc_unused const ConfigBlock &block) +oggflac_init([[maybe_unused]] const ConfigBlock &block) { return !!FLAC_API_SUPPORTS_OGG_FLAC; } diff --git a/src/decoder/plugins/FlacInput.cxx b/src/decoder/plugins/FlacInput.cxx index 94bbf9ca1..8cbab30e8 100644 --- a/src/decoder/plugins/FlacInput.cxx +++ b/src/decoder/plugins/FlacInput.cxx @@ -98,7 +98,7 @@ FlacInput::Error(FLAC__StreamDecoderErrorStatus status) } FLAC__StreamDecoderReadStatus -FlacInput::Read(gcc_unused const FLAC__StreamDecoder *flac_decoder, +FlacInput::Read([[maybe_unused]] const FLAC__StreamDecoder *flac_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) { @@ -108,7 +108,7 @@ FlacInput::Read(gcc_unused const FLAC__StreamDecoder *flac_decoder, } FLAC__StreamDecoderSeekStatus -FlacInput::Seek(gcc_unused const FLAC__StreamDecoder *flac_decoder, +FlacInput::Seek([[maybe_unused]] const FLAC__StreamDecoder *flac_decoder, FLAC__uint64 absolute_byte_offset, void *client_data) { auto *i = (FlacInput *)client_data; @@ -117,7 +117,7 @@ FlacInput::Seek(gcc_unused const FLAC__StreamDecoder *flac_decoder, } FLAC__StreamDecoderTellStatus -FlacInput::Tell(gcc_unused const FLAC__StreamDecoder *flac_decoder, +FlacInput::Tell([[maybe_unused]] const FLAC__StreamDecoder *flac_decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { auto *i = (FlacInput *)client_data; @@ -126,7 +126,7 @@ FlacInput::Tell(gcc_unused const FLAC__StreamDecoder *flac_decoder, } FLAC__StreamDecoderLengthStatus -FlacInput::Length(gcc_unused const FLAC__StreamDecoder *flac_decoder, +FlacInput::Length([[maybe_unused]] const FLAC__StreamDecoder *flac_decoder, FLAC__uint64 *stream_length, void *client_data) { auto *i = (FlacInput *)client_data; @@ -135,7 +135,7 @@ FlacInput::Length(gcc_unused const FLAC__StreamDecoder *flac_decoder, } FLAC__bool -FlacInput::Eof(gcc_unused const FLAC__StreamDecoder *flac_decoder, +FlacInput::Eof([[maybe_unused]] const FLAC__StreamDecoder *flac_decoder, void *client_data) { auto *i = (FlacInput *)client_data; @@ -144,7 +144,7 @@ FlacInput::Eof(gcc_unused const FLAC__StreamDecoder *flac_decoder, } void -FlacInput::Error(gcc_unused const FLAC__StreamDecoder *decoder, +FlacInput::Error([[maybe_unused]] const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { auto *i = (FlacInput *)client_data; diff --git a/src/decoder/plugins/FluidsynthDecoderPlugin.cxx b/src/decoder/plugins/FluidsynthDecoderPlugin.cxx index 722aa44d0..9aa8e2d0d 100644 --- a/src/decoder/plugins/FluidsynthDecoderPlugin.cxx +++ b/src/decoder/plugins/FluidsynthDecoderPlugin.cxx @@ -196,7 +196,7 @@ fluidsynth_file_decode(DecoderClient &client, Path path_fs) static bool fluidsynth_scan_file(Path path_fs, - gcc_unused TagHandler &handler) noexcept + [[maybe_unused]] TagHandler &handler) noexcept { return fluid_is_midifile(path_fs.c_str()); } diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx index 3ee92f877..84365fae2 100644 --- a/src/decoder/plugins/GmeDecoderPlugin.cxx +++ b/src/decoder/plugins/GmeDecoderPlugin.cxx @@ -62,7 +62,7 @@ static int gme_accuracy; #endif static bool -gme_plugin_init(gcc_unused const ConfigBlock &block) +gme_plugin_init([[maybe_unused]] const ConfigBlock &block) { #if GME_VERSION >= 0x000600 auto accuracy = block.GetBlockParam("accuracy"); diff --git a/src/decoder/plugins/Mpg123DecoderPlugin.cxx b/src/decoder/plugins/Mpg123DecoderPlugin.cxx index 6e85e111b..984f74928 100644 --- a/src/decoder/plugins/Mpg123DecoderPlugin.cxx +++ b/src/decoder/plugins/Mpg123DecoderPlugin.cxx @@ -37,7 +37,7 @@ static constexpr Domain mpg123_domain("mpg123"); static bool -mpd_mpg123_init(gcc_unused const ConfigBlock &block) +mpd_mpg123_init([[maybe_unused]] const ConfigBlock &block) { mpg123_init(); diff --git a/src/decoder/plugins/OpusDecoderPlugin.cxx b/src/decoder/plugins/OpusDecoderPlugin.cxx index 37fc86b3f..1dc2d6441 100644 --- a/src/decoder/plugins/OpusDecoderPlugin.cxx +++ b/src/decoder/plugins/OpusDecoderPlugin.cxx @@ -64,7 +64,7 @@ IsOpusTags(const ogg_packet &packet) noexcept } bool -mpd_opus_init(gcc_unused const ConfigBlock &block) +mpd_opus_init([[maybe_unused]] const ConfigBlock &block) { LogDebug(opus_domain, opus_get_version_string()); diff --git a/src/decoder/plugins/SndfileDecoderPlugin.cxx b/src/decoder/plugins/SndfileDecoderPlugin.cxx index 91baf1275..6aec0825f 100644 --- a/src/decoder/plugins/SndfileDecoderPlugin.cxx +++ b/src/decoder/plugins/SndfileDecoderPlugin.cxx @@ -34,7 +34,7 @@ static constexpr Domain sndfile_domain("sndfile"); static bool -sndfile_init(gcc_unused const ConfigBlock &block) +sndfile_init([[maybe_unused]] const ConfigBlock &block) { LogDebug(sndfile_domain, sf_version_string()); return true; @@ -109,9 +109,9 @@ sndfile_vio_read(void *ptr, sf_count_t count, void *user_data) } static sf_count_t -sndfile_vio_write(gcc_unused const void *ptr, - gcc_unused sf_count_t count, - gcc_unused void *user_data) +sndfile_vio_write([[maybe_unused]] const void *ptr, + [[maybe_unused]] sf_count_t count, + [[maybe_unused]] void *user_data) { /* no writing! */ return -1; diff --git a/src/decoder/plugins/VorbisDecoderPlugin.cxx b/src/decoder/plugins/VorbisDecoderPlugin.cxx index eadd76573..b71fdd4d8 100644 --- a/src/decoder/plugins/VorbisDecoderPlugin.cxx +++ b/src/decoder/plugins/VorbisDecoderPlugin.cxx @@ -311,7 +311,7 @@ VorbisDecoder::OnOggEnd() /* public */ static bool -vorbis_init(gcc_unused const ConfigBlock &block) +vorbis_init([[maybe_unused]] const ConfigBlock &block) { #ifndef HAVE_TREMOR LogDebug(vorbis_domain, vorbis_version_string()); diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx index 93459f311..4bb629d25 100644 --- a/src/decoder/plugins/WavpackDecoderPlugin.cxx +++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx @@ -143,7 +143,7 @@ format_samples_int(void *buffer, uint32_t count) * No conversion necessary. */ static void -format_samples_nop(gcc_unused void *buffer, gcc_unused uint32_t count) +format_samples_nop([[maybe_unused]] void *buffer, [[maybe_unused]] uint32_t count) { /* do nothing */ } diff --git a/src/encoder/EncoderInterface.hxx b/src/encoder/EncoderInterface.hxx index 3730bb3d8..519cd1110 100644 --- a/src/encoder/EncoderInterface.hxx +++ b/src/encoder/EncoderInterface.hxx @@ -84,7 +84,7 @@ public: * * @param tag the tag object */ - virtual void SendTag(gcc_unused const Tag &tag) { + virtual void SendTag([[maybe_unused]] const Tag &tag) { } /** diff --git a/src/encoder/plugins/FlacEncoderPlugin.cxx b/src/encoder/plugins/FlacEncoderPlugin.cxx index 632a2f1ce..108aa4b00 100644 --- a/src/encoder/plugins/FlacEncoderPlugin.cxx +++ b/src/encoder/plugins/FlacEncoderPlugin.cxx @@ -69,8 +69,8 @@ private: static FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *, const FLAC__byte data[], size_t bytes, - gcc_unused unsigned samples, - gcc_unused unsigned current_frame, + [[maybe_unused]] unsigned samples, + [[maybe_unused]] unsigned current_frame, void *client_data) noexcept { auto &encoder = *(FlacEncoder *)client_data; encoder.output_buffer.Append((const uint8_t *)data, bytes); diff --git a/src/encoder/plugins/NullEncoderPlugin.cxx b/src/encoder/plugins/NullEncoderPlugin.cxx index 73fac5b0c..d9405983e 100644 --- a/src/encoder/plugins/NullEncoderPlugin.cxx +++ b/src/encoder/plugins/NullEncoderPlugin.cxx @@ -49,7 +49,7 @@ public: }; static PreparedEncoder * -null_encoder_init(gcc_unused const ConfigBlock &block) +null_encoder_init([[maybe_unused]] const ConfigBlock &block) { return new PreparedNullEncoder(); } diff --git a/src/encoder/plugins/WaveEncoderPlugin.cxx b/src/encoder/plugins/WaveEncoderPlugin.cxx index 522bd7a1e..96b20885a 100644 --- a/src/encoder/plugins/WaveEncoderPlugin.cxx +++ b/src/encoder/plugins/WaveEncoderPlugin.cxx @@ -98,7 +98,7 @@ fill_wave_header(WaveHeader *header, int channels, int bits, } static PreparedEncoder * -wave_encoder_init(gcc_unused const ConfigBlock &block) +wave_encoder_init([[maybe_unused]] const ConfigBlock &block) { return new PreparedWaveEncoder(); } diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index a7ae5c479..c83f652da 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -271,7 +271,7 @@ EventLoop::HandleDeferred() noexcept } bool -EventLoop::OnSocketReady(gcc_unused unsigned flags) noexcept +EventLoop::OnSocketReady([[maybe_unused]] unsigned flags) noexcept { assert(IsInside()); diff --git a/src/event/PollGroupEpoll.hxx b/src/event/PollGroupEpoll.hxx index ecd41a1c8..7d8bc71e0 100644 --- a/src/event/PollGroupEpoll.hxx +++ b/src/event/PollGroupEpoll.hxx @@ -89,7 +89,7 @@ public: return epoll.Remove(fd); } - bool Abandon(gcc_unused int fd) noexcept { + bool Abandon([[maybe_unused]] int fd) noexcept { // Nothing to do in this implementation. // Closed descriptors are automatically unregistered. return true; diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index 583508d07..35407edb7 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -161,7 +161,7 @@ ServerSocket::OneServerSocket::Accept() noexcept } bool -ServerSocket::OneServerSocket::OnSocketReady(gcc_unused unsigned flags) noexcept +ServerSocket::OneServerSocket::OnSocketReady([[maybe_unused]] unsigned flags) noexcept { Accept(); return true; diff --git a/src/filter/Observer.cxx b/src/filter/Observer.cxx index e052272eb..73a6e758e 100644 --- a/src/filter/Observer.cxx +++ b/src/filter/Observer.cxx @@ -43,7 +43,7 @@ public: observer.proxy = nullptr; } - void Clear(gcc_unused Proxy *_child) noexcept { + void Clear([[maybe_unused]] Proxy *_child) noexcept { assert(child == _child); child = nullptr; } diff --git a/src/filter/plugins/NormalizeFilterPlugin.cxx b/src/filter/plugins/NormalizeFilterPlugin.cxx index b4e0b444b..4d3e936ee 100644 --- a/src/filter/plugins/NormalizeFilterPlugin.cxx +++ b/src/filter/plugins/NormalizeFilterPlugin.cxx @@ -53,7 +53,7 @@ public: }; static std::unique_ptr -normalize_filter_init(gcc_unused const ConfigBlock &block) +normalize_filter_init([[maybe_unused]] const ConfigBlock &block) { return std::make_unique(); } diff --git a/src/filter/plugins/NullFilterPlugin.cxx b/src/filter/plugins/NullFilterPlugin.cxx index 115124179..143c104ab 100644 --- a/src/filter/plugins/NullFilterPlugin.cxx +++ b/src/filter/plugins/NullFilterPlugin.cxx @@ -38,7 +38,7 @@ public: }; static std::unique_ptr -null_filter_init(gcc_unused const ConfigBlock &block) +null_filter_init([[maybe_unused]] const ConfigBlock &block) { return std::make_unique(); } diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx index fb07fe438..51f73678a 100644 --- a/src/fs/io/FileOutputStream.cxx +++ b/src/fs/io/FileOutputStream.cxx @@ -81,7 +81,7 @@ FileOutputStream::Open() #ifdef _WIN32 inline void -FileOutputStream::OpenCreate(gcc_unused bool visible) +FileOutputStream::OpenCreate([[maybe_unused]] bool visible) { handle = CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, diff --git a/src/input/InputStream.cxx b/src/input/InputStream.cxx index 1ed319466..069078e70 100644 --- a/src/input/InputStream.cxx +++ b/src/input/InputStream.cxx @@ -69,7 +69,7 @@ InputStream::CheapSeeking() const noexcept } void -InputStream::Seek(std::unique_lock &, gcc_unused offset_type new_offset) +InputStream::Seek(std::unique_lock &, [[maybe_unused]] offset_type new_offset) { throw std::runtime_error("Seeking is not implemented"); } diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx index d09126d14..a5902006c 100644 --- a/src/input/plugins/AlsaInputPlugin.cxx +++ b/src/input/plugins/AlsaInputPlugin.cxx @@ -110,7 +110,7 @@ protected: InvalidateSockets(); } - void DoSeek(gcc_unused offset_type new_offset) override { + void DoSeek([[maybe_unused]] offset_type new_offset) override { /* unreachable because seekable==false */ SeekDone(); } diff --git a/src/lib/curl/Global.cxx b/src/lib/curl/Global.cxx index 24c17798e..8b32eae97 100644 --- a/src/lib/curl/Global.cxx +++ b/src/lib/curl/Global.cxx @@ -108,7 +108,7 @@ CurlGlobal::CurlGlobal(EventLoop &_loop) } int -CurlSocket::SocketFunction(gcc_unused CURL *easy, +CurlSocket::SocketFunction([[maybe_unused]] CURL *easy, curl_socket_t s, int action, void *userp, void *socketp) noexcept { @@ -230,7 +230,7 @@ CurlGlobal::UpdateTimeout(long timeout_ms) noexcept } int -CurlGlobal::TimerFunction(gcc_unused CURLM *_multi, long timeout_ms, +CurlGlobal::TimerFunction([[maybe_unused]] CURLM *_multi, long timeout_ms, void *userp) noexcept { auto &global = *(CurlGlobal *)userp; diff --git a/src/lib/ffmpeg/LogCallback.cxx b/src/lib/ffmpeg/LogCallback.cxx index d88f298d0..7588ae6d7 100644 --- a/src/lib/ffmpeg/LogCallback.cxx +++ b/src/lib/ffmpeg/LogCallback.cxx @@ -47,7 +47,7 @@ FfmpegImportLogLevel(int level) noexcept } void -FfmpegLogCallback(gcc_unused void *ptr, int level, const char *fmt, std::va_list vl) +FfmpegLogCallback(void *ptr, int level, const char *fmt, std::va_list vl) { const AVClass * cls = nullptr; diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx index e51ebf509..c1dc8d18d 100644 --- a/src/lib/nfs/Connection.cxx +++ b/src/lib/nfs/Connection.cxx @@ -172,7 +172,7 @@ NfsConnection::CancellableCallback::Callback(int err, void *data) noexcept void NfsConnection::CancellableCallback::Callback(int err, - gcc_unused struct nfs_context *nfs, + [[maybe_unused]] struct nfs_context *nfs, void *data, void *private_data) noexcept { @@ -551,8 +551,8 @@ NfsConnection::OnSocketReady(unsigned flags) noexcept } inline void -NfsConnection::MountCallback(int status, gcc_unused nfs_context *nfs, - gcc_unused void *data) noexcept +NfsConnection::MountCallback(int status, [[maybe_unused]] nfs_context *nfs, + [[maybe_unused]] void *data) noexcept { assert(GetEventLoop().IsInside()); assert(context == nfs); diff --git a/src/lib/smbclient/Init.cxx b/src/lib/smbclient/Init.cxx index fe2ee51b2..746b68925 100644 --- a/src/lib/smbclient/Init.cxx +++ b/src/lib/smbclient/Init.cxx @@ -27,11 +27,11 @@ #include static void -mpd_smbc_get_auth_data(gcc_unused const char *srv, - gcc_unused const char *shr, - char *wg, gcc_unused int wglen, - char *un, gcc_unused int unlen, - char *pw, gcc_unused int pwlen) +mpd_smbc_get_auth_data([[maybe_unused]] const char *srv, + [[maybe_unused]] const char *shr, + char *wg, [[maybe_unused]] int wglen, + char *un, [[maybe_unused]] int unlen, + char *pw, [[maybe_unused]] int pwlen) { // TODO: implement strcpy(wg, "WORKGROUP"); diff --git a/src/lib/sqlite/Util.hxx b/src/lib/sqlite/Util.hxx index ba142f55a..b05b73b2f 100644 --- a/src/lib/sqlite/Util.hxx +++ b/src/lib/sqlite/Util.hxx @@ -54,7 +54,7 @@ Bind(sqlite3_stmt *stmt, unsigned i, const char *value) template static void -BindAll2(gcc_unused sqlite3_stmt *stmt, gcc_unused unsigned i) +BindAll2([[maybe_unused]] sqlite3_stmt *stmt, [[maybe_unused]] unsigned i) { assert(int(i - 1) == sqlite3_bind_parameter_count(stmt)); } diff --git a/src/lib/upnp/Action.hxx b/src/lib/upnp/Action.hxx index d717f8d5d..6de060560 100644 --- a/src/lib/upnp/Action.hxx +++ b/src/lib/upnp/Action.hxx @@ -32,7 +32,7 @@ CountNameValuePairs() noexcept template static constexpr unsigned -CountNameValuePairs(gcc_unused const char *name, gcc_unused const char *value, +CountNameValuePairs([[maybe_unused]] const char *name, [[maybe_unused]] const char *value, Args... args) noexcept { return 1 + CountNameValuePairs(args...); diff --git a/src/lib/xiph/FlacIOHandle.cxx b/src/lib/xiph/FlacIOHandle.cxx index fb0079b20..13f837fd8 100644 --- a/src/lib/xiph/FlacIOHandle.cxx +++ b/src/lib/xiph/FlacIOHandle.cxx @@ -119,7 +119,7 @@ FlacIOEof(FLAC__IOHandle handle) } static int -FlacIOClose(gcc_unused FLAC__IOHandle handle) +FlacIOClose([[maybe_unused]] FLAC__IOHandle handle) { /* no-op because the libFLAC caller is responsible for closing the #InputStream */ diff --git a/src/mixer/plugins/AlsaMixerPlugin.cxx b/src/mixer/plugins/AlsaMixerPlugin.cxx index e3d774194..836989cee 100644 --- a/src/mixer/plugins/AlsaMixerPlugin.cxx +++ b/src/mixer/plugins/AlsaMixerPlugin.cxx @@ -173,7 +173,7 @@ AlsaMixer::Configure(const ConfigBlock &block) } static Mixer * -alsa_mixer_init(EventLoop &event_loop, gcc_unused AudioOutput &ao, +alsa_mixer_init(EventLoop &event_loop, [[maybe_unused]] AudioOutput &ao, MixerListener &listener, const ConfigBlock &block) { diff --git a/src/mixer/plugins/HaikuMixerPlugin.cxx b/src/mixer/plugins/HaikuMixerPlugin.cxx index af5529f9a..da2067bf3 100644 --- a/src/mixer/plugins/HaikuMixerPlugin.cxx +++ b/src/mixer/plugins/HaikuMixerPlugin.cxx @@ -47,9 +47,9 @@ public: }; static Mixer * -haiku_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao, +haiku_mixer_init([[maybe_unused]] EventLoop &event_loop, AudioOutput &ao, MixerListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { return new HaikuMixer((HaikuOutput &)ao, listener); } diff --git a/src/mixer/plugins/NullMixerPlugin.cxx b/src/mixer/plugins/NullMixerPlugin.cxx index 4f8989d50..bfb5edb34 100644 --- a/src/mixer/plugins/NullMixerPlugin.cxx +++ b/src/mixer/plugins/NullMixerPlugin.cxx @@ -49,10 +49,10 @@ public: }; static Mixer * -null_mixer_init(gcc_unused EventLoop &event_loop, - gcc_unused AudioOutput &ao, +null_mixer_init([[maybe_unused]] EventLoop &event_loop, + [[maybe_unused]] AudioOutput &ao, MixerListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { return new NullMixer(listener); } diff --git a/src/mixer/plugins/OSXMixerPlugin.cxx b/src/mixer/plugins/OSXMixerPlugin.cxx index ea6bdf719..2370103db 100644 --- a/src/mixer/plugins/OSXMixerPlugin.cxx +++ b/src/mixer/plugins/OSXMixerPlugin.cxx @@ -54,9 +54,9 @@ OSXMixer::SetVolume(unsigned new_volume) } static Mixer * -osx_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao, +osx_mixer_init([[maybe_unused]] EventLoop &event_loop, AudioOutput &ao, MixerListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { OSXOutput &osxo = (OSXOutput &)ao; return new OSXMixer(osxo, listener); diff --git a/src/mixer/plugins/OssMixerPlugin.cxx b/src/mixer/plugins/OssMixerPlugin.cxx index a53559997..92896dbef 100644 --- a/src/mixer/plugins/OssMixerPlugin.cxx +++ b/src/mixer/plugins/OssMixerPlugin.cxx @@ -97,8 +97,8 @@ OssMixer::Configure(const ConfigBlock &block) } static Mixer * -oss_mixer_init(gcc_unused EventLoop &event_loop, - gcc_unused AudioOutput &ao, +oss_mixer_init([[maybe_unused]] EventLoop &event_loop, + [[maybe_unused]] AudioOutput &ao, MixerListener &listener, const ConfigBlock &block) { diff --git a/src/mixer/plugins/PulseMixerPlugin.cxx b/src/mixer/plugins/PulseMixerPlugin.cxx index 428e3c4af..0104f45b1 100644 --- a/src/mixer/plugins/PulseMixerPlugin.cxx +++ b/src/mixer/plugins/PulseMixerPlugin.cxx @@ -104,7 +104,7 @@ PulseMixer::VolumeCallback(const pa_sink_input_info *i, int eol) * value. */ static void -pulse_mixer_volume_cb(gcc_unused pa_context *context, const pa_sink_input_info *i, +pulse_mixer_volume_cb([[maybe_unused]] pa_context *context, const pa_sink_input_info *i, int eol, void *userdata) { auto *pm = (PulseMixer *)userdata; @@ -133,7 +133,7 @@ PulseMixer::Update(pa_context *context, pa_stream *stream) } void -pulse_mixer_on_connect(gcc_unused PulseMixer &pm, +pulse_mixer_on_connect([[maybe_unused]] PulseMixer &pm, struct pa_context *context) { pa_operation *o; @@ -182,7 +182,7 @@ parse_volume_scale_factor(const char *value) { } static Mixer * -pulse_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao, +pulse_mixer_init([[maybe_unused]] EventLoop &event_loop, AudioOutput &ao, MixerListener &listener, const ConfigBlock &block) { diff --git a/src/mixer/plugins/SndioMixerPlugin.cxx b/src/mixer/plugins/SndioMixerPlugin.cxx index c80fad411..d9776c02d 100644 --- a/src/mixer/plugins/SndioMixerPlugin.cxx +++ b/src/mixer/plugins/SndioMixerPlugin.cxx @@ -45,10 +45,10 @@ public: }; static Mixer * -sndio_mixer_init(gcc_unused EventLoop &event_loop, +sndio_mixer_init([[maybe_unused]] EventLoop &event_loop, AudioOutput &ao, MixerListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { return new SndioMixer((SndioOutput &)ao, listener); } diff --git a/src/mixer/plugins/SoftwareMixerPlugin.cxx b/src/mixer/plugins/SoftwareMixerPlugin.cxx index cb9649017..0a84fa36d 100644 --- a/src/mixer/plugins/SoftwareMixerPlugin.cxx +++ b/src/mixer/plugins/SoftwareMixerPlugin.cxx @@ -57,10 +57,10 @@ public: }; static Mixer * -software_mixer_init(gcc_unused EventLoop &event_loop, - gcc_unused AudioOutput &ao, +software_mixer_init([[maybe_unused]] EventLoop &event_loop, + [[maybe_unused]] AudioOutput &ao, MixerListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { return new SoftwareMixer(listener); } diff --git a/src/mixer/plugins/WinmmMixerPlugin.cxx b/src/mixer/plugins/WinmmMixerPlugin.cxx index 0bf60f58b..49165b6cb 100644 --- a/src/mixer/plugins/WinmmMixerPlugin.cxx +++ b/src/mixer/plugins/WinmmMixerPlugin.cxx @@ -63,9 +63,9 @@ winmm_volume_encode(int volume) } static Mixer * -winmm_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao, +winmm_mixer_init([[maybe_unused]] EventLoop &event_loop, AudioOutput &ao, MixerListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { return new WinmmMixer((WinmmOutput &)ao, listener); } diff --git a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx index 0f6812ff8..b51a0b39b 100644 --- a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx +++ b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx @@ -252,9 +252,9 @@ SmbclientNeighborExplorer::ThreadFunc() noexcept } static std::unique_ptr -smbclient_neighbor_create(gcc_unused EventLoop &loop, +smbclient_neighbor_create([[maybe_unused]] EventLoop &loop, NeighborListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { SmbclientInit(); diff --git a/src/neighbor/plugins/UdisksNeighborPlugin.cxx b/src/neighbor/plugins/UdisksNeighborPlugin.cxx index 820271d67..4ff406f2c 100644 --- a/src/neighbor/plugins/UdisksNeighborPlugin.cxx +++ b/src/neighbor/plugins/UdisksNeighborPlugin.cxx @@ -259,7 +259,7 @@ UdisksNeighborExplorer::HandleMessage(DBusConnection *connection, static std::unique_ptr udisks_neighbor_create(EventLoop &event_loop, NeighborListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { return std::make_unique(event_loop, listener); } diff --git a/src/neighbor/plugins/UpnpNeighborPlugin.cxx b/src/neighbor/plugins/UpnpNeighborPlugin.cxx index e04f5011a..281b9b534 100644 --- a/src/neighbor/plugins/UpnpNeighborPlugin.cxx +++ b/src/neighbor/plugins/UpnpNeighborPlugin.cxx @@ -127,7 +127,7 @@ UpnpNeighborExplorer::LostUPnP(const ContentDirectoryService &service) static std::unique_ptr upnp_neighbor_create(EventLoop &event_loop, NeighborListener &listener, - gcc_unused const ConfigBlock &block) + [[maybe_unused]] const ConfigBlock &block) { return std::make_unique(event_loop, listener); } diff --git a/src/output/Interface.cxx b/src/output/Interface.cxx index 99c200978..9f7250408 100644 --- a/src/output/Interface.cxx +++ b/src/output/Interface.cxx @@ -23,8 +23,8 @@ #include void -AudioOutput::SetAttribute(gcc_unused std::string &&name, - gcc_unused std::string &&value) +AudioOutput::SetAttribute([[maybe_unused]] std::string &&name, + [[maybe_unused]] std::string &&value) { throw std::invalid_argument("Unsupported attribute"); } diff --git a/src/output/SharedPipeConsumer.hxx b/src/output/SharedPipeConsumer.hxx index 814ddeadf..ee4078bed 100644 --- a/src/output/SharedPipeConsumer.hxx +++ b/src/output/SharedPipeConsumer.hxx @@ -76,7 +76,7 @@ public: const MusicChunk *Get() noexcept; - void Consume(gcc_unused const MusicChunk &_chunk) { + void Consume([[maybe_unused]] const MusicChunk &_chunk) { assert(chunk != nullptr); assert(chunk == &_chunk); @@ -86,7 +86,7 @@ public: gcc_pure bool IsConsumed(const MusicChunk &_chunk) const noexcept; - void ClearTail(gcc_unused const MusicChunk &_chunk) noexcept { + void ClearTail([[maybe_unused]] const MusicChunk &_chunk) noexcept { assert(chunk == &_chunk); assert(consumed); chunk = nullptr; diff --git a/src/output/plugins/HaikuOutputPlugin.cxx b/src/output/plugins/HaikuOutputPlugin.cxx index 952fb0c2f..e00df46eb 100644 --- a/src/output/plugins/HaikuOutputPlugin.cxx +++ b/src/output/plugins/HaikuOutputPlugin.cxx @@ -81,9 +81,9 @@ private: std::chrono::steady_clock::duration Delay() const noexcept override; static void _FillBuffer(void* cookie, void* _buffer, size_t size, - gcc_unused const media_raw_audio_format& _format); + [[maybe_unused]] const media_raw_audio_format& _format); void FillBuffer(void* _buffer, size_t size, - gcc_unused const media_raw_audio_format& _format); + [[maybe_unused]] const media_raw_audio_format& _format); void SendTag(const Tag &tag) override; }; @@ -154,7 +154,7 @@ HaikuOutput::_FillBuffer(void* cookie, void* buffer, size_t size, void HaikuOutput::FillBuffer(void* _buffer, size_t size, - gcc_unused const media_raw_audio_format& _format) + [[maybe_unused]] const media_raw_audio_format& _format) { buffer = (uint8*)_buffer; diff --git a/src/output/plugins/NullOutputPlugin.cxx b/src/output/plugins/NullOutputPlugin.cxx index 11572be5f..4e33f3461 100644 --- a/src/output/plugins/NullOutputPlugin.cxx +++ b/src/output/plugins/NullOutputPlugin.cxx @@ -53,7 +53,7 @@ private: : std::chrono::steady_clock::duration::zero(); } - size_t Play(gcc_unused const void *chunk, size_t size) override { + size_t Play([[maybe_unused]] const void *chunk, size_t size) override { if (sync) { if (!timer->IsStarted()) timer->Start(); diff --git a/src/output/plugins/OSXOutputPlugin.cxx b/src/output/plugins/OSXOutputPlugin.cxx index 312d16965..5dfe23641 100644 --- a/src/output/plugins/OSXOutputPlugin.cxx +++ b/src/output/plugins/OSXOutputPlugin.cxx @@ -710,9 +710,9 @@ osx_output_set_device(OSXOutput *oo) */ static OSStatus osx_render(void *vdata, - gcc_unused AudioUnitRenderActionFlags *io_action_flags, - gcc_unused const AudioTimeStamp *in_timestamp, - gcc_unused UInt32 in_bus_number, + [[maybe_unused]] AudioUnitRenderActionFlags *io_action_flags, + [[maybe_unused]] const AudioTimeStamp *in_timestamp, + [[maybe_unused]] UInt32 in_bus_number, UInt32 in_number_frames, AudioBufferList *buffer_list) { diff --git a/src/output/plugins/PipeOutputPlugin.cxx b/src/output/plugins/PipeOutputPlugin.cxx index 62e01be1e..45fbecdfd 100644 --- a/src/output/plugins/PipeOutputPlugin.cxx +++ b/src/output/plugins/PipeOutputPlugin.cxx @@ -57,7 +57,7 @@ PipeOutput::PipeOutput(const ConfigBlock &block) } inline void -PipeOutput::Open(gcc_unused AudioFormat &audio_format) +PipeOutput::Open([[maybe_unused]] AudioFormat &audio_format) { fh = popen(cmd.c_str(), "w"); if (fh == nullptr) diff --git a/src/output/plugins/PulseOutputPlugin.cxx b/src/output/plugins/PulseOutputPlugin.cxx index 0220423bf..6558232d0 100644 --- a/src/output/plugins/PulseOutputPlugin.cxx +++ b/src/output/plugins/PulseOutputPlugin.cxx @@ -62,7 +62,7 @@ class PulseOutput final : AudioOutput { public: void SetMixer(PulseMixer &_mixer); - void ClearMixer(gcc_unused PulseMixer &old_mixer) { + void ClearMixer([[maybe_unused]] PulseMixer &old_mixer) { assert(mixer == &old_mixer); mixer = nullptr; @@ -277,8 +277,8 @@ pulse_wait_for_operation(struct pa_threaded_mainloop *mainloop, * the caller thread, to wake pulse_wait_for_operation() up. */ static void -pulse_output_stream_success_cb(gcc_unused pa_stream *s, - gcc_unused int success, void *userdata) +pulse_output_stream_success_cb([[maybe_unused]] pa_stream *s, + [[maybe_unused]] int success, void *userdata) { PulseOutput &po = *(PulseOutput *)userdata; @@ -342,7 +342,7 @@ PulseOutput::OnServerLayoutChanged(pa_subscription_event_type_t t, } static void -pulse_output_subscribe_cb(gcc_unused pa_context *context, +pulse_output_subscribe_cb([[maybe_unused]] pa_context *context, pa_subscription_event_type_t t, uint32_t idx, void *userdata) { @@ -508,7 +508,7 @@ PulseOutput::WaitConnection() } inline void -PulseOutput::OnStreamSuspended(gcc_unused pa_stream *_stream) +PulseOutput::OnStreamSuspended([[maybe_unused]] pa_stream *_stream) { assert(_stream == stream || stream == nullptr); assert(mainloop != nullptr); @@ -574,7 +574,7 @@ PulseOutput::OnStreamWrite(size_t nbytes) } static void -pulse_output_stream_write_cb(gcc_unused pa_stream *stream, size_t nbytes, +pulse_output_stream_write_cb([[maybe_unused]] pa_stream *stream, size_t nbytes, void *userdata) { PulseOutput &po = *(PulseOutput *)userdata; diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx index ef4b7eaae..b34c1dedf 100644 --- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx +++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx @@ -121,7 +121,7 @@ HttpdOutput::OnDeferredBroadcast() noexcept void HttpdOutput::OnAccept(UniqueSocketDescriptor fd, - SocketAddress, gcc_unused int uid) noexcept + SocketAddress, [[maybe_unused]] int uid) noexcept { /* the listener socket has become readable - a client has connected */ diff --git a/src/output/plugins/sles/SlesOutputPlugin.cxx b/src/output/plugins/sles/SlesOutputPlugin.cxx index b0bcbe7be..ad216e7fc 100644 --- a/src/output/plugins/sles/SlesOutputPlugin.cxx +++ b/src/output/plugins/sles/SlesOutputPlugin.cxx @@ -111,7 +111,7 @@ private: * been consumed. It synthesises and enqueues the next * buffer. */ - static void PlayedCallback(gcc_unused SLAndroidSimpleBufferQueueItf caller, + static void PlayedCallback([[maybe_unused]] SLAndroidSimpleBufferQueueItf caller, void *pContext) { SlesOutput &sles = *(SlesOutput *)pContext; diff --git a/src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx index 343f29845..f6fe530de 100644 --- a/src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx +++ b/src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx @@ -82,7 +82,7 @@ ExtractCuesheetTagHandler::OnPair(StringView name, StringView value) noexcept static std::unique_ptr embcue_playlist_open_uri(const char *uri, - gcc_unused Mutex &mutex) + [[maybe_unused]] Mutex &mutex) { if (!PathTraitsUTF8::IsAbsolute(uri)) /* only local files supported */ diff --git a/src/playlist/plugins/XspfPlaylistPlugin.cxx b/src/playlist/plugins/XspfPlaylistPlugin.cxx index b8d2da61d..504c3720f 100644 --- a/src/playlist/plugins/XspfPlaylistPlugin.cxx +++ b/src/playlist/plugins/XspfPlaylistPlugin.cxx @@ -79,7 +79,7 @@ static constexpr struct tag_table xspf_tag_elements[] = { static void XMLCALL xspf_start_element(void *user_data, const XML_Char *element_name, - gcc_unused const XML_Char **atts) + [[maybe_unused]] const XML_Char **atts) { auto *parser = (XspfParser *)user_data; parser->value.clear(); diff --git a/src/storage/MemoryDirectoryReader.cxx b/src/storage/MemoryDirectoryReader.cxx index 4220c237e..3ac286633 100644 --- a/src/storage/MemoryDirectoryReader.cxx +++ b/src/storage/MemoryDirectoryReader.cxx @@ -36,7 +36,7 @@ MemoryStorageDirectoryReader::Read() noexcept } StorageFileInfo -MemoryStorageDirectoryReader::GetInfo(gcc_unused bool follow) +MemoryStorageDirectoryReader::GetInfo([[maybe_unused]] bool follow) { assert(!first); assert(!entries.empty()); diff --git a/src/storage/StorageInterface.cxx b/src/storage/StorageInterface.cxx index 2a51f8d5f..821c18251 100644 --- a/src/storage/StorageInterface.cxx +++ b/src/storage/StorageInterface.cxx @@ -22,7 +22,7 @@ #include "fs/Traits.hxx" AllocatedPath -Storage::MapFS(gcc_unused const char *uri_utf8) const noexcept +Storage::MapFS([[maybe_unused]] const char *uri_utf8) const noexcept { return nullptr; } diff --git a/src/storage/plugins/CurlStorage.cxx b/src/storage/plugins/CurlStorage.cxx index 98f6de247..5cabd379c 100644 --- a/src/storage/plugins/CurlStorage.cxx +++ b/src/storage/plugins/CurlStorage.cxx @@ -315,7 +315,7 @@ private: /* virtual methods from CommonExpatParser */ void StartElement(const XML_Char *name, - gcc_unused const XML_Char **attrs) final { + [[maybe_unused]] const XML_Char **attrs) final { switch (state) { case State::ROOT: if (strcmp(name, "DAV:|response") == 0) @@ -447,7 +447,7 @@ protected: }; StorageFileInfo -CurlStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow) +CurlStorage::GetInfo(const char *uri_utf8, [[maybe_unused]] bool follow) { // TODO: escape the given URI diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx index f6d4a5dcb..ffcbe13a0 100644 --- a/src/storage/plugins/NfsStorage.cxx +++ b/src/storage/plugins/NfsStorage.cxx @@ -288,7 +288,7 @@ protected: connection.Lstat(path, *this); } - void HandleResult(gcc_unused unsigned status, void *data) noexcept override { + void HandleResult([[maybe_unused]] unsigned status, void *data) noexcept override { Copy(info, *(const struct nfs_stat_64 *)data); } }; @@ -356,7 +356,7 @@ protected: connection.OpenDirectory(path, *this); } - void HandleResult(gcc_unused unsigned status, + void HandleResult([[maybe_unused]] unsigned status, void *data) noexcept override { auto *const dir = (struct nfsdir *)data; diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx index f86542383..a0c662f54 100644 --- a/src/storage/plugins/SmbclientStorage.cxx +++ b/src/storage/plugins/SmbclientStorage.cxx @@ -117,7 +117,7 @@ GetInfo(const char *path) } StorageFileInfo -SmbclientStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow) +SmbclientStorage::GetInfo(const char *uri_utf8, [[maybe_unused]] bool follow) { const std::string mapped = MapUTF8(uri_utf8); return ::GetInfo(mapped.c_str()); @@ -172,14 +172,14 @@ SmbclientDirectoryReader::Read() noexcept } StorageFileInfo -SmbclientDirectoryReader::GetInfo(gcc_unused bool follow) +SmbclientDirectoryReader::GetInfo([[maybe_unused]] bool follow) { const std::string path = PathTraitsUTF8::Build(base.c_str(), name); return ::GetInfo(path.c_str()); } static std::unique_ptr -CreateSmbclientStorageURI(gcc_unused EventLoop &event_loop, const char *base) +CreateSmbclientStorageURI([[maybe_unused]] EventLoop &event_loop, const char *base) { if (!StringStartsWithCaseASCII(base, "smb://")) return nullptr; diff --git a/src/system/EventFD.cxx b/src/system/EventFD.cxx index 80c722953..ebf8f84c3 100644 --- a/src/system/EventFD.cxx +++ b/src/system/EventFD.cxx @@ -56,6 +56,6 @@ EventFD::Write() noexcept assert(fd.IsDefined()); static constexpr eventfd_t value = 1; - gcc_unused ssize_t nbytes = + [[maybe_unused]] ssize_t nbytes = fd.Write(&value, sizeof(value)); } diff --git a/src/system/EventPipe.cxx b/src/system/EventPipe.cxx index 981832b8c..462cc4a1c 100644 --- a/src/system/EventPipe.cxx +++ b/src/system/EventPipe.cxx @@ -85,7 +85,7 @@ EventPipe::Write() noexcept #ifdef _WIN32 send(fds[1], "", 1, 0); #else - gcc_unused ssize_t nbytes = write(fds[1], "", 1); + [[maybe_unused]] ssize_t nbytes = write(fds[1], "", 1); #endif } diff --git a/src/tag/Handler.cxx b/src/tag/Handler.cxx index 467a93517..56c0a53cd 100644 --- a/src/tag/Handler.cxx +++ b/src/tag/Handler.cxx @@ -41,7 +41,7 @@ NullTagHandler::OnPicture(const char *, ConstBuffer) noexcept } void -NullTagHandler::OnAudioFormat(gcc_unused AudioFormat af) noexcept +NullTagHandler::OnAudioFormat([[maybe_unused]] AudioFormat af) noexcept { } diff --git a/src/tag/Handler.hxx b/src/tag/Handler.hxx index d5d4396bc..30bab72be 100644 --- a/src/tag/Handler.hxx +++ b/src/tag/Handler.hxx @@ -124,7 +124,7 @@ public: explicit NullTagHandler(unsigned _want_mask) noexcept :TagHandler(_want_mask) {} - void OnDuration(gcc_unused SongTime duration) noexcept override {} + void OnDuration([[maybe_unused]] SongTime duration) noexcept override {} void OnTag(TagType type, StringView value) noexcept override; void OnPair(StringView key, StringView value) noexcept override; void OnAudioFormat(AudioFormat af) noexcept override; diff --git a/src/thread/Name.hxx b/src/thread/Name.hxx index 091cbb5ac..2313f291e 100644 --- a/src/thread/Name.hxx +++ b/src/thread/Name.hxx @@ -58,7 +58,7 @@ SetThreadName(const char *name) noexcept template static inline void -FormatThreadName(const char *fmt, gcc_unused Args&&... args) noexcept +FormatThreadName(const char *fmt, [[maybe_unused]] Args&&... args) noexcept { #ifdef HAVE_THREAD_NAME SetThreadName(StringFormat<16>(fmt, args...)); diff --git a/src/util/Compiler.h b/src/util/Compiler.h index cdfcc1db0..4b7b22269 100644 --- a/src/util/Compiler.h +++ b/src/util/Compiler.h @@ -74,7 +74,6 @@ #define gcc_printf(a,b) __attribute__((format(printf, a, b))) #define gcc_pure __attribute__((pure)) #define gcc_sentinel __attribute__((sentinel)) -#define gcc_unused __attribute__((unused)) #define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__))) #define gcc_nonnull_all __attribute__((nonnull)) @@ -101,7 +100,6 @@ #define gcc_printf(a,b) #define gcc_pure #define gcc_sentinel -#define gcc_unused #define gcc_nonnull(...) #define gcc_nonnull_all @@ -161,12 +159,6 @@ #define __has_feature(x) 0 #endif -#if __has_feature(attribute_unused_on_fields) -#define gcc_unused_field gcc_unused -#else -#define gcc_unused_field -#endif - #if defined(__GNUC__) || defined(__clang__) #define gcc_unreachable() __builtin_unreachable() #else diff --git a/src/util/UTF8.cxx b/src/util/UTF8.cxx index 9dbcb3260..608843a87 100644 --- a/src/util/UTF8.cxx +++ b/src/util/UTF8.cxx @@ -204,7 +204,7 @@ struct CheckSequenceUTF8 { template<> struct CheckSequenceUTF8<0U> { - constexpr bool operator()(gcc_unused const char *p) const noexcept { + constexpr bool operator()([[maybe_unused]] const char *p) const noexcept { return true; } }; diff --git a/src/win32/Win32Main.cxx b/src/win32/Win32Main.cxx index e812cc435..782554121 100644 --- a/src/win32/Win32Main.cxx +++ b/src/win32/Win32Main.cxx @@ -64,8 +64,8 @@ service_notify_status(DWORD status_code) } static DWORD WINAPI -service_dispatcher(gcc_unused DWORD control, gcc_unused DWORD event_type, - gcc_unused void *event_data, gcc_unused void *context) +service_dispatcher([[maybe_unused]] DWORD control, [[maybe_unused]] DWORD event_type, + [[maybe_unused]] void *event_data, [[maybe_unused]] void *context) { switch (control) { case SERVICE_CONTROL_SHUTDOWN: @@ -78,7 +78,7 @@ service_dispatcher(gcc_unused DWORD control, gcc_unused DWORD event_type, } static void WINAPI -service_main(gcc_unused DWORD argc, gcc_unused LPTSTR argv[]) +service_main([[maybe_unused]] DWORD argc, [[maybe_unused]] LPTSTR argv[]) { service_handle = RegisterServiceCtrlHandlerEx(service_name, diff --git a/src/zeroconf/ZeroconfAvahi.cxx b/src/zeroconf/ZeroconfAvahi.cxx index a5465f5fb..8f983bc93 100644 --- a/src/zeroconf/ZeroconfAvahi.cxx +++ b/src/zeroconf/ZeroconfAvahi.cxx @@ -49,7 +49,7 @@ AvahiRegisterService(AvahiClient *c); static void AvahiGroupCallback(AvahiEntryGroup *g, AvahiEntryGroupState state, - gcc_unused void *userdata) + [[maybe_unused]] void *userdata) { assert(g != nullptr); @@ -149,7 +149,7 @@ AvahiRegisterService(AvahiClient *c) /* Callback when avahi changes state */ static void MyAvahiClientCallback(AvahiClient *c, AvahiClientState state, - gcc_unused void *userdata) + [[maybe_unused]] void *userdata) { assert(c != nullptr); diff --git a/src/zeroconf/ZeroconfBonjour.cxx b/src/zeroconf/ZeroconfBonjour.cxx index 80b41b4ff..44fcb6d90 100644 --- a/src/zeroconf/ZeroconfBonjour.cxx +++ b/src/zeroconf/ZeroconfBonjour.cxx @@ -48,7 +48,7 @@ public: protected: /* virtual methods from class SocketMonitor */ - bool OnSocketReady(gcc_unused unsigned flags) noexcept override { + bool OnSocketReady([[maybe_unused]] unsigned flags) noexcept override { DNSServiceProcessResult(service_ref); return true; } @@ -57,12 +57,12 @@ protected: static BonjourMonitor *bonjour_monitor; static void -dnsRegisterCallback(gcc_unused DNSServiceRef sdRef, - gcc_unused DNSServiceFlags flags, +dnsRegisterCallback([[maybe_unused]] DNSServiceRef sdRef, + [[maybe_unused]] DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, - gcc_unused const char *regtype, - gcc_unused const char *domain, - gcc_unused void *context) + [[maybe_unused]] const char *regtype, + [[maybe_unused]] const char *domain, + [[maybe_unused]] void *context) { if (errorCode != kDNSServiceErr_NoError) { LogError(bonjour_domain, diff --git a/src/zeroconf/ZeroconfGlue.cxx b/src/zeroconf/ZeroconfGlue.cxx index 5fe6eff1d..bad174ec7 100644 --- a/src/zeroconf/ZeroconfGlue.cxx +++ b/src/zeroconf/ZeroconfGlue.cxx @@ -50,7 +50,7 @@ static constexpr Domain zeroconf_domain("zeroconf"); static int zeroconfEnabled; void -ZeroconfInit(const ConfigData &config, gcc_unused EventLoop &loop) +ZeroconfInit(const ConfigData &config, [[maybe_unused]] EventLoop &loop) { const char *serviceName; diff --git a/test/DumpDecoderClient.cxx b/test/DumpDecoderClient.cxx index 75a8c44e3..f107cc53a 100644 --- a/test/DumpDecoderClient.cxx +++ b/test/DumpDecoderClient.cxx @@ -86,26 +86,26 @@ DumpDecoderClient::Read(InputStream &is, void *buffer, size_t length) noexcept } void -DumpDecoderClient::SubmitTimestamp(gcc_unused FloatDuration t) noexcept +DumpDecoderClient::SubmitTimestamp([[maybe_unused]] FloatDuration t) noexcept { } DecoderCommand -DumpDecoderClient::SubmitData(gcc_unused InputStream *is, +DumpDecoderClient::SubmitData([[maybe_unused]] InputStream *is, const void *data, size_t datalen, - gcc_unused uint16_t kbit_rate) noexcept + [[maybe_unused]] uint16_t kbit_rate) noexcept { if (kbit_rate != prev_kbit_rate) { prev_kbit_rate = kbit_rate; fprintf(stderr, "%u kbit/s\n", kbit_rate); } - gcc_unused ssize_t nbytes = write(STDOUT_FILENO, data, datalen); + [[maybe_unused]] ssize_t nbytes = write(STDOUT_FILENO, data, datalen); return GetCommand(); } DecoderCommand -DumpDecoderClient::SubmitTag(gcc_unused InputStream *is, +DumpDecoderClient::SubmitTag([[maybe_unused]] InputStream *is, Tag &&tag) noexcept { fprintf(stderr, "TAG: duration=%f\n", tag.duration.ToDoubleS()); @@ -139,7 +139,7 @@ DumpDecoderClient::SubmitReplayGain(const ReplayGainInfo *rgi) noexcept } void -DumpDecoderClient::SubmitMixRamp(gcc_unused MixRampInfo &&mix_ramp) noexcept +DumpDecoderClient::SubmitMixRamp([[maybe_unused]] MixRampInfo &&mix_ramp) noexcept { fprintf(stderr, "MixRamp: start='%s' end='%s'\n", mix_ramp.GetStart(), mix_ramp.GetEnd()); diff --git a/test/MakeTag.hxx b/test/MakeTag.hxx index db8cd315f..283519058 100644 --- a/test/MakeTag.hxx +++ b/test/MakeTag.hxx @@ -22,7 +22,7 @@ #include "util/Compiler.h" inline void -BuildTag(gcc_unused TagBuilder &tag) noexcept +BuildTag([[maybe_unused]] TagBuilder &tag) noexcept { } diff --git a/test/ReadApeTags.cxx b/test/ReadApeTags.cxx index 65f56d36a..90f50a46b 100644 --- a/test/ReadApeTags.cxx +++ b/test/ReadApeTags.cxx @@ -34,7 +34,7 @@ #endif static bool -MyApeTagCallback(gcc_unused unsigned long flags, +MyApeTagCallback([[maybe_unused]] unsigned long flags, const char *key, StringView value) { if ((flags & (0x3 << 1)) == 0) diff --git a/test/read_mixer.cxx b/test/read_mixer.cxx index 2afbb4c26..3cf1b1796 100644 --- a/test/read_mixer.cxx +++ b/test/read_mixer.cxx @@ -30,13 +30,13 @@ #include const FilterPlugin * -filter_plugin_by_name(gcc_unused const char *name) noexcept +filter_plugin_by_name([[maybe_unused]] const char *name) noexcept { assert(false); return nullptr; } -int main(int argc, gcc_unused char **argv) +int main(int argc, [[maybe_unused]] char **argv) try { int volume; diff --git a/test/run_avahi.cxx b/test/run_avahi.cxx index 857913f6b..3624fc28a 100644 --- a/test/run_avahi.cxx +++ b/test/run_avahi.cxx @@ -26,7 +26,7 @@ unsigned listen_port = 1234; int -main(gcc_unused int argc, gcc_unused char **argv) +main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) { EventLoop event_loop; const ShutdownHandler shutdown_handler(event_loop); diff --git a/test/run_convert.cxx b/test/run_convert.cxx index 9162c97ce..deb704ce3 100644 --- a/test/run_convert.cxx +++ b/test/run_convert.cxx @@ -137,7 +137,7 @@ try { auto output = state.Convert({src.data, src.size}); - gcc_unused ssize_t ignored = write(1, output.data, + [[maybe_unused]] ssize_t ignored = write(1, output.data, output.size); } @@ -146,7 +146,7 @@ try { if (output.IsNull()) break; - gcc_unused ssize_t ignored = write(1, output.data, + [[maybe_unused]] ssize_t ignored = write(1, output.data, output.size); } diff --git a/test/run_filter.cxx b/test/run_filter.cxx index 7fd2ce327..77c76106a 100644 --- a/test/run_filter.cxx +++ b/test/run_filter.cxx @@ -42,8 +42,8 @@ #include void -mixer_set_volume(gcc_unused Mixer *mixer, - gcc_unused unsigned volume) +mixer_set_volume([[maybe_unused]] Mixer *mixer, + [[maybe_unused]] unsigned volume) { } diff --git a/test/run_gunzip.cxx b/test/run_gunzip.cxx index e8c51a7b3..fe719bfa4 100644 --- a/test/run_gunzip.cxx +++ b/test/run_gunzip.cxx @@ -55,7 +55,7 @@ CopyGunzip(FILE *_dest, Path src_path) } int -main(int argc, gcc_unused char **argv) +main(int argc, [[maybe_unused]] char **argv) try { if (argc != 2) { fprintf(stderr, "Usage: run_gunzip PATH\n"); diff --git a/test/run_gzip.cxx b/test/run_gzip.cxx index 0a7ac7d11..fccd14356 100644 --- a/test/run_gzip.cxx +++ b/test/run_gzip.cxx @@ -59,7 +59,7 @@ CopyGzip(FILE *_dest, int src) } int -main(int argc, gcc_unused char **argv) +main(int argc, [[maybe_unused]] char **argv) try { if (argc != 1) { fprintf(stderr, "Usage: run_gzip\n"); diff --git a/test/run_inotify.cxx b/test/run_inotify.cxx index b76b455f9..6edcbeeaf 100644 --- a/test/run_inotify.cxx +++ b/test/run_inotify.cxx @@ -34,8 +34,8 @@ static constexpr unsigned IN_MASK = |IN_MOVE|IN_MOVE_SELF; static void -my_inotify_callback(gcc_unused int wd, unsigned mask, - const char *name, gcc_unused void *ctx) +my_inotify_callback([[maybe_unused]] int wd, unsigned mask, + const char *name, [[maybe_unused]] void *ctx) { printf("mask=0x%x name='%s'\n", mask, name); } diff --git a/test/run_normalize.cxx b/test/run_normalize.cxx index e4acdc204..db626e955 100644 --- a/test/run_normalize.cxx +++ b/test/run_normalize.cxx @@ -57,7 +57,7 @@ try { Compressor_Process_int16(compressor, (int16_t *)buffer, nbytes / 2); - gcc_unused ssize_t ignored = write(1, buffer, nbytes); + [[maybe_unused]] ssize_t ignored = write(1, buffer, nbytes); } Compressor_delete(compressor); diff --git a/test/software_volume.cxx b/test/software_volume.cxx index e3d3ff56e..e628ba02f 100644 --- a/test/software_volume.cxx +++ b/test/software_volume.cxx @@ -58,7 +58,7 @@ try { while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) { auto dest = pv.Apply({buffer, size_t(nbytes)}); - gcc_unused ssize_t ignored = write(1, dest.data, dest.size); + [[maybe_unused]] ssize_t ignored = write(1, dest.data, dest.size); } pv.Close(); diff --git a/test/test_translate_song.cxx b/test/test_translate_song.cxx index c1f0feaa5..6619066d6 100644 --- a/test/test_translate_song.cxx +++ b/test/test_translate_song.cxx @@ -85,8 +85,8 @@ static const char *uri1 = "/foo/bar.ogg"; static const char *uri2 = "foo/bar.ogg"; DetachedSong -DatabaseDetachSong(gcc_unused const Database &db, - gcc_unused const Storage *_storage, +DatabaseDetachSong([[maybe_unused]] const Database &db, + [[maybe_unused]] const Storage *_storage, const char *uri) { if (strcmp(uri, uri2) == 0) @@ -119,7 +119,7 @@ Client::GetStorage() const noexcept } void -Client::AllowFile(gcc_unused Path path_fs) const +Client::AllowFile([[maybe_unused]] Path path_fs) const { /* always fail, so a SongLoader with a non-nullptr Client pointer will be regarded "insecure", while one with diff --git a/test/test_vorbis_encoder.cxx b/test/test_vorbis_encoder.cxx index cf768f1f6..b9c1daddd 100644 --- a/test/test_vorbis_encoder.cxx +++ b/test/test_vorbis_encoder.cxx @@ -36,7 +36,7 @@ static uint8_t zero[256]; int -main(gcc_unused int argc, gcc_unused char **argv) +main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) try { /* create the encoder */