*: use gcc.h macros instead of GLib

This commit is contained in:
Max Kellermann 2013-08-04 23:48:01 +02:00
parent 5bf2ec5a74
commit 85b77b81ca
98 changed files with 369 additions and 349 deletions

View File

@ -1158,7 +1158,7 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator # undefined via #undef or recursively expanded use the := operator
# instead of the = operator. # instead of the = operator.
PREDEFINED = G_GNUC_UNUSED= PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded. # this tag can be used to specify a list of macro names that should be expanded.

View File

@ -60,12 +60,10 @@ struct command {
/* don't be fooled, this is the command handler for "commands" command */ /* don't be fooled, this is the command handler for "commands" command */
static enum command_return static enum command_return
handle_commands(Client *client, handle_commands(Client *client, int argc, char *argv[]);
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]);
static enum command_return static enum command_return
handle_not_commands(Client *client, handle_not_commands(Client *client, int argc, char *argv[]);
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]);
/** /**
* The command registry. * The command registry.
@ -168,7 +166,7 @@ static const struct command commands[] = {
static const unsigned num_commands = sizeof(commands) / sizeof(commands[0]); static const unsigned num_commands = sizeof(commands) / sizeof(commands[0]);
static bool static bool
command_available(G_GNUC_UNUSED const struct command *cmd) command_available(gcc_unused const struct command *cmd)
{ {
#ifdef ENABLE_SQLITE #ifdef ENABLE_SQLITE
if (strcmp(cmd->cmd, "sticker") == 0) if (strcmp(cmd->cmd, "sticker") == 0)
@ -181,7 +179,7 @@ command_available(G_GNUC_UNUSED const struct command *cmd)
/* don't be fooled, this is the command handler for "commands" command */ /* don't be fooled, this is the command handler for "commands" command */
static enum command_return static enum command_return
handle_commands(Client *client, handle_commands(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
const unsigned permission = client_get_permission(client); const unsigned permission = client_get_permission(client);
const struct command *cmd; const struct command *cmd;
@ -199,7 +197,7 @@ handle_commands(Client *client,
static enum command_return static enum command_return
handle_not_commands(Client *client, handle_not_commands(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
const unsigned permission = client_get_permission(client); const unsigned permission = client_get_permission(client);
const struct command *cmd; const struct command *cmd;
@ -318,7 +316,6 @@ enum command_return
command_process(Client *client, unsigned num, char *line) command_process(Client *client, unsigned num, char *line)
{ {
GError *error = NULL; GError *error = NULL;
int argc;
char *argv[COMMAND_ARGV_MAX] = { NULL }; char *argv[COMMAND_ARGV_MAX] = { NULL };
const struct command *cmd; const struct command *cmd;
enum command_return ret = COMMAND_RETURN_ERROR; enum command_return ret = COMMAND_RETURN_ERROR;
@ -344,11 +341,11 @@ command_process(Client *client, unsigned num, char *line)
return COMMAND_RETURN_ERROR; return COMMAND_RETURN_ERROR;
} }
argc = 1; unsigned argc = 1;
/* now parse the arguments (quoted or unquoted) */ /* now parse the arguments (quoted or unquoted) */
while (argc < (int)G_N_ELEMENTS(argv) && while (argc < COMMAND_ARGV_MAX &&
(argv[argc] = (argv[argc] =
tokenizer.NextParam(&error)) != NULL) tokenizer.NextParam(&error)) != NULL)
++argc; ++argc;
@ -358,7 +355,7 @@ command_process(Client *client, unsigned num, char *line)
current_command = argv[0]; current_command = argv[0];
if (argc >= (int)G_N_ELEMENTS(argv)) { if (argc >= COMMAND_ARGV_MAX) {
command_error(client, ACK_ERROR_ARG, "Too many arguments"); command_error(client, ACK_ERROR_ARG, "Too many arguments");
current_command = NULL; current_command = NULL;
return COMMAND_RETURN_ERROR; return COMMAND_RETURN_ERROR;

View File

@ -18,10 +18,11 @@
*/ */
#include "ClientMessage.hxx" #include "ClientMessage.hxx"
#include "gcc.h"
#include <glib.h> #include <glib.h>
G_GNUC_PURE gcc_const
static bool static bool
valid_channel_char(const char ch) valid_channel_char(const char ch)
{ {

View File

@ -75,7 +75,6 @@ client_vprintf(Client *client, const char *fmt, va_list args)
#endif #endif
} }
G_GNUC_PRINTF(2, 3)
void void
client_printf(Client *client, const char *fmt, ...) client_printf(Client *client, const char *fmt, ...)
{ {

View File

@ -49,7 +49,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef G_OS_WIN32 #ifdef WIN32
#define CONFIG_FILE_LOCATION "\\mpd\\mpd.conf" #define CONFIG_FILE_LOCATION "\\mpd\\mpd.conf"
#else /* G_OS_WIN32 */ #else /* G_OS_WIN32 */
#define USER_CONFIG_FILE_LOCATION1 ".mpdconf" #define USER_CONFIG_FILE_LOCATION1 ".mpdconf"
@ -62,7 +62,7 @@ cmdline_quark(void)
return g_quark_from_static_string("cmdline"); return g_quark_from_static_string("cmdline");
} }
G_GNUC_NORETURN gcc_noreturn
static void version(void) static void version(void)
{ {
puts(PACKAGE " (MPD: Music Player Daemon) " VERSION " \n" puts(PACKAGE " (MPD: Music Player Daemon) " VERSION " \n"
@ -203,7 +203,7 @@ parse_cmdline(int argc, char **argv, struct options *options,
} else if (argc <= 1) { } else if (argc <= 1) {
/* default configuration file path */ /* default configuration file path */
#ifdef G_OS_WIN32 #ifdef WIN32
Path path = PathBuildChecked(Path::FromUTF8(g_get_user_config_dir()), Path path = PathBuildChecked(Path::FromUTF8(g_get_user_config_dir()),
CONFIG_FILE_LOCATION); CONFIG_FILE_LOCATION);
if (!path.IsNull() && FileExists(path)) if (!path.IsNull() && FileExists(path))

View File

@ -45,7 +45,7 @@
#include <windows.h> #include <windows.h>
#endif #endif
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
parse_path_quark(void) parse_path_quark(void)
{ {
@ -53,7 +53,7 @@ parse_path_quark(void)
} }
char * char *
parsePath(const char *path, G_GNUC_UNUSED GError **error_r) parsePath(const char *path, gcc_unused GError **error_r)
{ {
assert(path != nullptr); assert(path != nullptr);
assert(error_r == nullptr || *error_r == nullptr); assert(error_r == nullptr || *error_r == nullptr);

View File

@ -20,13 +20,15 @@
#ifndef MPD_CONFIG_QUARK_HXX #ifndef MPD_CONFIG_QUARK_HXX
#define MPD_CONFIG_QUARK_HXX #define MPD_CONFIG_QUARK_HXX
#include "gcc.h"
#include <glib.h> #include <glib.h>
/** /**
* A GQuark for GError instances, resulting from malformed * A GQuark for GError instances, resulting from malformed
* configuration. * configuration.
*/ */
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
config_quark(void) config_quark(void)
{ {

View File

@ -35,7 +35,7 @@
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
static char * static char *
strtok_r(char *str, const char *delim, G_GNUC_UNUSED char **saveptr) strtok_r(char *str, const char *delim, gcc_unused char **saveptr)
{ {
return strtok(str, delim); return strtok(str, delim);
} }

View File

@ -143,7 +143,7 @@ handle_count(Client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_listall(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_listall(Client *client, gcc_unused int argc, char *argv[])
{ {
const char *directory = ""; const char *directory = "";
@ -206,7 +206,7 @@ handle_list(Client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_listallinfo(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_listallinfo(Client *client, gcc_unused int argc, char *argv[])
{ {
const char *directory = ""; const char *directory = "";

View File

@ -28,6 +28,7 @@
#include "check.h" #include "check.h"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "gcc.h"
#include <glib.h> #include <glib.h>
#include <assert.h> #include <assert.h>
@ -41,7 +42,7 @@ extern GThread *db_mutex_holder;
/** /**
* Does the current thread hold the database lock? * Does the current thread hold the database lock?
*/ */
G_GNUC_PURE gcc_pure
static inline bool static inline bool
holding_db_lock(void) holding_db_lock(void)
{ {

View File

@ -47,7 +47,7 @@ enum {
DB_FORMAT = 1, DB_FORMAT = 1,
}; };
G_GNUC_CONST gcc_const
static GQuark static GQuark
db_quark(void) db_quark(void)
{ {

View File

@ -80,7 +80,7 @@ decoder_initialized(struct decoder *decoder,
* Checks if we need an "initial seek". If so, then the initial seek * Checks if we need an "initial seek". If so, then the initial seek
* is prepared, and the function returns true. * is prepared, and the function returns true.
*/ */
G_GNUC_PURE gcc_pure
static bool static bool
decoder_prepare_initial_seek(struct decoder *decoder) decoder_prepare_initial_seek(struct decoder *decoder)
{ {
@ -127,7 +127,7 @@ decoder_prepare_initial_seek(struct decoder *decoder)
* synthesized command, e.g. to seek to the beginning of the CUE * synthesized command, e.g. to seek to the beginning of the CUE
* track. * track.
*/ */
G_GNUC_PURE gcc_pure
static enum decoder_command static enum decoder_command
decoder_get_virtual_command(struct decoder *decoder) decoder_get_virtual_command(struct decoder *decoder)
{ {
@ -191,7 +191,7 @@ decoder_command_finished(struct decoder *decoder)
dc->Unlock(); dc->Unlock();
} }
double decoder_seek_where(G_GNUC_UNUSED struct decoder * decoder) double decoder_seek_where(gcc_unused struct decoder * decoder)
{ {
const struct decoder_control *dc = decoder->dc; const struct decoder_control *dc = decoder->dc;
@ -232,7 +232,7 @@ void decoder_seek_error(struct decoder * decoder)
* Should be read operation be cancelled? That is the case when the * Should be read operation be cancelled? That is the case when the
* player thread has sent a command such as "STOP". * player thread has sent a command such as "STOP".
*/ */
G_GNUC_PURE gcc_pure
static inline bool static inline bool
decoder_check_cancel_read(const struct decoder *decoder) decoder_check_cancel_read(const struct decoder *decoder)
{ {
@ -287,7 +287,7 @@ size_t decoder_read(struct decoder *decoder,
assert(nbytes == 0 || error == NULL); assert(nbytes == 0 || error == NULL);
assert(nbytes > 0 || error != NULL || input_stream_eof(is)); assert(nbytes > 0 || error != NULL || input_stream_eof(is));
if (G_UNLIKELY(nbytes == 0 && error != NULL)) { if (gcc_unlikely(nbytes == 0 && error != nullptr)) {
g_warning("%s", error->message); g_warning("%s", error->message);
g_error_free(error); g_error_free(error);
} }
@ -468,10 +468,10 @@ decoder_data(struct decoder *decoder,
} }
enum decoder_command enum decoder_command
decoder_tag(G_GNUC_UNUSED struct decoder *decoder, struct input_stream *is, decoder_tag(gcc_unused struct decoder *decoder, struct input_stream *is,
Tag &&tag) Tag &&tag)
{ {
G_GNUC_UNUSED const struct decoder_control *dc = decoder->dc; gcc_unused const struct decoder_control *dc = decoder->dc;
enum decoder_command cmd; enum decoder_command cmd;
assert(dc->state == DECODE_STATE_DECODE); assert(dc->state == DECODE_STATE_DECODE);

View File

@ -20,12 +20,14 @@
#ifndef MPD_DECODER_ERROR_HXX #ifndef MPD_DECODER_ERROR_HXX
#define MPD_DECODER_ERROR_HXX #define MPD_DECODER_ERROR_HXX
#include "gcc.h"
#include <glib.h> #include <glib.h>
/** /**
* Quark for GError.domain. * Quark for GError.domain.
*/ */
G_GNUC_CONST gcc_pure
static inline GQuark static inline GQuark
decoder_quark(void) decoder_quark(void)
{ {

View File

@ -32,8 +32,9 @@ static void (*registered_callbacks[8])(struct despotify_session *,
int, void *, void *); int, void *, void *);
static void *registered_callback_data[8]; static void *registered_callback_data[8];
static void callback(struct despotify_session* ds, int sig, static void
void* data, G_GNUC_UNUSED void* callback_data) callback(struct despotify_session* ds, int sig,
void *data, gcc_unused void *callback_data)
{ {
size_t i; size_t i;

View File

@ -275,7 +275,7 @@ Directory::LookupSong(const char *uri)
} }
static int static int
directory_cmp(G_GNUC_UNUSED void *priv, directory_cmp(gcc_unused void *priv,
struct list_head *_a, struct list_head *_b) struct list_head *_a, struct list_head *_b)
{ {
const Directory *a = (const Directory *)_a; const Directory *a = (const Directory *)_a;

View File

@ -19,6 +19,7 @@
#include "config.h" #include "config.h"
#include "GlobalEvents.hxx" #include "GlobalEvents.hxx"
#include "gcc.h"
#include <atomic> #include <atomic>
@ -47,7 +48,7 @@ InvokeGlobalEvent(GlobalEvents::Event event)
} }
static gboolean static gboolean
GlobalEventCallback(G_GNUC_UNUSED gpointer data) GlobalEventCallback(gcc_unused gpointer data)
{ {
const unsigned flags = GlobalEvents::flags.exchange(0); const unsigned flags = GlobalEvents::flags.exchange(0);

View File

@ -43,7 +43,7 @@ io_thread_run(void)
} }
static gpointer static gpointer
io_thread_func(G_GNUC_UNUSED gpointer arg) io_thread_func(gcc_unused gpointer arg)
{ {
/* lock+unlock to synchronize with io_thread_start(), to be /* lock+unlock to synchronize with io_thread_start(), to be
sure that io.thread is set */ sure that io.thread is set */

View File

@ -233,7 +233,7 @@ recursive_watch_subdirectories(WatchDirectory *directory,
closedir(dir); closedir(dir);
} }
G_GNUC_PURE gcc_pure
static unsigned static unsigned
watch_directory_depth(const WatchDirectory *d) watch_directory_depth(const WatchDirectory *d)
{ {
@ -248,7 +248,7 @@ watch_directory_depth(const WatchDirectory *d)
static void static void
mpd_inotify_callback(int wd, unsigned mask, mpd_inotify_callback(int wd, unsigned mask,
G_GNUC_UNUSED const char *name, G_GNUC_UNUSED void *ctx) gcc_unused const char *name, gcc_unused void *ctx)
{ {
WatchDirectory *directory; WatchDirectory *directory;
char *uri_fs; char *uri_fs;

View File

@ -33,7 +33,7 @@ mpd_inotify_finish(void);
#else /* !HAVE_INOTIFY_INIT */ #else /* !HAVE_INOTIFY_INIT */
static inline void static inline void
mpd_inotify_init(G_GNUC_UNUSED unsigned max_depth) mpd_inotify_init(gcc_unused unsigned max_depth)
{ {
} }

View File

@ -91,7 +91,7 @@ chomp_length(const char *p)
static void static void
file_log_func(const gchar *log_domain, file_log_func(const gchar *log_domain,
GLogLevelFlags log_level, GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
char *converted; char *converted;
@ -179,7 +179,7 @@ glib_to_syslog_level(GLogLevelFlags log_level)
static void static void
syslog_log_func(const gchar *log_domain, syslog_log_func(const gchar *log_domain,
GLogLevelFlags log_level, const gchar *message, GLogLevelFlags log_level, const gchar *message,
G_GNUC_UNUSED gpointer user_data) gcc_unused gpointer user_data)
{ {
if (stdout_mode) { if (stdout_mode) {
/* fall back to the file log function during /* fall back to the file log function during

View File

@ -20,9 +20,11 @@
#ifndef MPD_LOG_HXX #ifndef MPD_LOG_HXX
#define MPD_LOG_HXX #define MPD_LOG_HXX
#include "gcc.h"
#include <glib.h> #include <glib.h>
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
log_quark(void) log_quark(void)
{ {

View File

@ -33,7 +33,7 @@
#include <assert.h> #include <assert.h>
enum command_return enum command_return
handle_subscribe(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_subscribe(Client *client, gcc_unused int argc, char *argv[])
{ {
assert(argc == 2); assert(argc == 2);
@ -62,7 +62,7 @@ handle_subscribe(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_unsubscribe(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_unsubscribe(Client *client, gcc_unused int argc, char *argv[])
{ {
assert(argc == 2); assert(argc == 2);
@ -77,7 +77,7 @@ handle_unsubscribe(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum command_return enum command_return
handle_channels(Client *client, handle_channels(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
assert(argc == 1); assert(argc == 1);
@ -94,7 +94,7 @@ handle_channels(Client *client,
enum command_return enum command_return
handle_read_messages(Client *client, handle_read_messages(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
assert(argc == 1); assert(argc == 1);
@ -111,7 +111,7 @@ handle_read_messages(Client *client,
enum command_return enum command_return
handle_send_message(Client *client, handle_send_message(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
assert(argc == 3); assert(argc == 3);

View File

@ -66,7 +66,7 @@ print_spl_list(Client *client, const PlaylistVector &list)
enum command_return enum command_return
handle_urlhandlers(Client *client, handle_urlhandlers(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
if (client_is_local(client)) if (client_is_local(client))
client_puts(client, "handler: file://\n"); client_puts(client, "handler: file://\n");
@ -76,7 +76,7 @@ handle_urlhandlers(Client *client,
enum command_return enum command_return
handle_decoders(Client *client, handle_decoders(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
decoder_list_print(client); decoder_list_print(client);
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
@ -84,22 +84,22 @@ handle_decoders(Client *client,
enum command_return enum command_return
handle_tagtypes(Client *client, handle_tagtypes(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
tag_print_types(client); tag_print_types(client);
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} }
enum command_return enum command_return
handle_kill(G_GNUC_UNUSED Client *client, handle_kill(gcc_unused Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
return COMMAND_RETURN_KILL; return COMMAND_RETURN_KILL;
} }
enum command_return enum command_return
handle_close(G_GNUC_UNUSED Client *client, handle_close(gcc_unused Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
return COMMAND_RETURN_CLOSE; return COMMAND_RETURN_CLOSE;
} }
@ -155,7 +155,7 @@ handle_lsinfo(Client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_update(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_update(Client *client, gcc_unused int argc, char *argv[])
{ {
const char *path = NULL; const char *path = NULL;
unsigned ret; unsigned ret;
@ -186,7 +186,7 @@ handle_update(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_rescan(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_rescan(Client *client, gcc_unused int argc, char *argv[])
{ {
const char *path = NULL; const char *path = NULL;
unsigned ret; unsigned ret;
@ -214,7 +214,7 @@ handle_rescan(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_setvol(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_setvol(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned level; unsigned level;
bool success; bool success;
@ -239,21 +239,21 @@ handle_setvol(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum command_return enum command_return
handle_stats(Client *client, handle_stats(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
stats_print(client); stats_print(client);
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} }
enum command_return enum command_return
handle_ping(G_GNUC_UNUSED Client *client, handle_ping(gcc_unused Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} }
enum command_return enum command_return
handle_password(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_password(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned permission = 0; unsigned permission = 0;
@ -269,7 +269,7 @@ handle_password(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum command_return enum command_return
handle_config(Client *client, handle_config(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
if (!client_is_local(client)) { if (!client_is_local(client)) {
command_error(client, ACK_ERROR_PERMISSION, command_error(client, ACK_ERROR_PERMISSION,
@ -286,7 +286,7 @@ handle_config(Client *client,
enum command_return enum command_return
handle_idle(Client *client, handle_idle(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
unsigned flags = 0, j; unsigned flags = 0, j;
int i; int i;

View File

@ -397,7 +397,7 @@ chunk_is_consumed(const struct music_chunk *chunk)
* outputs have consumed it already. Clear the reference. * outputs have consumed it already. Clear the reference.
*/ */
static void static void
clear_tail_chunk(G_GNUC_UNUSED const struct music_chunk *chunk, bool *locked) clear_tail_chunk(gcc_unused const struct music_chunk *chunk, bool *locked)
{ {
assert(chunk->next == NULL); assert(chunk->next == NULL);
assert(music_pipe_contains(g_mp, chunk)); assert(music_pipe_contains(g_mp, chunk));

View File

@ -27,7 +27,7 @@
#include <string.h> #include <string.h>
enum command_return enum command_return
handle_enableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_enableoutput(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned device; unsigned device;
bool ret; bool ret;
@ -46,7 +46,7 @@ handle_enableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_disableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_disableoutput(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned device; unsigned device;
bool ret; bool ret;
@ -82,7 +82,7 @@ handle_toggleoutput(Client *client, gcc_unused int argc, char *argv[])
enum command_return enum command_return
handle_devices(Client *client, handle_devices(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
printAudioDevices(client); printAudioDevices(client);

View File

@ -20,12 +20,14 @@
#ifndef MPD_OUTPUT_ERROR_HXX #ifndef MPD_OUTPUT_ERROR_HXX
#define MPD_OUTPUT_ERROR_HXX #define MPD_OUTPUT_ERROR_HXX
#include "gcc.h"
#include <glib.h> #include <glib.h>
/** /**
* Quark for GError.domain. * Quark for GError.domain.
*/ */
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
output_quark(void) output_quark(void)
{ {

View File

@ -83,7 +83,7 @@ handle_playid(Client *client, int argc, char *argv[])
enum command_return enum command_return
handle_stop(Client *client, handle_stop(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
client->partition.Stop(); client->partition.Stop();
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
@ -91,7 +91,7 @@ handle_stop(Client *client,
enum command_return enum command_return
handle_currentsong(Client *client, handle_currentsong(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
playlist_print_current(client, &client->playlist); playlist_print_current(client, &client->playlist);
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
@ -115,7 +115,7 @@ handle_pause(Client *client,
enum command_return enum command_return
handle_status(Client *client, handle_status(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
const char *state = NULL; const char *state = NULL;
int updateJobId; int updateJobId;
@ -215,7 +215,7 @@ handle_status(Client *client,
enum command_return enum command_return
handle_next(Client *client, handle_next(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
playlist &playlist = client->playlist; playlist &playlist = client->playlist;
@ -232,14 +232,14 @@ handle_next(Client *client,
enum command_return enum command_return
handle_previous(Client *client, handle_previous(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
client->partition.PlayPrevious(); client->partition.PlayPrevious();
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} }
enum command_return enum command_return
handle_repeat(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_repeat(Client *client, gcc_unused int argc, char *argv[])
{ {
bool status; bool status;
if (!check_bool(client, &status, argv[1])) if (!check_bool(client, &status, argv[1]))
@ -250,7 +250,7 @@ handle_repeat(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_single(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_single(Client *client, gcc_unused int argc, char *argv[])
{ {
bool status; bool status;
if (!check_bool(client, &status, argv[1])) if (!check_bool(client, &status, argv[1]))
@ -261,7 +261,7 @@ handle_single(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_consume(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_consume(Client *client, gcc_unused int argc, char *argv[])
{ {
bool status; bool status;
if (!check_bool(client, &status, argv[1])) if (!check_bool(client, &status, argv[1]))
@ -272,7 +272,7 @@ handle_consume(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_random(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_random(Client *client, gcc_unused int argc, char *argv[])
{ {
bool status; bool status;
if (!check_bool(client, &status, argv[1])) if (!check_bool(client, &status, argv[1]))
@ -284,15 +284,15 @@ handle_random(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_clearerror(G_GNUC_UNUSED Client *client, handle_clearerror(gcc_unused Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
client->player_control->ClearError(); client->player_control->ClearError();
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} }
enum command_return enum command_return
handle_seek(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_seek(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned song, seek_time; unsigned song, seek_time;
@ -307,7 +307,7 @@ handle_seek(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_seekid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_seekid(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned id, seek_time; unsigned id, seek_time;
@ -322,7 +322,7 @@ handle_seekid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_seekcur(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_seekcur(Client *client, gcc_unused int argc, char *argv[])
{ {
const char *p = argv[1]; const char *p = argv[1];
bool relative = *p == '+' || *p == '-'; bool relative = *p == '+' || *p == '-';
@ -336,7 +336,7 @@ handle_seekcur(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_crossfade(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_crossfade(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned xfade_time; unsigned xfade_time;
@ -348,7 +348,7 @@ handle_crossfade(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_mixrampdb(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_mixrampdb(Client *client, gcc_unused int argc, char *argv[])
{ {
float db; float db;
@ -360,7 +360,7 @@ handle_mixrampdb(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_mixrampdelay(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_mixrampdelay(Client *client, gcc_unused int argc, char *argv[])
{ {
float delay_secs; float delay_secs;
@ -373,7 +373,7 @@ handle_mixrampdelay(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum command_return enum command_return
handle_replay_gain_mode(Client *client, handle_replay_gain_mode(Client *client,
G_GNUC_UNUSED int argc, char *argv[]) gcc_unused int argc, char *argv[])
{ {
if (!replay_gain_set_mode_string(argv[1])) { if (!replay_gain_set_mode_string(argv[1])) {
command_error(client, ACK_ERROR_ARG, command_error(client, ACK_ERROR_ARG,
@ -388,7 +388,7 @@ handle_replay_gain_mode(Client *client,
enum command_return enum command_return
handle_replay_gain_status(Client *client, handle_replay_gain_status(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
client_printf(client, "replay_gain_mode: %s\n", client_printf(client, "replay_gain_mode: %s\n",
replay_gain_get_mode_string()); replay_gain_get_mode_string());

View File

@ -562,7 +562,7 @@ static bool player_seek_decoder(struct player *player)
static void player_process_command(struct player *player) static void player_process_command(struct player *player)
{ {
struct player_control *pc = player->pc; struct player_control *pc = player->pc;
G_GNUC_UNUSED struct decoder_control *dc = player->dc; gcc_unused struct decoder_control *dc = player->dc;
switch (pc->command) { switch (pc->command) {
case PLAYER_COMMAND_NONE: case PLAYER_COMMAND_NONE:

View File

@ -49,7 +49,7 @@ print_spl_list(Client *client, const PlaylistVector &list)
} }
enum command_return enum command_return
handle_save(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_save(Client *client, gcc_unused int argc, char *argv[])
{ {
enum playlist_result result; enum playlist_result result;
@ -95,7 +95,7 @@ handle_load(Client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_listplaylist(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_listplaylist(Client *client, gcc_unused int argc, char *argv[])
{ {
if (playlist_file_print(client, argv[1], false)) if (playlist_file_print(client, argv[1], false))
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
@ -108,7 +108,7 @@ handle_listplaylist(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum command_return enum command_return
handle_listplaylistinfo(Client *client, handle_listplaylistinfo(Client *client,
G_GNUC_UNUSED int argc, char *argv[]) gcc_unused int argc, char *argv[])
{ {
if (playlist_file_print(client, argv[1], true)) if (playlist_file_print(client, argv[1], true))
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
@ -120,7 +120,7 @@ handle_listplaylistinfo(Client *client,
} }
enum command_return enum command_return
handle_rm(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_rm(Client *client, gcc_unused int argc, char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
return spl_delete(argv[1], &error) return spl_delete(argv[1], &error)
@ -129,7 +129,7 @@ handle_rm(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_rename(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_rename(Client *client, gcc_unused int argc, char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
return spl_rename(argv[1], argv[2], &error) return spl_rename(argv[1], argv[2], &error)
@ -139,7 +139,7 @@ handle_rename(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum command_return enum command_return
handle_playlistdelete(Client *client, handle_playlistdelete(Client *client,
G_GNUC_UNUSED int argc, char *argv[]) { gcc_unused int argc, char *argv[]) {
char *playlist = argv[1]; char *playlist = argv[1];
unsigned from; unsigned from;
@ -153,7 +153,7 @@ handle_playlistdelete(Client *client,
} }
enum command_return enum command_return
handle_playlistmove(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_playlistmove(Client *client, gcc_unused int argc, char *argv[])
{ {
char *playlist = argv[1]; char *playlist = argv[1];
unsigned from, to; unsigned from, to;
@ -170,7 +170,7 @@ handle_playlistmove(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_playlistclear(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_playlistclear(Client *client, gcc_unused int argc, char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
return spl_clear(argv[1], &error) return spl_clear(argv[1], &error)
@ -179,7 +179,7 @@ handle_playlistclear(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_playlistadd(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_playlistadd(Client *client, gcc_unused int argc, char *argv[])
{ {
char *playlist = argv[1]; char *playlist = argv[1];
char *uri = argv[2]; char *uri = argv[2];
@ -209,7 +209,7 @@ handle_playlistadd(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum command_return enum command_return
handle_listplaylists(Client *client, handle_listplaylists(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
const auto list = ListPlaylistFiles(&error); const auto list = ListPlaylistFiles(&error);

View File

@ -37,7 +37,7 @@
#include <string.h> #include <string.h>
enum command_return enum command_return
handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_add(Client *client, gcc_unused int argc, char *argv[])
{ {
char *uri = argv[1]; char *uri = argv[1];
enum playlist_result result; enum playlist_result result;
@ -131,7 +131,7 @@ handle_addid(Client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_delete(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_delete(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned start, end; unsigned start, end;
@ -143,7 +143,7 @@ handle_delete(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_deleteid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_deleteid(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned id; unsigned id;
@ -156,15 +156,15 @@ handle_deleteid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum command_return enum command_return
handle_playlist(Client *client, handle_playlist(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
playlist_print_uris(client, &client->playlist); playlist_print_uris(client, &client->playlist);
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} }
enum command_return enum command_return
handle_shuffle(G_GNUC_UNUSED Client *client, handle_shuffle(gcc_unused Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
unsigned start = 0, end = client->playlist.queue.GetLength(); unsigned start = 0, end = client->playlist.queue.GetLength();
if (argc == 2 && !check_range(client, &start, &end, argv[1])) if (argc == 2 && !check_range(client, &start, &end, argv[1]))
@ -175,15 +175,15 @@ handle_shuffle(G_GNUC_UNUSED Client *client,
} }
enum command_return enum command_return
handle_clear(G_GNUC_UNUSED Client *client, handle_clear(gcc_unused Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) gcc_unused int argc, gcc_unused char *argv[])
{ {
client->partition.ClearQueue(); client->partition.ClearQueue();
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} }
enum command_return enum command_return
handle_plchanges(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_plchanges(Client *client, gcc_unused int argc, char *argv[])
{ {
uint32_t version; uint32_t version;
@ -195,7 +195,7 @@ handle_plchanges(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_plchangesposid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_plchangesposid(Client *client, gcc_unused int argc, char *argv[])
{ {
uint32_t version; uint32_t version;
@ -328,7 +328,7 @@ handle_prioid(Client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_move(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_move(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned start, end; unsigned start, end;
int to; int to;
@ -344,7 +344,7 @@ handle_move(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_moveid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_moveid(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned id; unsigned id;
int to; int to;
@ -358,7 +358,7 @@ handle_moveid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_swap(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_swap(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned song1, song2; unsigned song1, song2;
@ -373,7 +373,7 @@ handle_swap(Client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_swapid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_swapid(Client *client, gcc_unused int argc, char *argv[])
{ {
unsigned id1, id2; unsigned id1, id2;

View File

@ -34,12 +34,12 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
static void exit_signal_handler(G_GNUC_UNUSED int signum) static void exit_signal_handler(gcc_unused int signum)
{ {
GlobalEvents::Emit(GlobalEvents::SHUTDOWN); GlobalEvents::Emit(GlobalEvents::SHUTDOWN);
} }
static void reload_signal_handler(G_GNUC_UNUSED int signum) static void reload_signal_handler(gcc_unused int signum)
{ {
GlobalEvents::Emit(GlobalEvents::RELOAD); GlobalEvents::Emit(GlobalEvents::RELOAD);
} }

View File

@ -92,7 +92,7 @@ compare_tag_item(const Tag *a, const Tag *b, enum tag_type type)
/* Only used for sorting/searchin a songvec, not general purpose compares */ /* Only used for sorting/searchin a songvec, not general purpose compares */
static int static int
song_cmp(G_GNUC_UNUSED void *priv, struct list_head *_a, struct list_head *_b) song_cmp(gcc_unused void *priv, struct list_head *_a, struct list_head *_b)
{ {
const Song *a = (const Song *)_a; const Song *a = (const Song *)_a;
const Song *b = (const Song *)_b; const Song *b = (const Song *)_b;

View File

@ -46,7 +46,7 @@ const struct tag_handler add_tag_handler = {
}; };
static void static void
full_tag_pair(const char *name, G_GNUC_UNUSED const char *value, void *ctx) full_tag_pair(const char *name, gcc_unused const char *value, void *ctx)
{ {
Tag *tag = (Tag *)ctx; Tag *tag = (Tag *)ctx;

View File

@ -261,7 +261,7 @@ update_directory_child(Directory *directory,
} }
/* we don't look at "." / ".." nor files with newlines in their name */ /* we don't look at "." / ".." nor files with newlines in their name */
G_GNUC_PURE gcc_pure
static bool skip_path(const Path &path_fs) static bool skip_path(const Path &path_fs)
{ {
const char *path = path_fs.c_str(); const char *path = path_fs.c_str();
@ -270,7 +270,7 @@ static bool skip_path(const Path &path_fs)
strchr(path, '\n') != NULL; strchr(path, '\n') != NULL;
} }
G_GNUC_PURE gcc_pure
static bool static bool
skip_symlink(const Directory *directory, const char *utf8_name) skip_symlink(const Directory *directory, const char *utf8_name)
{ {

View File

@ -22,6 +22,7 @@
#ifdef WIN32 #ifdef WIN32
#include "gcc.h"
#include "mpd_error.h" #include "mpd_error.h"
#include "GlobalEvents.hxx" #include "GlobalEvents.hxx"
@ -65,8 +66,8 @@ service_notify_status(DWORD status_code)
} }
static DWORD WINAPI static DWORD WINAPI
service_dispatcher(G_GNUC_UNUSED DWORD control, G_GNUC_UNUSED DWORD event_type, service_dispatcher(gcc_unused DWORD control, gcc_unused DWORD event_type,
G_GNUC_UNUSED void *event_data, G_GNUC_UNUSED void *context) gcc_unused void *event_data, gcc_unused void *context)
{ {
switch (control) { switch (control) {
case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_SHUTDOWN:
@ -79,7 +80,7 @@ service_dispatcher(G_GNUC_UNUSED DWORD control, G_GNUC_UNUSED DWORD event_type,
} }
static void WINAPI static void WINAPI
service_main(G_GNUC_UNUSED DWORD argc, G_GNUC_UNUSED CHAR *argv[]) service_main(gcc_unused DWORD argc, gcc_unused CHAR *argv[])
{ {
DWORD error_code; DWORD error_code;
gchar* error_message; gchar* error_message;

View File

@ -51,7 +51,7 @@ static void avahiRegisterService(AvahiClient * c);
/* Callback when the EntryGroup changes state */ /* Callback when the EntryGroup changes state */
static void avahiGroupCallback(AvahiEntryGroup * g, static void avahiGroupCallback(AvahiEntryGroup * g,
AvahiEntryGroupState state, AvahiEntryGroupState state,
G_GNUC_UNUSED void *userdata) gcc_unused void *userdata)
{ {
char *n; char *n;
assert(g); assert(g);
@ -142,7 +142,7 @@ fail:
/* Callback when avahi changes state */ /* Callback when avahi changes state */
static void avahiClientCallback(AvahiClient * c, AvahiClientState state, static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
G_GNUC_UNUSED void *userdata) gcc_unused void *userdata)
{ {
int reason; int reason;
assert(c); assert(c);

View File

@ -56,12 +56,12 @@ protected:
static BonjourMonitor *bonjour_monitor; static BonjourMonitor *bonjour_monitor;
static void static void
dnsRegisterCallback(G_GNUC_UNUSED DNSServiceRef sdRef, dnsRegisterCallback(gcc_unused DNSServiceRef sdRef,
G_GNUC_UNUSED DNSServiceFlags flags, gcc_unused DNSServiceFlags flags,
DNSServiceErrorType errorCode, const char *name, DNSServiceErrorType errorCode, const char *name,
G_GNUC_UNUSED const char *regtype, gcc_unused const char *regtype,
G_GNUC_UNUSED const char *domain, gcc_unused const char *domain,
G_GNUC_UNUSED void *context) gcc_unused void *context)
{ {
if (errorCode != kDNSServiceErr_NoError) { if (errorCode != kDNSServiceErr_NoError) {
g_warning("Failed to register zeroconf service."); g_warning("Failed to register zeroconf service.");

View File

@ -20,6 +20,8 @@
#ifndef MPD_ACK_H #ifndef MPD_ACK_H
#define MPD_ACK_H #define MPD_ACK_H
#include "gcc.h"
#include <glib.h> #include <glib.h>
enum ack { enum ack {
@ -41,7 +43,7 @@ enum ack {
/** /**
* Quark for GError.domain; the code is an enum #ack. * Quark for GError.domain; the code is an enum #ack.
*/ */
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
ack_quark(void) ack_quark(void)
{ {

View File

@ -76,7 +76,7 @@ protected:
bool Configure(const config_param &param, GError **error_r); bool Configure(const config_param &param, GError **error_r);
}; };
G_GNUC_CONST gcc_pure
static inline GQuark static inline GQuark
libmpdclient_quark(void) libmpdclient_quark(void)
{ {
@ -107,7 +107,7 @@ static constexpr struct {
{ TAG_NUM_OF_ITEM_TYPES, MPD_TAG_COUNT } { TAG_NUM_OF_ITEM_TYPES, MPD_TAG_COUNT }
}; };
G_GNUC_CONST gcc_const
static enum mpd_tag_type static enum mpd_tag_type
Convert(enum tag_type tag_type) Convert(enum tag_type tag_type)
{ {

View File

@ -33,7 +33,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
simple_db_quark(void) simple_db_quark(void)
{ {
@ -241,7 +241,7 @@ SimpleDatabase::ReturnSong(gcc_unused Song *song) const
#endif #endif
} }
G_GNUC_PURE gcc_pure
const Directory * const Directory *
SimpleDatabase::LookupDirectory(const char *uri) const SimpleDatabase::LookupDirectory(const char *uri) const
{ {

View File

@ -20,6 +20,8 @@
#ifndef MPD_DB_ERROR_H #ifndef MPD_DB_ERROR_H
#define MPD_DB_ERROR_H #define MPD_DB_ERROR_H
#include "gcc.h"
#include <glib.h> #include <glib.h>
enum db_error { enum db_error {
@ -35,7 +37,7 @@ enum db_error {
/** /**
* Quark for GError.domain; the code is an enum #db_error. * Quark for GError.domain; the code is an enum #db_error.
*/ */
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
db_quark(void) db_quark(void)
{ {

View File

@ -477,8 +477,8 @@ dsdiff_stream_decode(struct decoder *decoder, struct input_stream *is)
static bool static bool
dsdiff_scan_stream(struct input_stream *is, dsdiff_scan_stream(struct input_stream *is,
G_GNUC_UNUSED const struct tag_handler *handler, gcc_unused const struct tag_handler *handler,
G_GNUC_UNUSED void *handler_ctx) gcc_unused void *handler_ctx)
{ {
DsdiffMetaData metadata; DsdiffMetaData metadata;
DsdiffChunkHeader chunk_header; DsdiffChunkHeader chunk_header;

View File

@ -309,8 +309,8 @@ dsf_stream_decode(struct decoder *decoder, struct input_stream *is)
static bool static bool
dsf_scan_stream(struct input_stream *is, dsf_scan_stream(struct input_stream *is,
G_GNUC_UNUSED const struct tag_handler *handler, gcc_unused const struct tag_handler *handler,
G_GNUC_UNUSED void *handler_ctx) gcc_unused void *handler_ctx)
{ {
/* check DSF metadata */ /* check DSF metadata */
DsfMetaData metadata; DsfMetaData metadata;

View File

@ -73,7 +73,7 @@ level_ffmpeg_to_glib(int level)
} }
static void static void
mpd_ffmpeg_log_callback(G_GNUC_UNUSED void *ptr, int level, mpd_ffmpeg_log_callback(gcc_unused void *ptr, int level,
const char *fmt, va_list vl) const char *fmt, va_list vl)
{ {
const AVClass * cls = NULL; const AVClass * cls = NULL;
@ -185,7 +185,7 @@ ffmpeg_find_audio_stream(const AVFormatContext *format_context)
return -1; return -1;
} }
G_GNUC_CONST gcc_const
static double static double
time_from_ffmpeg(int64_t t, const AVRational time_base) time_from_ffmpeg(int64_t t, const AVRational time_base)
{ {
@ -195,7 +195,7 @@ time_from_ffmpeg(int64_t t, const AVRational time_base)
/ (double)1024; / (double)1024;
} }
G_GNUC_CONST gcc_const
static int64_t static int64_t
time_to_ffmpeg(double t, const AVRational time_base) time_to_ffmpeg(double t, const AVRational time_base)
{ {
@ -301,7 +301,7 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
return cmd; return cmd;
} }
G_GNUC_CONST gcc_const
static SampleFormat static SampleFormat
ffmpeg_sample_format(enum AVSampleFormat sample_fmt) ffmpeg_sample_format(enum AVSampleFormat sample_fmt)
{ {

View File

@ -56,7 +56,7 @@ static void flacPrintErroredState(FLAC__StreamDecoderState state)
g_warning("%s\n", FLAC__StreamDecoderStateString[state]); g_warning("%s\n", FLAC__StreamDecoderStateString[state]);
} }
static void flacMetadata(G_GNUC_UNUSED const FLAC__StreamDecoder * dec, static void flacMetadata(gcc_unused const FLAC__StreamDecoder * dec,
const FLAC__StreamMetadata * block, void *vdata) const FLAC__StreamMetadata * block, void *vdata)
{ {
flac_metadata_common_cb(block, (struct flac_data *) vdata); flac_metadata_common_cb(block, (struct flac_data *) vdata);

View File

@ -64,7 +64,7 @@ fluidsynth_level_to_glib(enum fluid_log_level level)
* logging library. * logging library.
*/ */
static void static void
fluidsynth_mpd_log_function(int level, char *message, G_GNUC_UNUSED void *data) fluidsynth_mpd_log_function(int level, char *message, gcc_unused void *data)
{ {
g_log(G_LOG_DOMAIN, fluidsynth_level_to_glib(fluid_log_level(level)), g_log(G_LOG_DOMAIN, fluidsynth_level_to_glib(fluid_log_level(level)),
"%s", message); "%s", message);
@ -199,8 +199,8 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
static bool static bool
fluidsynth_scan_file(const char *file, fluidsynth_scan_file(const char *file,
G_GNUC_UNUSED const struct tag_handler *handler, gcc_unused const struct tag_handler *handler,
G_GNUC_UNUSED void *handler_ctx) gcc_unused void *handler_ctx)
{ {
return fluid_is_midifile(file); return fluid_is_midifile(file);
} }

View File

@ -67,9 +67,9 @@ sndfile_vio_read(void *ptr, sf_count_t count, void *user_data)
} }
static sf_count_t static sf_count_t
sndfile_vio_write(G_GNUC_UNUSED const void *ptr, sndfile_vio_write(gcc_unused const void *ptr,
G_GNUC_UNUSED sf_count_t count, gcc_unused sf_count_t count,
G_GNUC_UNUSED void *user_data) gcc_unused void *user_data)
{ {
/* no writing! */ /* no writing! */
return -1; return -1;

View File

@ -87,7 +87,7 @@ static int ogg_seek_cb(void *data, ogg_int64_t offset, int whence)
} }
/* TODO: check Ogg libraries API and see if we can just not have this func */ /* TODO: check Ogg libraries API and see if we can just not have this func */
static int ogg_close_cb(G_GNUC_UNUSED void *data) static int ogg_close_cb(gcc_unused void *data)
{ {
return 0; return 0;
} }

View File

@ -92,7 +92,7 @@ format_samples_int(int bytes_per_sample, void *buffer, uint32_t count)
* This function converts floating point sample data to 24-bit integer. * This function converts floating point sample data to 24-bit integer.
*/ */
static void static void
format_samples_float(G_GNUC_UNUSED int bytes_per_sample, void *buffer, format_samples_float(gcc_unused int bytes_per_sample, void *buffer,
uint32_t count) uint32_t count)
{ {
float *p = (float *)buffer; float *p = (float *)buffer;

View File

@ -133,11 +133,11 @@ flac_encoder_setup(struct flac_encoder *encoder, unsigned bits_per_sample,
} }
static FLAC__StreamEncoderWriteStatus static FLAC__StreamEncoderWriteStatus
flac_write_callback(G_GNUC_UNUSED const FLAC__StreamEncoder *fse, flac_write_callback(gcc_unused const FLAC__StreamEncoder *fse,
const FLAC__byte data[], const FLAC__byte data[],
size_t bytes, size_t bytes,
G_GNUC_UNUSED unsigned samples, gcc_unused unsigned samples,
G_GNUC_UNUSED unsigned current_frame, void *client_data) gcc_unused unsigned current_frame, void *client_data)
{ {
struct flac_encoder *encoder = (struct flac_encoder *) client_data; struct flac_encoder *encoder = (struct flac_encoder *) client_data;
@ -224,7 +224,7 @@ flac_encoder_open(Encoder *_encoder, AudioFormat &audio_format,
static bool static bool
flac_encoder_flush(Encoder *_encoder, G_GNUC_UNUSED GError **error) flac_encoder_flush(Encoder *_encoder, gcc_unused GError **error)
{ {
struct flac_encoder *encoder = (struct flac_encoder *)_encoder; struct flac_encoder *encoder = (struct flac_encoder *)_encoder;
@ -252,8 +252,8 @@ pcm16_to_flac(int32_t *out, const int16_t *in, unsigned num_samples)
static bool static bool
flac_encoder_write(Encoder *_encoder, flac_encoder_write(Encoder *_encoder,
const void *data, size_t length, const void *data, size_t length,
G_GNUC_UNUSED GError **error) gcc_unused GError **error)
{ {
struct flac_encoder *encoder = (struct flac_encoder *)_encoder; struct flac_encoder *encoder = (struct flac_encoder *)_encoder;
unsigned num_frames, num_samples; unsigned num_frames, num_samples;
@ -324,7 +324,7 @@ flac_encoder_read(Encoder *_encoder, void *dest, size_t length)
} }
static const char * static const char *
flac_encoder_get_mime_type(G_GNUC_UNUSED Encoder *_encoder) flac_encoder_get_mime_type(gcc_unused Encoder *_encoder)
{ {
return "audio/flac"; return "audio/flac";
} }

View File

@ -265,7 +265,7 @@ opus_encoder_end(Encoder *_encoder, GError **error_r)
} }
static bool static bool
opus_encoder_flush(Encoder *_encoder, G_GNUC_UNUSED GError **error) opus_encoder_flush(Encoder *_encoder, gcc_unused GError **error)
{ {
struct opus_encoder *encoder = (struct opus_encoder *)_encoder; struct opus_encoder *encoder = (struct opus_encoder *)_encoder;
@ -404,7 +404,7 @@ opus_encoder_read(Encoder *_encoder, void *dest, size_t length)
} }
static const char * static const char *
opus_encoder_get_mime_type(G_GNUC_UNUSED Encoder *_encoder) opus_encoder_get_mime_type(gcc_unused Encoder *_encoder)
{ {
return "audio/ogg"; return "audio/ogg";
} }

View File

@ -250,7 +250,7 @@ vorbis_encoder_blockout(struct vorbis_encoder *encoder)
} }
static bool static bool
vorbis_encoder_flush(Encoder *_encoder, G_GNUC_UNUSED GError **error) vorbis_encoder_flush(Encoder *_encoder, gcc_unused GError **error)
{ {
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
@ -259,7 +259,7 @@ vorbis_encoder_flush(Encoder *_encoder, G_GNUC_UNUSED GError **error)
} }
static bool static bool
vorbis_encoder_pre_tag(Encoder *_encoder, G_GNUC_UNUSED GError **error) vorbis_encoder_pre_tag(Encoder *_encoder, gcc_unused GError **error)
{ {
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
@ -290,7 +290,7 @@ copy_tag_to_vorbis_comment(vorbis_comment *vc, const Tag *tag)
static bool static bool
vorbis_encoder_tag(Encoder *_encoder, const Tag *tag, vorbis_encoder_tag(Encoder *_encoder, const Tag *tag,
G_GNUC_UNUSED GError **error) gcc_unused GError **error)
{ {
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
vorbis_comment comment; vorbis_comment comment;
@ -324,7 +324,7 @@ interleaved_to_vorbis_buffer(float **dest, const float *src,
static bool static bool
vorbis_encoder_write(Encoder *_encoder, vorbis_encoder_write(Encoder *_encoder,
const void *data, size_t length, const void *data, size_t length,
G_GNUC_UNUSED GError **error) gcc_unused GError **error)
{ {
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder; struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
@ -352,7 +352,7 @@ vorbis_encoder_read(Encoder *_encoder, void *dest, size_t length)
} }
static const char * static const char *
vorbis_encoder_get_mime_type(G_GNUC_UNUSED Encoder *_encoder) vorbis_encoder_get_mime_type(gcc_unused Encoder *_encoder)
{ {
return "audio/ogg"; return "audio/ogg";
} }

View File

@ -35,6 +35,7 @@
# define gcc_const __attribute__((const)) # define gcc_const __attribute__((const))
# define gcc_pure __attribute__((pure)) # define gcc_pure __attribute__((pure))
# define gcc_malloc __attribute__((malloc)) # define gcc_malloc __attribute__((malloc))
# define gcc_noreturn __attribute__((noreturn))
# define gcc_must_check __attribute__ ((warn_unused_result)) # define gcc_must_check __attribute__ ((warn_unused_result))
# define gcc_packed __attribute__ ((packed)) # define gcc_packed __attribute__ ((packed))
/* these are very useful for type checking */ /* these are very useful for type checking */
@ -59,6 +60,7 @@
# define gcc_const # define gcc_const
# define gcc_pure # define gcc_pure
# define gcc_malloc # define gcc_malloc
# define gcc_noreturn
# define gcc_must_check # define gcc_must_check
# define gcc_packed # define gcc_packed
# define gcc_printf # define gcc_printf

View File

@ -228,6 +228,7 @@ static struct {
CurlSockets *sockets; CurlSockets *sockets;
} curl; } curl;
gcc_const
static inline GQuark static inline GQuark
curl_quark(void) curl_quark(void)
{ {
@ -615,7 +616,7 @@ CurlSockets::DispatchSockets()
static bool static bool
input_curl_init(const config_param &param, input_curl_init(const config_param &param,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
CURLcode code = curl_global_init(CURL_GLOBAL_ALL); CURLcode code = curl_global_init(CURL_GLOBAL_ALL);
if (code != CURLE_OK) { if (code != CURLE_OK) {
@ -654,7 +655,7 @@ input_curl_init(const config_param &param,
} }
static gpointer static gpointer
curl_destroy_sources(G_GNUC_UNUSED gpointer data) curl_destroy_sources(gcc_unused gpointer data)
{ {
delete curl.sockets; delete curl.sockets;
@ -681,7 +682,7 @@ input_curl_finish(void)
* *
* The caller must lock the mutex. * The caller must lock the mutex.
*/ */
G_GNUC_PURE gcc_pure
static size_t static size_t
curl_total_buffer_size(const struct input_curl *c) curl_total_buffer_size(const struct input_curl *c)
{ {
@ -869,7 +870,7 @@ input_curl_close(struct input_stream *is)
} }
static bool static bool
input_curl_eof(G_GNUC_UNUSED struct input_stream *is) input_curl_eof(gcc_unused struct input_stream *is)
{ {
struct input_curl *c = (struct input_curl *)is; struct input_curl *c = (struct input_curl *)is;

View File

@ -95,8 +95,8 @@ refill_buffer(DespotifyInputStream *ctx)
} }
} }
static void callback(G_GNUC_UNUSED struct despotify_session* ds, static void callback(gcc_unused struct despotify_session* ds,
int sig, G_GNUC_UNUSED void* data, void* callback_data) int sig, gcc_unused void* data, void* callback_data)
{ {
DespotifyInputStream *ctx = (DespotifyInputStream *)callback_data; DespotifyInputStream *ctx = (DespotifyInputStream *)callback_data;
@ -124,7 +124,7 @@ static void callback(G_GNUC_UNUSED struct despotify_session* ds,
static struct input_stream * static struct input_stream *
input_despotify_open(const char *url, input_despotify_open(const char *url,
Mutex &mutex, Cond &cond, Mutex &mutex, Cond &cond,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
struct despotify_session *session; struct despotify_session *session;
struct ds_link *ds_link; struct ds_link *ds_link;
@ -172,7 +172,7 @@ input_despotify_open(const char *url,
static size_t static size_t
input_despotify_read(struct input_stream *is, void *ptr, size_t size, input_despotify_read(struct input_stream *is, void *ptr, size_t size,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
DespotifyInputStream *ctx = (DespotifyInputStream *)is; DespotifyInputStream *ctx = (DespotifyInputStream *)is;
size_t to_cpy = size; size_t to_cpy = size;
@ -208,9 +208,9 @@ input_despotify_eof(struct input_stream *is)
} }
static bool static bool
input_despotify_seek(G_GNUC_UNUSED struct input_stream *is, input_despotify_seek(gcc_unused struct input_stream *is,
G_GNUC_UNUSED goffset offset, G_GNUC_UNUSED int whence, gcc_unused goffset offset, gcc_unused int whence,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
return false; return false;
} }

View File

@ -77,7 +77,7 @@ input_ffmpeg_supported(void)
static bool static bool
input_ffmpeg_init(gcc_unused const config_param &param, input_ffmpeg_init(gcc_unused const config_param &param,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
av_register_all(); av_register_all();
@ -154,7 +154,7 @@ input_ffmpeg_eof(struct input_stream *is)
static bool static bool
input_ffmpeg_seek(struct input_stream *is, goffset offset, int whence, input_ffmpeg_seek(struct input_stream *is, goffset offset, int whence,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
FfmpegInputStream *i = (FfmpegInputStream *)is; FfmpegInputStream *i = (FfmpegInputStream *)is;
int64_t ret = avio_seek(i->h, offset, whence); int64_t ret = avio_seek(i->h, offset, whence);

View File

@ -124,9 +124,9 @@ input_mms_eof(struct input_stream *is)
} }
static bool static bool
input_mms_seek(G_GNUC_UNUSED struct input_stream *is, input_mms_seek(gcc_unused struct input_stream *is,
G_GNUC_UNUSED goffset offset, G_GNUC_UNUSED int whence, gcc_unused goffset offset, gcc_unused int whence,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
return false; return false;
} }

View File

@ -27,7 +27,7 @@
/** /**
* A GQuark for GError for I/O errors. The code is an errno value. * A GQuark for GError for I/O errors. The code is an errno value.
*/ */
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
errno_quark(void) errno_quark(void)
{ {

View File

@ -73,6 +73,7 @@ public:
/** /**
* The quark used for GError.domain. * The quark used for GError.domain.
*/ */
gcc_const
static inline GQuark static inline GQuark
alsa_mixer_quark(void) alsa_mixer_quark(void)
{ {
@ -124,7 +125,7 @@ AlsaMixerMonitor::DispatchSockets()
*/ */
static int static int
alsa_mixer_elem_callback(G_GNUC_UNUSED snd_mixer_elem_t *elem, unsigned mask) alsa_mixer_elem_callback(gcc_unused snd_mixer_elem_t *elem, unsigned mask)
{ {
if (mask & SND_CTL_EVENT_MASK_VALUE) if (mask & SND_CTL_EVENT_MASK_VALUE)
GlobalEvents::Emit(GlobalEvents::MIXER); GlobalEvents::Emit(GlobalEvents::MIXER);
@ -149,8 +150,8 @@ AlsaMixer::Configure(const config_param &param)
} }
static Mixer * static Mixer *
alsa_mixer_init(G_GNUC_UNUSED void *ao, const config_param &param, alsa_mixer_init(gcc_unused void *ao, const config_param &param,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
AlsaMixer *am = new AlsaMixer(); AlsaMixer *am = new AlsaMixer();
am->Configure(param); am->Configure(param);
@ -169,7 +170,7 @@ alsa_mixer_finish(Mixer *data)
snd_config_update_free_global(); snd_config_update_free_global();
} }
G_GNUC_PURE gcc_pure
static snd_mixer_elem_t * static snd_mixer_elem_t *
alsa_mixer_lookup_elem(snd_mixer_t *handle, const char *name, unsigned idx) alsa_mixer_lookup_elem(snd_mixer_t *handle, const char *name, unsigned idx)
{ {

View File

@ -104,7 +104,7 @@ OssMixer::Configure(const config_param &param, GError **error_r)
} }
static Mixer * static Mixer *
oss_mixer_init(G_GNUC_UNUSED void *ao, const config_param &param, oss_mixer_init(gcc_unused void *ao, const config_param &param,
GError **error_r) GError **error_r)
{ {
OssMixer *om = new OssMixer(); OssMixer *om = new OssMixer();

View File

@ -77,7 +77,7 @@ pulse_mixer_offline(PulseMixer *pm)
* value. * value.
*/ */
static void static void
pulse_mixer_volume_cb(G_GNUC_UNUSED pa_context *context, const pa_sink_input_info *i, pulse_mixer_volume_cb(gcc_unused pa_context *context, const pa_sink_input_info *i,
int eol, void *userdata) int eol, void *userdata)
{ {
PulseMixer *pm = (PulseMixer *)userdata; PulseMixer *pm = (PulseMixer *)userdata;
@ -120,7 +120,7 @@ pulse_mixer_update(PulseMixer *pm,
} }
void void
pulse_mixer_on_connect(G_GNUC_UNUSED PulseMixer *pm, pulse_mixer_on_connect(gcc_unused PulseMixer *pm,
struct pa_context *context) struct pa_context *context)
{ {
pa_operation *o; pa_operation *o;
@ -182,7 +182,7 @@ pulse_mixer_finish(Mixer *data)
} }
static int static int
pulse_mixer_get_volume(Mixer *mixer, G_GNUC_UNUSED GError **error_r) pulse_mixer_get_volume(Mixer *mixer, gcc_unused GError **error_r)
{ {
PulseMixer *pm = (PulseMixer *) mixer; PulseMixer *pm = (PulseMixer *) mixer;
int ret; int ret;

View File

@ -61,7 +61,7 @@ winmm_volume_encode(int volume)
static Mixer * static Mixer *
winmm_mixer_init(void *ao, gcc_unused const config_param &param, winmm_mixer_init(void *ao, gcc_unused const config_param &param,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
assert(ao != nullptr); assert(ao != nullptr);

View File

@ -197,7 +197,7 @@ alsa_finish(struct audio_output *ao)
} }
static bool static bool
alsa_output_enable(struct audio_output *ao, G_GNUC_UNUSED GError **error_r) alsa_output_enable(struct audio_output *ao, gcc_unused GError **error_r)
{ {
AlsaOutput *ad = (AlsaOutput *)ao; AlsaOutput *ad = (AlsaOutput *)ao;

View File

@ -228,7 +228,7 @@ fifo_output_finish(struct audio_output *ao)
static bool static bool
fifo_output_open(struct audio_output *ao, AudioFormat &audio_format, fifo_output_open(struct audio_output *ao, AudioFormat &audio_format,
G_GNUC_UNUSED GError **error) gcc_unused GError **error)
{ {
FifoOutput *fd = (FifoOutput *)ao; FifoOutput *fd = (FifoOutput *)ao;

View File

@ -615,7 +615,7 @@ mpd_jack_open(struct audio_output *ao, AudioFormat &audio_format,
} }
static void static void
mpd_jack_close(G_GNUC_UNUSED struct audio_output *ao) mpd_jack_close(gcc_unused struct audio_output *ao)
{ {
JackOutput *jd = (JackOutput *)ao; JackOutput *jd = (JackOutput *)ao;

View File

@ -196,10 +196,10 @@ done:
static OSStatus static OSStatus
osx_render(void *vdata, osx_render(void *vdata,
G_GNUC_UNUSED AudioUnitRenderActionFlags *io_action_flags, gcc_unused AudioUnitRenderActionFlags *io_action_flags,
G_GNUC_UNUSED const AudioTimeStamp *in_timestamp, gcc_unused const AudioTimeStamp *in_timestamp,
G_GNUC_UNUSED UInt32 in_bus_number, gcc_unused UInt32 in_bus_number,
G_GNUC_UNUSED UInt32 in_number_frames, gcc_unused UInt32 in_number_frames,
AudioBufferList *buffer_list) AudioBufferList *buffer_list)
{ {
OSXOutput *od = (OSXOutput *) vdata; OSXOutput *od = (OSXOutput *) vdata;
@ -390,7 +390,7 @@ osx_output_open(struct audio_output *ao, AudioFormat &audio_format, GError **err
static size_t static size_t
osx_output_play(struct audio_output *ao, const void *chunk, size_t size, osx_output_play(struct audio_output *ao, const void *chunk, size_t size,
G_GNUC_UNUSED GError **error) gcc_unused GError **error)
{ {
OSXOutput *od = (OSXOutput *)ao; OSXOutput *od = (OSXOutput *)ao;

View File

@ -59,6 +59,7 @@ struct OpenALOutput {
} }
}; };
gcc_const
static inline GQuark static inline GQuark
openal_output_quark(void) openal_output_quark(void)
{ {
@ -90,7 +91,7 @@ openal_audio_format(AudioFormat &audio_format)
} }
} }
G_GNUC_PURE gcc_pure
static inline ALint static inline ALint
openal_get_source_i(const OpenALOutput *od, ALenum param) openal_get_source_i(const OpenALOutput *od, ALenum param)
{ {
@ -99,14 +100,14 @@ openal_get_source_i(const OpenALOutput *od, ALenum param)
return value; return value;
} }
G_GNUC_PURE gcc_pure
static inline bool static inline bool
openal_has_processed(const OpenALOutput *od) openal_has_processed(const OpenALOutput *od)
{ {
return openal_get_source_i(od, AL_BUFFERS_PROCESSED) > 0; return openal_get_source_i(od, AL_BUFFERS_PROCESSED) > 0;
} }
G_GNUC_PURE gcc_pure
static inline ALint static inline ALint
openal_is_playing(const OpenALOutput *od) openal_is_playing(const OpenALOutput *od)
{ {
@ -230,7 +231,7 @@ openal_delay(struct audio_output *ao)
static size_t static size_t
openal_play(struct audio_output *ao, const void *chunk, size_t size, openal_play(struct audio_output *ao, const void *chunk, size_t size,
G_GNUC_UNUSED GError **error) gcc_unused GError **error)
{ {
OpenALOutput *od = (OpenALOutput *)ao; OpenALOutput *od = (OpenALOutput *)ao;
ALuint buffer; ALuint buffer;

View File

@ -231,7 +231,7 @@ oss_output_finish(struct audio_output *ao)
#ifdef AFMT_S24_PACKED #ifdef AFMT_S24_PACKED
static bool static bool
oss_output_enable(struct audio_output *ao, G_GNUC_UNUSED GError **error_r) oss_output_enable(struct audio_output *ao, gcc_unused GError **error_r)
{ {
OssOutput *od = (OssOutput *)ao; OssOutput *od = (OssOutput *)ao;

View File

@ -95,8 +95,8 @@ pipe_output_finish(struct audio_output *ao)
static bool static bool
pipe_output_open(struct audio_output *ao, pipe_output_open(struct audio_output *ao,
G_GNUC_UNUSED AudioFormat &audio_format, gcc_unused AudioFormat &audio_format,
G_GNUC_UNUSED GError **error) gcc_unused GError **error)
{ {
PipeOutput *pd = (PipeOutput *)ao; PipeOutput *pd = (PipeOutput *)ao;

View File

@ -184,8 +184,8 @@ pulse_wait_for_operation(struct pa_threaded_mainloop *mainloop,
* the caller thread, to wake pulse_wait_for_operation() up. * the caller thread, to wake pulse_wait_for_operation() up.
*/ */
static void static void
pulse_output_stream_success_cb(G_GNUC_UNUSED pa_stream *s, pulse_output_stream_success_cb(gcc_unused pa_stream *s,
G_GNUC_UNUSED int success, void *userdata) gcc_unused int success, void *userdata)
{ {
PulseOutput *po = (PulseOutput *)userdata; PulseOutput *po = (PulseOutput *)userdata;
@ -485,7 +485,7 @@ pulse_output_wait_connection(PulseOutput *po, GError **error_r)
#if PA_CHECK_VERSION(0,9,8) #if PA_CHECK_VERSION(0,9,8)
static void static void
pulse_output_stream_suspended_cb(G_GNUC_UNUSED pa_stream *stream, void *userdata) pulse_output_stream_suspended_cb(gcc_unused pa_stream *stream, void *userdata)
{ {
PulseOutput *po = (PulseOutput *)userdata; PulseOutput *po = (PulseOutput *)userdata;
@ -531,7 +531,7 @@ pulse_output_stream_state_cb(pa_stream *stream, void *userdata)
} }
static void static void
pulse_output_stream_write_cb(G_GNUC_UNUSED pa_stream *stream, size_t nbytes, pulse_output_stream_write_cb(gcc_unused pa_stream *stream, size_t nbytes,
void *userdata) void *userdata)
{ {
PulseOutput *po = (PulseOutput *)userdata; PulseOutput *po = (PulseOutput *)userdata;

View File

@ -391,7 +391,7 @@ my_shout_finish_driver(struct audio_output *ao)
static void static void
my_shout_drop_buffered_audio(struct audio_output *ao) my_shout_drop_buffered_audio(struct audio_output *ao)
{ {
G_GNUC_UNUSED gcc_unused
ShoutOutput *sd = (ShoutOutput *)ao; ShoutOutput *sd = (ShoutOutput *)ao;
/* needs to be implemented for shout */ /* needs to be implemented for shout */

View File

@ -24,7 +24,7 @@
/** /**
* Align the specified size to the next 8k boundary. * Align the specified size to the next 8k boundary.
*/ */
G_GNUC_CONST constexpr
static size_t static size_t
align_8k(size_t size) align_8k(size_t size)
{ {

View File

@ -22,14 +22,14 @@
#include "PcmBuffer.hxx" #include "PcmBuffer.hxx"
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
G_GNUC_CONST constexpr
static inline uint32_t static inline uint32_t
pcm_two_dsd_to_usb_marker1(uint8_t a, uint8_t b) pcm_two_dsd_to_usb_marker1(uint8_t a, uint8_t b)
{ {
return 0xff050000 | (a << 8) | b; return 0xff050000 | (a << 8) | b;
} }
G_GNUC_CONST constexpr
static inline uint32_t static inline uint32_t
pcm_two_dsd_to_usb_marker2(uint8_t a, uint8_t b) pcm_two_dsd_to_usb_marker2(uint8_t a, uint8_t b)
{ {

View File

@ -65,7 +65,7 @@ pcm_resample_lsr_32(PcmResampler *state,
unsigned channels, unsigned channels,
unsigned src_rate, unsigned src_rate,
const int32_t *src_buffer, const int32_t *src_buffer,
G_GNUC_UNUSED size_t src_size, size_t src_size,
unsigned dest_rate, size_t *dest_size_r, unsigned dest_rate, size_t *dest_size_r,
GError **error_r); GError **error_r);
@ -84,7 +84,7 @@ pcm_resample_fallback_32(PcmResampler *state,
unsigned channels, unsigned channels,
unsigned src_rate, unsigned src_rate,
const int32_t *src_buffer, const int32_t *src_buffer,
G_GNUC_UNUSED size_t src_size, size_t src_size,
unsigned dest_rate, unsigned dest_rate,
size_t *dest_size_r); size_t *dest_size_r);

View File

@ -64,7 +64,7 @@ pcm_volume_change_16(int16_t *buffer, const int16_t *end, int volume)
* multiplication result instead of emulating 64 bit multiplication. * multiplication result instead of emulating 64 bit multiplication.
*/ */
static inline int32_t static inline int32_t
pcm_volume_sample_24(int32_t sample, int32_t volume, G_GNUC_UNUSED int32_t dither) pcm_volume_sample_24(int32_t sample, int32_t volume, gcc_unused int32_t dither)
{ {
int32_t result; int32_t result;

View File

@ -79,11 +79,11 @@ get_attribute(const gchar **attribute_names, const gchar **attribute_values,
} }
static void static void
asx_start_element(G_GNUC_UNUSED GMarkupParseContext *context, asx_start_element(gcc_unused GMarkupParseContext *context,
const gchar *element_name, const gchar *element_name,
const gchar **attribute_names, const gchar **attribute_names,
const gchar **attribute_values, const gchar **attribute_values,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
AsxParser *parser = (AsxParser *)user_data; AsxParser *parser = (AsxParser *)user_data;
@ -130,9 +130,9 @@ asx_start_element(G_GNUC_UNUSED GMarkupParseContext *context,
} }
static void static void
asx_end_element(G_GNUC_UNUSED GMarkupParseContext *context, asx_end_element(gcc_unused GMarkupParseContext *context,
const gchar *element_name, const gchar *element_name,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
AsxParser *parser = (AsxParser *)user_data; AsxParser *parser = (AsxParser *)user_data;
@ -156,9 +156,9 @@ asx_end_element(G_GNUC_UNUSED GMarkupParseContext *context,
} }
static void static void
asx_text(G_GNUC_UNUSED GMarkupParseContext *context, asx_text(gcc_unused GMarkupParseContext *context,
const gchar *text, gsize text_len, const gchar *text, gsize text_len,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
AsxParser *parser = (AsxParser *)user_data; AsxParser *parser = (AsxParser *)user_data;

View File

@ -78,11 +78,11 @@ get_attribute(const gchar **attribute_names, const gchar **attribute_values,
} }
static void static void
rss_start_element(G_GNUC_UNUSED GMarkupParseContext *context, rss_start_element(gcc_unused GMarkupParseContext *context,
const gchar *element_name, const gchar *element_name,
const gchar **attribute_names, const gchar **attribute_names,
const gchar **attribute_values, const gchar **attribute_values,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
RssParser *parser = (RssParser *)user_data; RssParser *parser = (RssParser *)user_data;
@ -127,9 +127,9 @@ rss_start_element(G_GNUC_UNUSED GMarkupParseContext *context,
} }
static void static void
rss_end_element(G_GNUC_UNUSED GMarkupParseContext *context, rss_end_element(gcc_unused GMarkupParseContext *context,
const gchar *element_name, const gchar *element_name,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
RssParser *parser = (RssParser *)user_data; RssParser *parser = (RssParser *)user_data;
@ -153,9 +153,9 @@ rss_end_element(G_GNUC_UNUSED GMarkupParseContext *context,
} }
static void static void
rss_text(G_GNUC_UNUSED GMarkupParseContext *context, rss_text(gcc_unused GMarkupParseContext *context,
const gchar *text, gsize text_len, const gchar *text, gsize text_len,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
RssParser *parser = (RssParser *)user_data; RssParser *parser = (RssParser *)user_data;

View File

@ -67,11 +67,11 @@ struct XspfParser {
}; };
static void static void
xspf_start_element(G_GNUC_UNUSED GMarkupParseContext *context, xspf_start_element(gcc_unused GMarkupParseContext *context,
const gchar *element_name, const gchar *element_name,
G_GNUC_UNUSED const gchar **attribute_names, gcc_unused const gchar **attribute_names,
G_GNUC_UNUSED const gchar **attribute_values, gcc_unused const gchar **attribute_values,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
XspfParser *parser = (XspfParser *)user_data; XspfParser *parser = (XspfParser *)user_data;
@ -121,9 +121,9 @@ xspf_start_element(G_GNUC_UNUSED GMarkupParseContext *context,
} }
static void static void
xspf_end_element(G_GNUC_UNUSED GMarkupParseContext *context, xspf_end_element(gcc_unused GMarkupParseContext *context,
const gchar *element_name, const gchar *element_name,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
XspfParser *parser = (XspfParser *)user_data; XspfParser *parser = (XspfParser *)user_data;
@ -161,9 +161,9 @@ xspf_end_element(G_GNUC_UNUSED GMarkupParseContext *context,
} }
static void static void
xspf_text(G_GNUC_UNUSED GMarkupParseContext *context, xspf_text(gcc_unused GMarkupParseContext *context,
const gchar *text, gsize text_len, const gchar *text, gsize text_len,
gpointer user_data, G_GNUC_UNUSED GError **error) gpointer user_data, gcc_unused GError **error)
{ {
XspfParser *parser = (XspfParser *)user_data; XspfParser *parser = (XspfParser *)user_data;

View File

@ -20,6 +20,8 @@
#ifndef MPD_PLAYLIST_ERROR_H #ifndef MPD_PLAYLIST_ERROR_H
#define MPD_PLAYLIST_ERROR_H #define MPD_PLAYLIST_ERROR_H
#include "gcc.h"
#include <glib.h> #include <glib.h>
enum playlist_result { enum playlist_result {
@ -39,7 +41,7 @@ enum playlist_result {
/** /**
* Quark for GError.domain; the code is an enum #playlist_result. * Quark for GError.domain; the code is an enum #playlist_result.
*/ */
G_GNUC_CONST gcc_const
static inline GQuark static inline GQuark
playlist_quark(void) playlist_quark(void)
{ {

View File

@ -26,7 +26,7 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
G_GNUC_CONST gcc_const
static GQuark static GQuark
tokenizer_quark(void) tokenizer_quark(void)
{ {

View File

@ -36,8 +36,8 @@ using std::endl;
#include <stdlib.h> #include <stdlib.h>
static void static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_domain != NULL) if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message); g_printerr("%s: %s\n", log_domain, message);

View File

@ -40,8 +40,8 @@ Directory::Directory() {}
Directory::~Directory() {} Directory::~Directory() {}
static void static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_domain != NULL) if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message); g_printerr("%s: %s\n", log_domain, message);
@ -50,37 +50,37 @@ my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
} }
void void
decoder_initialized(G_GNUC_UNUSED struct decoder *decoder, decoder_initialized(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED const AudioFormat audio_format, gcc_unused const AudioFormat audio_format,
G_GNUC_UNUSED bool seekable, gcc_unused bool seekable,
G_GNUC_UNUSED float total_time) gcc_unused float total_time)
{ {
} }
enum decoder_command enum decoder_command
decoder_get_command(G_GNUC_UNUSED struct decoder *decoder) decoder_get_command(gcc_unused struct decoder *decoder)
{ {
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
void void
decoder_command_finished(G_GNUC_UNUSED struct decoder *decoder) decoder_command_finished(gcc_unused struct decoder *decoder)
{ {
} }
double double
decoder_seek_where(G_GNUC_UNUSED struct decoder *decoder) decoder_seek_where(gcc_unused struct decoder *decoder)
{ {
return 1.0; return 1.0;
} }
void void
decoder_seek_error(G_GNUC_UNUSED struct decoder *decoder) decoder_seek_error(gcc_unused struct decoder *decoder)
{ {
} }
size_t size_t
decoder_read(G_GNUC_UNUSED struct decoder *decoder, decoder_read(gcc_unused struct decoder *decoder,
struct input_stream *is, struct input_stream *is,
void *buffer, size_t length) void *buffer, size_t length)
{ {
@ -88,31 +88,31 @@ decoder_read(G_GNUC_UNUSED struct decoder *decoder,
} }
void void
decoder_timestamp(G_GNUC_UNUSED struct decoder *decoder, decoder_timestamp(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED double t) gcc_unused double t)
{ {
} }
enum decoder_command enum decoder_command
decoder_data(G_GNUC_UNUSED struct decoder *decoder, decoder_data(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is, gcc_unused struct input_stream *is,
const void *data, size_t datalen, const void *data, size_t datalen,
G_GNUC_UNUSED uint16_t kbit_rate) gcc_unused uint16_t kbit_rate)
{ {
G_GNUC_UNUSED ssize_t nbytes = write(1, data, datalen); gcc_unused ssize_t nbytes = write(1, data, datalen);
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
enum decoder_command enum decoder_command
decoder_tag(G_GNUC_UNUSED struct decoder *decoder, decoder_tag(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is, gcc_unused struct input_stream *is,
G_GNUC_UNUSED Tag &&tag) gcc_unused Tag &&tag)
{ {
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
void void
decoder_replay_gain(G_GNUC_UNUSED struct decoder *decoder, decoder_replay_gain(gcc_unused struct decoder *decoder,
const struct replay_gain_info *replay_gain_info) const struct replay_gain_info *replay_gain_info)
{ {
const struct replay_gain_tuple *tuple = const struct replay_gain_tuple *tuple =
@ -128,7 +128,7 @@ decoder_replay_gain(G_GNUC_UNUSED struct decoder *decoder,
} }
void void
decoder_mixramp(G_GNUC_UNUSED struct decoder *decoder, decoder_mixramp(gcc_unused struct decoder *decoder,
char *mixramp_start, char *mixramp_end) char *mixramp_start, char *mixramp_end)
{ {
g_free(mixramp_start); g_free(mixramp_start);

View File

@ -36,8 +36,8 @@
#include <stdlib.h> #include <stdlib.h>
static void static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_domain != NULL) if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message); g_printerr("%s: %s\n", log_domain, message);

View File

@ -26,9 +26,9 @@
#include <assert.h> #include <assert.h>
static void static void
my_log_func(G_GNUC_UNUSED const gchar *log_domain, my_log_func(gcc_unused const gchar *log_domain,
GLogLevelFlags log_level, GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_level > G_LOG_LEVEL_WARNING) if (log_level > G_LOG_LEVEL_WARNING)
return; return;

View File

@ -39,31 +39,31 @@ EventLoop *main_loop;
#include "output/PulseOutputPlugin.hxx" #include "output/PulseOutputPlugin.hxx"
void void
pulse_output_lock(G_GNUC_UNUSED PulseOutput *po) pulse_output_lock(gcc_unused PulseOutput *po)
{ {
} }
void void
pulse_output_unlock(G_GNUC_UNUSED PulseOutput *po) pulse_output_unlock(gcc_unused PulseOutput *po)
{ {
} }
void void
pulse_output_set_mixer(G_GNUC_UNUSED PulseOutput *po, pulse_output_set_mixer(gcc_unused PulseOutput *po,
G_GNUC_UNUSED PulseMixer *pm) gcc_unused PulseMixer *pm)
{ {
} }
void void
pulse_output_clear_mixer(G_GNUC_UNUSED PulseOutput *po, pulse_output_clear_mixer(gcc_unused PulseOutput *po,
G_GNUC_UNUSED PulseMixer *pm) gcc_unused PulseMixer *pm)
{ {
} }
bool bool
pulse_output_set_volume(G_GNUC_UNUSED PulseOutput *po, pulse_output_set_volume(gcc_unused PulseOutput *po,
G_GNUC_UNUSED const struct pa_cvolume *volume, gcc_unused const struct pa_cvolume *volume,
G_GNUC_UNUSED GError **error_r) gcc_unused GError **error_r)
{ {
return false; return false;
} }
@ -81,7 +81,7 @@ roar_output_get_volume(gcc_unused RoarOutput *roar)
bool bool
roar_output_set_volume(gcc_unused RoarOutput *roar, roar_output_set_volume(gcc_unused RoarOutput *roar,
G_GNUC_UNUSED unsigned volume) gcc_unused unsigned volume)
{ {
return true; return true;
} }
@ -94,22 +94,22 @@ GlobalEvents::Emit(gcc_unused Event event)
} }
const struct filter_plugin * const struct filter_plugin *
filter_plugin_by_name(G_GNUC_UNUSED const char *name) filter_plugin_by_name(gcc_unused const char *name)
{ {
assert(false); assert(false);
return NULL; return NULL;
} }
bool bool
pcm_volume(G_GNUC_UNUSED void *buffer, G_GNUC_UNUSED size_t length, pcm_volume(gcc_unused void *buffer, gcc_unused size_t length,
G_GNUC_UNUSED SampleFormat format, gcc_unused SampleFormat format,
G_GNUC_UNUSED int volume) gcc_unused int volume)
{ {
assert(false); assert(false);
return false; return false;
} }
int main(int argc, G_GNUC_UNUSED char **argv) int main(int argc, gcc_unused char **argv)
{ {
GError *error = NULL; GError *error = NULL;
bool success; bool success;

View File

@ -39,34 +39,34 @@
#endif #endif
void void
decoder_initialized(G_GNUC_UNUSED struct decoder *decoder, decoder_initialized(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED const AudioFormat audio_format, gcc_unused const AudioFormat audio_format,
G_GNUC_UNUSED bool seekable, gcc_unused bool seekable,
G_GNUC_UNUSED float total_time) gcc_unused float total_time)
{ {
} }
enum decoder_command enum decoder_command
decoder_get_command(G_GNUC_UNUSED struct decoder *decoder) decoder_get_command(gcc_unused struct decoder *decoder)
{ {
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
void decoder_command_finished(G_GNUC_UNUSED struct decoder *decoder) void decoder_command_finished(gcc_unused struct decoder *decoder)
{ {
} }
double decoder_seek_where(G_GNUC_UNUSED struct decoder *decoder) double decoder_seek_where(gcc_unused struct decoder *decoder)
{ {
return 1.0; return 1.0;
} }
void decoder_seek_error(G_GNUC_UNUSED struct decoder *decoder) void decoder_seek_error(gcc_unused struct decoder *decoder)
{ {
} }
size_t size_t
decoder_read(G_GNUC_UNUSED struct decoder *decoder, decoder_read(gcc_unused struct decoder *decoder,
struct input_stream *is, struct input_stream *is,
void *buffer, size_t length) void *buffer, size_t length)
{ {
@ -74,37 +74,37 @@ decoder_read(G_GNUC_UNUSED struct decoder *decoder,
} }
void void
decoder_timestamp(G_GNUC_UNUSED struct decoder *decoder, decoder_timestamp(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED double t) gcc_unused double t)
{ {
} }
enum decoder_command enum decoder_command
decoder_data(G_GNUC_UNUSED struct decoder *decoder, decoder_data(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is, gcc_unused struct input_stream *is,
const void *data, size_t datalen, const void *data, size_t datalen,
G_GNUC_UNUSED uint16_t bit_rate) gcc_unused uint16_t bit_rate)
{ {
G_GNUC_UNUSED ssize_t nbytes = write(1, data, datalen); gcc_unused ssize_t nbytes = write(1, data, datalen);
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
enum decoder_command enum decoder_command
decoder_tag(G_GNUC_UNUSED struct decoder *decoder, decoder_tag(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is, gcc_unused struct input_stream *is,
G_GNUC_UNUSED Tag &&tag) gcc_unused Tag &&tag)
{ {
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
void void
decoder_replay_gain(G_GNUC_UNUSED struct decoder *decoder, decoder_replay_gain(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED const struct replay_gain_info *replay_gain_info) gcc_unused const struct replay_gain_info *replay_gain_info)
{ {
} }
void void
decoder_mixramp(G_GNUC_UNUSED struct decoder *decoder, decoder_mixramp(gcc_unused struct decoder *decoder,
char *mixramp_start, char *mixramp_end) char *mixramp_start, char *mixramp_end)
{ {
g_free(mixramp_start); g_free(mixramp_start);
@ -114,20 +114,20 @@ decoder_mixramp(G_GNUC_UNUSED struct decoder *decoder,
static bool empty = true; static bool empty = true;
static void static void
print_duration(unsigned seconds, G_GNUC_UNUSED void *ctx) print_duration(unsigned seconds, gcc_unused void *ctx)
{ {
g_print("duration=%d\n", seconds); g_print("duration=%d\n", seconds);
} }
static void static void
print_tag(enum tag_type type, const char *value, G_GNUC_UNUSED void *ctx) print_tag(enum tag_type type, const char *value, gcc_unused void *ctx)
{ {
g_print("[%s]=%s\n", tag_item_names[type], value); g_print("[%s]=%s\n", tag_item_names[type], value);
empty = false; empty = false;
} }
static void static void
print_pair(const char *name, const char *value, G_GNUC_UNUSED void *ctx) print_pair(const char *name, const char *value, gcc_unused void *ctx)
{ {
g_print("\"%s\"=%s\n", name, value); g_print("\"%s\"=%s\n", name, value);
} }

View File

@ -38,8 +38,8 @@
#include <unistd.h> #include <unistd.h>
static void static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_domain != NULL) if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message); g_printerr("%s: %s\n", log_domain, message);
@ -119,7 +119,7 @@ int main(int argc, char **argv)
return 2; return 2;
} }
G_GNUC_UNUSED ssize_t ignored = write(1, output, length); gcc_unused ssize_t ignored = write(1, output, length);
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -33,8 +33,8 @@
#include <stdlib.h> #include <stdlib.h>
static void static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_domain != NULL) if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message); g_printerr("%s: %s\n", log_domain, message);
@ -53,8 +53,8 @@ struct decoder {
void void
decoder_initialized(struct decoder *decoder, decoder_initialized(struct decoder *decoder,
const AudioFormat audio_format, const AudioFormat audio_format,
G_GNUC_UNUSED bool seekable, gcc_unused bool seekable,
G_GNUC_UNUSED float total_time) gcc_unused float total_time)
{ {
struct audio_format_string af_string; struct audio_format_string af_string;
@ -68,26 +68,26 @@ decoder_initialized(struct decoder *decoder,
} }
enum decoder_command enum decoder_command
decoder_get_command(G_GNUC_UNUSED struct decoder *decoder) decoder_get_command(gcc_unused struct decoder *decoder)
{ {
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
void decoder_command_finished(G_GNUC_UNUSED struct decoder *decoder) void decoder_command_finished(gcc_unused struct decoder *decoder)
{ {
} }
double decoder_seek_where(G_GNUC_UNUSED struct decoder *decoder) double decoder_seek_where(gcc_unused struct decoder *decoder)
{ {
return 1.0; return 1.0;
} }
void decoder_seek_error(G_GNUC_UNUSED struct decoder *decoder) void decoder_seek_error(gcc_unused struct decoder *decoder)
{ {
} }
size_t size_t
decoder_read(G_GNUC_UNUSED struct decoder *decoder, decoder_read(gcc_unused struct decoder *decoder,
struct input_stream *is, struct input_stream *is,
void *buffer, size_t length) void *buffer, size_t length)
{ {
@ -95,31 +95,31 @@ decoder_read(G_GNUC_UNUSED struct decoder *decoder,
} }
void void
decoder_timestamp(G_GNUC_UNUSED struct decoder *decoder, decoder_timestamp(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED double t) gcc_unused double t)
{ {
} }
enum decoder_command enum decoder_command
decoder_data(G_GNUC_UNUSED struct decoder *decoder, decoder_data(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is, gcc_unused struct input_stream *is,
const void *data, size_t datalen, const void *data, size_t datalen,
G_GNUC_UNUSED uint16_t kbit_rate) gcc_unused uint16_t kbit_rate)
{ {
G_GNUC_UNUSED ssize_t nbytes = write(1, data, datalen); gcc_unused ssize_t nbytes = write(1, data, datalen);
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
enum decoder_command enum decoder_command
decoder_tag(G_GNUC_UNUSED struct decoder *decoder, decoder_tag(gcc_unused struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is, gcc_unused struct input_stream *is,
G_GNUC_UNUSED Tag &&tag) gcc_unused Tag &&tag)
{ {
return DECODE_COMMAND_NONE; return DECODE_COMMAND_NONE;
} }
void void
decoder_replay_gain(G_GNUC_UNUSED struct decoder *decoder, decoder_replay_gain(gcc_unused struct decoder *decoder,
const struct replay_gain_info *replay_gain_info) const struct replay_gain_info *replay_gain_info)
{ {
const struct replay_gain_tuple *tuple = const struct replay_gain_tuple *tuple =
@ -135,7 +135,7 @@ decoder_replay_gain(G_GNUC_UNUSED struct decoder *decoder,
} }
void void
decoder_mixramp(G_GNUC_UNUSED struct decoder *decoder, decoder_mixramp(gcc_unused struct decoder *decoder,
char *mixramp_start, char *mixramp_end) char *mixramp_start, char *mixramp_end)
{ {
g_free(mixramp_start); g_free(mixramp_start);

View File

@ -37,7 +37,7 @@ encoder_to_stdout(Encoder &encoder)
static char buffer[32768]; static char buffer[32768];
while ((length = encoder_read(&encoder, buffer, sizeof(buffer))) > 0) { while ((length = encoder_read(&encoder, buffer, sizeof(buffer))) > 0) {
G_GNUC_UNUSED ssize_t ignored = write(1, buffer, length); gcc_unused ssize_t ignored = write(1, buffer, length);
} }
} }

View File

@ -37,14 +37,14 @@
bool bool
mixer_set_volume(gcc_unused Mixer *mixer, mixer_set_volume(gcc_unused Mixer *mixer,
G_GNUC_UNUSED unsigned volume, G_GNUC_UNUSED GError **error_r) gcc_unused unsigned volume, gcc_unused GError **error_r)
{ {
return true; return true;
} }
static void static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_domain != NULL) if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message); g_printerr("%s: %s\n", log_domain, message);

View File

@ -29,7 +29,7 @@
static EventLoop *event_loop; static EventLoop *event_loop;
static void static void
exit_signal_handler(G_GNUC_UNUSED int signum) exit_signal_handler(gcc_unused int signum)
{ {
event_loop->Break(); event_loop->Break();
} }
@ -43,8 +43,8 @@ enum {
}; };
static void static void
my_inotify_callback(G_GNUC_UNUSED int wd, unsigned mask, my_inotify_callback(gcc_unused int wd, unsigned mask,
const char *name, G_GNUC_UNUSED void *ctx) const char *name, gcc_unused void *ctx)
{ {
g_print("mask=0x%x name='%s'\n", mask, name); g_print("mask=0x%x name='%s'\n", mask, name);
} }

View File

@ -37,8 +37,8 @@
#include <stdlib.h> #include <stdlib.h>
static void static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_domain != NULL) if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message); g_printerr("%s: %s\n", log_domain, message);

View File

@ -65,7 +65,7 @@ int main(int argc, char **argv)
Compressor_Process_int16(compressor, Compressor_Process_int16(compressor,
(int16_t *)buffer, nbytes / 2); (int16_t *)buffer, nbytes / 2);
G_GNUC_UNUSED ssize_t ignored = write(1, buffer, nbytes); gcc_unused ssize_t ignored = write(1, buffer, nbytes);
} }
Compressor_delete(compressor); Compressor_delete(compressor);

View File

@ -64,7 +64,7 @@ PcmConvert::Convert(gcc_unused const AudioFormat src_format,
} }
const struct filter_plugin * const struct filter_plugin *
filter_plugin_by_name(G_GNUC_UNUSED const char *name) filter_plugin_by_name(gcc_unused const char *name)
{ {
assert(false); assert(false);
return NULL; return NULL;

View File

@ -30,7 +30,7 @@
#include <string.h> #include <string.h>
static void static void
quit_signal_handler(G_GNUC_UNUSED int signum) quit_signal_handler(gcc_unused int signum)
{ {
on_quit(); on_quit();
} }

View File

@ -65,6 +65,6 @@ int main(int argc, char **argv)
return 2; return 2;
} }
G_GNUC_UNUSED ssize_t ignored = write(1, buffer, nbytes); gcc_unused ssize_t ignored = write(1, buffer, nbytes);
} }
} }

View File

@ -39,14 +39,14 @@ encoder_to_stdout(Encoder &encoder)
static char buffer[32768]; static char buffer[32768];
while ((length = encoder_read(&encoder, buffer, sizeof(buffer))) > 0) { while ((length = encoder_read(&encoder, buffer, sizeof(buffer))) > 0) {
G_GNUC_UNUSED ssize_t ignored = write(1, buffer, length); gcc_unused ssize_t ignored = write(1, buffer, length);
} }
} }
int int
main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) main(gcc_unused int argc, gcc_unused char **argv)
{ {
G_GNUC_UNUSED bool success; gcc_unused bool success;
/* create the encoder */ /* create the encoder */

View File

@ -35,8 +35,8 @@
#include <stdlib.h> #include <stdlib.h>
static void static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data) const gchar *message, gcc_unused gpointer user_data)
{ {
if (log_domain != NULL) if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message); g_printerr("%s: %s\n", log_domain, message);