common: Silence -Wunused-function clang warnings. (#3127)

v2: Use pragma instead of [[maybe_unused]].
v3: Silence warnings with older clang versions too.
This commit is contained in:
orbea 2019-10-12 19:14:40 +00:00 committed by arcum42
parent 7bf920b07c
commit 293983ea71
2 changed files with 16 additions and 2 deletions

View File

@ -34,6 +34,11 @@
// on what it's built for. // on what it's built for.
// //
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
#endif
static GtkWidget *ps_gtk_hbox_new(int padding = 5) static GtkWidget *ps_gtk_hbox_new(int padding = 5)
{ {
#if GTK_MAJOR_VERSION < 3 #if GTK_MAJOR_VERSION < 3
@ -131,3 +136,7 @@ static void pcsx2_message(const wchar_t *fmt, ...)
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
} }
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -69,16 +69,21 @@ static __inline__ __attribute__((always_inline)) unsigned long long xgetbv(unsig
// Rotate instruction // Rotate instruction
#if defined(__clang__) && __clang_major__ < 9 #if defined(__clang__) && __clang_major__ < 9
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
// Seriously what is so complicated to provided this bunch of intrinsics in clangs. // Seriously what is so complicated to provided this bunch of intrinsics in clangs.
[[maybe_unused]] static unsigned int _rotr(unsigned int x, int s) static unsigned int _rotr(unsigned int x, int s)
{ {
return (x >> s) | (x << (32 - s)); return (x >> s) | (x << (32 - s));
} }
[[maybe_unused]] static unsigned int _rotl(unsigned int x, int s) static unsigned int _rotl(unsigned int x, int s)
{ {
return (x << s) | (x >> (32 - s)); return (x << s) | (x >> (32 - s));
} }
#pragma clang diagnostic pop
#endif #endif
// Not correctly defined in GCC4.8 and below ! (dunno for VS) // Not correctly defined in GCC4.8 and below ! (dunno for VS)