[02/17] sim: bfin: gui: fix -Wunused-but-set-variable warnings

Message ID 20231207035937.14920-2-vapier@gentoo.org
State New
Series [01/17] sim: arm: fix -Wunused-but-set-variable warnings |

Commit Message

Mike Frysinger Dec. 7, 2023, 3:59 a.m. UTC
  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(...) ;
+# define _BFIN_GUI_INLINE ATTRIBUTE_UNUSED static inline
+# define _BFIN_GUI_STUB(val) { return val; }
 enum gui_color {
@@ -30,21 +37,24 @@  enum gui_color {
-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);
+enum gui_color bfin_gui_color (const char *color)
-unsigned bfin_gui_update (void *state, const void *source, unsigned nr_bytes);
+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)
-# define bfin_gui_color(...)		0
-# define bfin_gui_color_depth(...)	0
-# define bfin_gui_setup(...)		NULL
-# define bfin_gui_update(...)		0
+unsigned bfin_gui_update (void *state, const void *source, unsigned nr_bytes)
+#undef _BFIN_GUI_STUB