make use of gcc's __attribute__ extension

This commit is contained in:
Andrzej Rybczak
2009-05-03 15:14:31 +02:00
parent 72acc09b26
commit 84a9af2ee9
4 changed files with 11 additions and 4 deletions

View File

@@ -1344,7 +1344,7 @@ int main(int argc, char *argv[])
if (newpos > 0 && newpos < 100) if (newpos > 0 && newpos < 100)
Mpd->Seek(s->GetTotalLength()*newpos/100.0); Mpd->Seek(s->GetTotalLength()*newpos/100.0);
else 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; UpdateStatusImmediately = 1;
} }

View File

@@ -35,7 +35,7 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges, void *);
void NcmpcppErrorCallback(MPD::Connection *, int, const char *, void *); void NcmpcppErrorCallback(MPD::Connection *, int, const char *, void *);
Window &Statusbar(); Window &Statusbar();
void ShowMessage(const char *, ...); void ShowMessage(const char *, ...) GNUC_PRINTF(1, 2);
void StatusbarGetStringHelper(const std::wstring &); void StatusbarGetStringHelper(const std::wstring &);
void StatusbarApplyFilterImmediately(const std::wstring &); void StatusbarApplyFilterImmediately(const std::wstring &);

View File

@@ -33,7 +33,7 @@ using namespace NCurses;
using std::string; using std::string;
using std::wstring; 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[] = const int ColorsTable[] =
{ {
@@ -44,7 +44,6 @@ void NCurses::InitScreen(const char *window_title, bool enable_colors)
# ifdef XCURSES # ifdef XCURSES
Xinitscr(1, const_cast<char **>(&window_title)); Xinitscr(1, const_cast<char **>(&window_title));
# else # else
window_title = 0; // silence compiler
initscr(); initscr();
# endif // XCURSES # endif // XCURSES
if (has_colors() && enable_colors) if (has_colors() && enable_colors)

View File

@@ -31,6 +31,14 @@
#include <vector> #include <vector>
#include <string> #include <string>
#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 #ifdef USE_PDCURSES
# undef KEY_BACKSPACE # undef KEY_BACKSPACE
# define KEY_BACKSPACE 8 # define KEY_BACKSPACE 8