From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 02/17] sim: bfin: gui: fix -Wunused-but-set-variable warnings
Date: Wed, 6 Dec 2023 20:59:22 -0700 [thread overview]
Message-ID: <20231207035937.14920-2-vapier@gentoo.org> (raw)
In-Reply-To: <20231207035937.14920-1-vapier@gentoo.org>
Rework the code to use static inline functions when it's disabled
rather than macros so the compiler knows the various function args
are always used. The ifdef macros are a bit ugly, but get the job
done without duplicating the function prototypes.
---
sim/bfin/gui.h | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/sim/bfin/gui.h b/sim/bfin/gui.h
index ef363b599861..daf4398694b4 100644
--- a/sim/bfin/gui.h
+++ b/sim/bfin/gui.h
@@ -21,7 +21,14 @@
#ifndef BFIN_GUI_H
#define BFIN_GUI_H
+/* These macros are ugly. */
#ifdef HAVE_SDL
+# define _BFIN_GUI_INLINE
+# define _BFIN_GUI_STUB(...) ;
+#else
+# define _BFIN_GUI_INLINE ATTRIBUTE_UNUSED static inline
+# define _BFIN_GUI_STUB(val) { return val; }
+#endif
enum gui_color {
GUI_COLOR_RGB_565,
@@ -30,21 +37,24 @@ enum gui_color {
GUI_COLOR_BGR_888,
GUI_COLOR_RGBA_8888,
};
-enum gui_color bfin_gui_color (const char *color);
-int bfin_gui_color_depth (enum gui_color color);
-
-void *bfin_gui_setup (void *state, int enabled, int height, int width,
- enum gui_color color);
+_BFIN_GUI_INLINE
+enum gui_color bfin_gui_color (const char *color)
+ _BFIN_GUI_STUB(GUI_COLOR_RGB_565)
-unsigned bfin_gui_update (void *state, const void *source, unsigned nr_bytes);
+_BFIN_GUI_INLINE
+int bfin_gui_color_depth (enum gui_color color)
+ _BFIN_GUI_STUB(0)
-#else
+_BFIN_GUI_INLINE
+void *bfin_gui_setup (void *state, int enabled, int height, int width,
+ enum gui_color color)
+ _BFIN_GUI_STUB(NULL)
-# define bfin_gui_color(...) 0
-# define bfin_gui_color_depth(...) 0
-# define bfin_gui_setup(...) NULL
-# define bfin_gui_update(...) 0
+_BFIN_GUI_INLINE
+unsigned bfin_gui_update (void *state, const void *source, unsigned nr_bytes)
+ _BFIN_GUI_STUB(0)
-#endif
+#undef _BFIN_GUI_INLINE
+#undef _BFIN_GUI_STUB
#endif
--
2.43.0
next prev parent reply other threads:[~2023-12-07 3:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 3:59 [PATCH 01/17] sim: arm: " Mike Frysinger
2023-12-07 3:59 ` Mike Frysinger [this message]
2023-12-07 3:59 ` [PATCH 03/17] sim: bfin: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 04/17] sim: cris: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 05/17] sim: d10v: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 06/17] sim: erc32: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 07/17] sim: frv: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 08/17] sim: ft32: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 09/17] sim: h8300: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 10/17] sim: m68hc11: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 11/17] sim: mcore: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 12/17] sim: mips: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 13/17] sim: mn10300: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 14/17] sim: msp430: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 15/17] sim: sh: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 16/17] sim: v850: " Mike Frysinger
2023-12-07 3:59 ` [PATCH 17/17] sim: warnings: enable -Wunused-but-set-variable Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231207035937.14920-2-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).