From: Max Kellermann Date: Fri, 8 Nov 2013 18:43:01 +0000 (+0100) Subject: *: use Compiler.h macros instead of glib.h X-Git-Tag: v0.22~16 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d0d23a29f2f710e39ae14be009656f7fc2c30560;p=ncmpc.git *: use Compiler.h macros instead of glib.h --- diff --git a/src/gidle.c b/src/gidle.c index af7457d..95ac646 100644 --- a/src/gidle.c +++ b/src/gidle.c @@ -27,11 +27,13 @@ */ #include "gidle.h" +#include "Compiler.h" #include #include #include + #include #include #include @@ -265,7 +267,7 @@ mpd_glib_recv(struct mpd_glib_source *source) } static gboolean -mpd_glib_source_callback(G_GNUC_UNUSED GIOChannel *_source, +mpd_glib_source_callback(gcc_unused GIOChannel *_source, GIOCondition condition, gpointer data) { struct mpd_glib_source *source = data; diff --git a/src/lirc.c b/src/lirc.c index 4e67508..277d70f 100644 --- a/src/lirc.c +++ b/src/lirc.c @@ -17,9 +17,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include #include "lirc.h" #include "ncmpc.h" +#include "Compiler.h" + +#include static struct lirc_config *lc = NULL; @@ -47,8 +49,8 @@ void ncmpc_lirc_close() } gboolean -lirc_event(G_GNUC_UNUSED GIOChannel *source, - G_GNUC_UNUSED GIOCondition condition, G_GNUC_UNUSED gpointer data) +lirc_event(gcc_unused GIOChannel *source, + gcc_unused GIOCondition condition, gcc_unused gpointer data) { char *code, *txt; command_t cmd; diff --git a/src/main.c b/src/main.c index d35fda4..d49d40b 100644 --- a/src/main.c +++ b/src/main.c @@ -114,14 +114,14 @@ exit_and_cleanup(void) #ifndef WIN32 static void -catch_sigint(G_GNUC_UNUSED int sig) +catch_sigint(gcc_unused int sig) { g_main_loop_quit(main_loop); } static void -catch_sigcont(G_GNUC_UNUSED int sig) +catch_sigcont(gcc_unused int sig) { char irrelevant = 'a'; if (1 != write(sigwinch_pipes[1], &irrelevant, 1)) @@ -137,8 +137,8 @@ sigstop(void) } static gboolean -sigwinch_event(G_GNUC_UNUSED GIOChannel *source, - G_GNUC_UNUSED GIOCondition condition, G_GNUC_UNUSED gpointer data) +sigwinch_event(gcc_unused GIOChannel *source, + gcc_unused GIOCondition condition, gcc_unused gpointer data) { char ignoreme[64]; if (1 > read(sigwinch_pipes[0], ignoreme, 64)) @@ -152,7 +152,7 @@ sigwinch_event(G_GNUC_UNUSED GIOChannel *source, } static void -catch_sigwinch(G_GNUC_UNUSED int sig) +catch_sigwinch(gcc_unused int sig) { char irrelevant = 'a'; if (1 != write(sigwinch_pipes[1], &irrelevant, 1)) @@ -162,9 +162,9 @@ catch_sigwinch(G_GNUC_UNUSED int sig) static void idle_callback(enum mpd_error error, - G_GNUC_UNUSED enum mpd_server_error server_error, + gcc_unused enum mpd_server_error server_error, const char *message, enum mpd_idle events, - G_GNUC_UNUSED void *ctx); + gcc_unused void *ctx); static gboolean timer_mpd_update(gpointer data); @@ -285,7 +285,7 @@ default_settings_name(void) * broken. It tries to recover by reconnecting periodically. */ static gboolean -timer_reconnect(G_GNUC_UNUSED gpointer data) +timer_reconnect(gcc_unused gpointer data) { bool success; struct mpd_connection *connection; @@ -418,7 +418,7 @@ idle_callback(enum mpd_error error, enum mpd_server_error server_error, } static gboolean -timer_mpd_update(G_GNUC_UNUSED gpointer data) +timer_mpd_update(gcc_unused gpointer data) { do_mpd_update(); @@ -461,9 +461,9 @@ int do_input_event(command_t cmd) } static gboolean -keyboard_event(G_GNUC_UNUSED GIOChannel *source, - G_GNUC_UNUSED GIOCondition condition, - G_GNUC_UNUSED gpointer data) +keyboard_event(gcc_unused GIOChannel *source, + gcc_unused GIOCondition condition, + gcc_unused gpointer data) { command_t cmd; @@ -483,7 +483,7 @@ keyboard_event(G_GNUC_UNUSED GIOChannel *source, * message every 10 seconds. */ static gboolean -timer_check_key_bindings(G_GNUC_UNUSED gpointer data) +timer_check_key_bindings(gcc_unused gpointer data) { char buf[256]; #ifdef ENABLE_KEYDEF_SCREEN @@ -526,7 +526,7 @@ main(int argc, const char *argv[]) #endif #ifdef ENABLE_LOCALE #ifndef ENABLE_NLS - G_GNUC_UNUSED + gcc_unused #endif const char *charset = NULL; #endif diff --git a/src/plugin.c b/src/plugin.c index fcfaea9..29e4ffc 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -18,6 +18,7 @@ */ #include "plugin.h" +#include "Compiler.h" #include #include @@ -82,7 +83,7 @@ register_plugin(struct plugin_list *list, char *path) return true; } -static gint +static gint plugin_compare_func_alpha(gconstpointer plugin1, gconstpointer plugin2) { return strcmp(* (char * const *) plugin1, * (char * const *) plugin2); @@ -173,8 +174,8 @@ plugin_eof(struct plugin_cycle *cycle, struct plugin_pipe *p) } static gboolean -plugin_data(G_GNUC_UNUSED GIOChannel *source, - G_GNUC_UNUSED GIOCondition condition, gpointer data) +plugin_data(gcc_unused GIOChannel *source, + gcc_unused GIOCondition condition, gpointer data) { struct plugin_cycle *cycle = data; struct plugin_pipe *p = NULL; diff --git a/src/screen_artist.c b/src/screen_artist.c index d488a7b..5ff6f9b 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -335,7 +335,7 @@ screen_artist_resize(int cols, int rows) */ static void paint_artist_callback(WINDOW *w, unsigned i, - G_GNUC_UNUSED unsigned y, unsigned width, + gcc_unused unsigned y, unsigned width, bool selected, void *data) { GPtrArray *list = data; @@ -353,7 +353,7 @@ paint_artist_callback(WINDOW *w, unsigned i, */ static void paint_album_callback(WINDOW *w, unsigned i, - G_GNUC_UNUSED unsigned y, unsigned width, + gcc_unused unsigned y, unsigned width, bool selected, void *data) { GPtrArray *list = data; diff --git a/src/screen_browser.c b/src/screen_browser.c index 936bd1f..6c802f6 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -249,7 +249,7 @@ browser_handle_enter(struct screen_browser *browser, struct mpdclient *c) static bool browser_select_entry(struct mpdclient *c, struct filelist_entry *entry, - G_GNUC_UNUSED gboolean toggle) + gcc_unused gboolean toggle) { assert(entry != NULL); assert(entry->entity != NULL); diff --git a/src/screen_browser.h b/src/screen_browser.h index b30a1da..ad840dd 100644 --- a/src/screen_browser.h +++ b/src/screen_browser.h @@ -48,8 +48,8 @@ screen_browser_sync_highlights(struct filelist *fl, #include static inline void -screen_browser_sync_highlights(G_GNUC_UNUSED struct filelist *fl, - G_GNUC_UNUSED const struct mpdclient_playlist *playlist) +screen_browser_sync_highlights(gcc_unused struct filelist *fl, + gcc_unused const struct mpdclient_playlist *playlist) { } diff --git a/src/screen_chat.c b/src/screen_chat.c index 2b887ba..f30da93 100644 --- a/src/screen_chat.c +++ b/src/screen_chat.c @@ -196,7 +196,7 @@ screen_chat_cmd(struct mpdclient *c, command_t cmd) } static const char * -screen_chat_title(G_GNUC_UNUSED char *s, G_GNUC_UNUSED size_t size) +screen_chat_title(gcc_unused char *s, gcc_unused size_t size) { return _("Chat"); } diff --git a/src/screen_help.c b/src/screen_help.c index 5441b7b..da2d3e9 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -199,7 +199,7 @@ static const struct help_text_row help_text[] = { static struct list_window *lw; static const char * -list_callback(unsigned i, G_GNUC_UNUSED void *data) +list_callback(unsigned i, gcc_unused void *data) { const struct help_text_row *row = &help_text[i]; @@ -236,7 +236,7 @@ help_exit(void) static const char * -help_title(G_GNUC_UNUSED char *str, G_GNUC_UNUSED size_t size) +help_title(gcc_unused char *str, gcc_unused size_t size) { return _("Help"); } @@ -244,8 +244,8 @@ help_title(G_GNUC_UNUSED char *str, G_GNUC_UNUSED size_t size) static void screen_help_paint_callback(WINDOW *w, unsigned i, unsigned y, unsigned width, - G_GNUC_UNUSED bool selected, - G_GNUC_UNUSED void *data) + gcc_unused bool selected, + gcc_unused void *data) { const struct help_text_row *row = &help_text[i]; @@ -281,7 +281,7 @@ help_paint(void) } static bool -help_cmd(G_GNUC_UNUSED struct mpdclient *c, command_t cmd) +help_cmd(gcc_unused struct mpdclient *c, command_t cmd) { if (list_window_scroll_cmd(lw, cmd)) { help_paint(); diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 32791b8..ad78c38 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -25,6 +25,7 @@ #include "conf.h" #include "screen.h" #include "screen_utils.h" +#include "Compiler.h" #include #include @@ -42,21 +43,24 @@ static unsigned command_n_commands = 0; * the position of the "apply" item. It's the same as command_n_commands, * because array subscripts start at 0, while numbers of items start at 1. */ -static G_GNUC_PURE inline unsigned +gcc_pure +static inline unsigned command_item_apply(void) { return command_n_commands; } /** the position of the "apply and save" item */ -static G_GNUC_PURE inline unsigned +gcc_pure +static inline unsigned command_item_save(void) { return command_item_apply() + 1; } /** the number of items in the "command" view */ -static G_GNUC_PURE inline unsigned +gcc_pure +static inline unsigned command_length(void) { return command_item_save() + 1; @@ -73,28 +77,32 @@ static int subcmd = -1; static unsigned subcmd_n_keys = 0; /** The position of the up ("[..]") item */ -static G_GNUC_CONST inline unsigned +gcc_const +static inline unsigned subcmd_item_up(void) { return 0; } /** The position of the "add a key" item */ -static G_GNUC_PURE inline unsigned +gcc_pure +static inline unsigned subcmd_item_add(void) { return subcmd_n_keys + 1; } /** The number of items in the list_window, if there's a command being edited */ -static G_GNUC_PURE inline unsigned +gcc_pure +static inline unsigned subcmd_length(void) { return subcmd_item_add() + 1; } /** Check whether a given item is a key */ -static G_GNUC_PURE inline bool +gcc_pure +static inline bool subcmd_item_is_key(unsigned i) { return (i > subcmd_item_up() && i < subcmd_item_add()); @@ -104,7 +112,8 @@ subcmd_item_is_key(unsigned i) * Convert an item id (as in lw->selected) into a "key id", which is an array * subscript to cmds[subcmd].keys. */ -static G_GNUC_CONST inline unsigned +gcc_const +static inline unsigned subcmd_item_to_key_id(unsigned i) { return i - 1; @@ -306,7 +315,7 @@ add_key(int cmd_index) } static const char * -list_callback(unsigned idx, G_GNUC_UNUSED void *data) +list_callback(unsigned idx, gcc_unused void *data) { static char buf[256]; @@ -379,7 +388,7 @@ keydef_exit(void) } static void -keydef_open(G_GNUC_UNUSED struct mpdclient *c) +keydef_open(gcc_unused struct mpdclient *c) { if (cmds == NULL) { command_definition_t *current_cmds = get_command_definitions(); @@ -426,7 +435,7 @@ keydef_paint(void) } static bool -keydef_cmd(G_GNUC_UNUSED struct mpdclient *c, command_t cmd) +keydef_cmd(gcc_unused struct mpdclient *c, command_t cmd) { if (cmd == CMD_LIST_RANGE_SELECT) return false; diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 066fe6e..cda976e 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -195,7 +195,7 @@ screen_lyrics_set(const GString *str) static void screen_lyrics_callback(const GString *result, const bool success, - const char *plugin_name, G_GNUC_UNUSED void *data) + const char *plugin_name, gcc_unused void *data) { assert(current.loader != NULL); @@ -224,7 +224,7 @@ screen_lyrics_callback(const GString *result, const bool success, } static gboolean -screen_lyrics_timeout_callback(gpointer G_GNUC_UNUSED data) +screen_lyrics_timeout_callback(gpointer gcc_unused data) { plugin_stop(current.loader); current.loader = NULL; diff --git a/src/screen_outputs.c b/src/screen_outputs.c index 888aa34..5ec897d 100644 --- a/src/screen_outputs.c +++ b/src/screen_outputs.c @@ -89,7 +89,7 @@ toggle_output(struct mpdclient *c, unsigned int output_index) } static void -clear_output_element(gpointer data, G_GNUC_UNUSED gpointer user_data) +clear_output_element(gpointer data, gcc_unused gpointer user_data) { mpd_output_free(data); } @@ -170,15 +170,15 @@ outputs_close(void) } static const char * -outputs_title(G_GNUC_UNUSED char *str, G_GNUC_UNUSED size_t size) +outputs_title(gcc_unused char *str, gcc_unused size_t size) { return _("Outputs"); } static void screen_outputs_paint_callback(WINDOW *w, unsigned i, - G_GNUC_UNUSED unsigned y, unsigned width, - bool selected, G_GNUC_UNUSED void *data) + gcc_unused unsigned y, unsigned width, + bool selected, gcc_unused void *data) { const struct mpd_output *output; diff --git a/src/screen_queue.c b/src/screen_queue.c index 71f19a5..87cdc63 100644 --- a/src/screen_queue.c +++ b/src/screen_queue.c @@ -35,6 +35,7 @@ #include "screen_utils.h" #include "screen_song.h" #include "screen_lyrics.h" +#include "Compiler.h" #ifndef NCMPC_MINI #include "hscroll.h" @@ -118,7 +119,7 @@ screen_queue_restore_selection(void) } static const char * -screen_queue_lw_callback(unsigned idx, G_GNUC_UNUSED void *data) +screen_queue_lw_callback(unsigned idx, gcc_unused void *data) { static char songname[MAX_SONG_LENGTH]; struct mpd_song *song; @@ -159,7 +160,7 @@ center_playing_item(const struct mpd_status *status, bool center_cursor) list_window_fetch_cursor(lw); } -G_GNUC_PURE +gcc_pure static int get_current_song_id(const struct mpd_status *status) { @@ -187,7 +188,7 @@ screen_queue_song_change(const struct mpd_status *status) #ifndef NCMPC_MINI static void -save_pre_completion_cb(GCompletion *gcmp, G_GNUC_UNUSED gchar *line, +save_pre_completion_cb(GCompletion *gcmp, gcc_unused gchar *line, void *data) { completion_callback_data_t *tmp = (completion_callback_data_t *)data; @@ -202,9 +203,9 @@ save_pre_completion_cb(GCompletion *gcmp, G_GNUC_UNUSED gchar *line, } static void -save_post_completion_cb(G_GNUC_UNUSED GCompletion *gcmp, - G_GNUC_UNUSED gchar *line, GList *items, - G_GNUC_UNUSED void *data) +save_post_completion_cb(gcc_unused GCompletion *gcmp, + gcc_unused gchar *line, GList *items, + gcc_unused void *data) { if (g_list_length(items) >= 1) screen_display_completion_list(items); @@ -514,7 +515,7 @@ screen_queue_title(char *str, size_t size) static void screen_queue_paint_callback(WINDOW *w, unsigned i, unsigned y, unsigned width, - bool selected, G_GNUC_UNUSED void *data) + bool selected, gcc_unused void *data) { const struct mpd_song *song; struct hscroll *row_hscroll; diff --git a/src/screen_search.c b/src/screen_search.c index 3abda9d..42253d0 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -107,7 +107,7 @@ static const char *const help_text[] = { /* search info */ static const char * -lw_search_help_callback(unsigned idx, G_GNUC_UNUSED void *data) +lw_search_help_callback(unsigned idx, gcc_unused void *data) { assert(idx < G_N_ELEMENTS(help_text)); @@ -377,7 +377,7 @@ screen_search_quit(void) } static void -screen_search_open(G_GNUC_UNUSED struct mpdclient *c) +screen_search_open(gcc_unused struct mpdclient *c) { // if( pattern==NULL ) // search_new(screen, c); diff --git a/src/screen_song.c b/src/screen_song.c index 156486a..c2b6c3c 100644 --- a/src/screen_song.c +++ b/src/screen_song.c @@ -124,7 +124,7 @@ screen_song_repaint(void) } static const char * -screen_song_list_callback(unsigned idx, G_GNUC_UNUSED void *data) +screen_song_list_callback(unsigned idx, gcc_unused void *data) { assert(idx < current.lines->len); @@ -177,7 +177,7 @@ screen_song_resize(int cols, int rows) } static const char * -screen_song_title(G_GNUC_UNUSED char *str, G_GNUC_UNUSED size_t size) +screen_song_title(gcc_unused char *str, gcc_unused size_t size) { return _("Song viewer"); } diff --git a/src/screen_text.c b/src/screen_text.c index 03a8fc5..44fe492 100644 --- a/src/screen_text.c +++ b/src/screen_text.c @@ -94,7 +94,7 @@ screen_text_list_callback(unsigned idx, void *data) bool screen_text_cmd(struct screen_text *text, - G_GNUC_UNUSED struct mpdclient *c, command_t cmd) + gcc_unused struct mpdclient *c, command_t cmd) { if (list_window_scroll_cmd(text->lw, cmd)) { screen_text_repaint(text); diff --git a/src/song_paint.c b/src/song_paint.c index b0c452b..f3f3918 100644 --- a/src/song_paint.c +++ b/src/song_paint.c @@ -32,9 +32,9 @@ #include void -paint_song_row(WINDOW *w, G_GNUC_UNUSED unsigned y, unsigned width, +paint_song_row(WINDOW *w, gcc_unused unsigned y, unsigned width, bool selected, bool highlight, const struct mpd_song *song, - G_GNUC_UNUSED struct hscroll *hscroll) + gcc_unused struct hscroll *hscroll) { char buffer[width * 4];