From 84a9af2ee984f30aa861dbe34cbf92f2207b0e9f Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 3 May 2009 15:14:31 +0200 Subject: [PATCH] make use of gcc's __attribute__ extension --- src/ncmpcpp.cpp | 2 +- src/status.h | 2 +- src/window.cpp | 3 +-- src/window.h | 8 ++++++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 574ffba3..7373fffe 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -1344,7 +1344,7 @@ int main(int argc, char *argv[]) if (newpos > 0 && newpos < 100) Mpd->Seek(s->GetTotalLength()*newpos/100.0); else - ShowMessage("Out of bounds, 1-99 possible for %, %d given.", newpos); + ShowMessage("Out of bounds, 1-99 possible for %%, %d given.", newpos); } UpdateStatusImmediately = 1; } diff --git a/src/status.h b/src/status.h index e9d19074..b8d1d6fb 100644 --- a/src/status.h +++ b/src/status.h @@ -35,7 +35,7 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges, void *); void NcmpcppErrorCallback(MPD::Connection *, int, const char *, void *); Window &Statusbar(); -void ShowMessage(const char *, ...); +void ShowMessage(const char *, ...) GNUC_PRINTF(1, 2); void StatusbarGetStringHelper(const std::wstring &); void StatusbarApplyFilterImmediately(const std::wstring &); diff --git a/src/window.cpp b/src/window.cpp index 3af43280..8024f32c 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -33,7 +33,7 @@ using namespace NCurses; using std::string; using std::wstring; -void NCurses::InitScreen(const char *window_title, bool enable_colors) +void NCurses::InitScreen(GNUC_UNUSED const char *window_title, bool enable_colors) { const int ColorsTable[] = { @@ -44,7 +44,6 @@ void NCurses::InitScreen(const char *window_title, bool enable_colors) # ifdef XCURSES Xinitscr(1, const_cast(&window_title)); # else - window_title = 0; // silence compiler initscr(); # endif // XCURSES if (has_colors() && enable_colors) diff --git a/src/window.h b/src/window.h index 5aca3c20..bf252f6e 100644 --- a/src/window.h +++ b/src/window.h @@ -31,6 +31,14 @@ #include #include +#if defined(__GNUC__) && __GNUC__ >= 3 +# define GNUC_UNUSED __attribute__((unused)) +# define GNUC_PRINTF(a, b) __attribute__((format(printf, a, b))) +#else +# define GNUC_UNUSED +# define GNUC_PRINTF(a, b) +#endif + #ifdef USE_PDCURSES # undef KEY_BACKSPACE # define KEY_BACKSPACE 8