Re: [hatari-devel] Is it me or the symbols prg option is broken ?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On sunnuntai 03 toukokuu 2015, Nicolas Pomarède wrote:
> there's a warning now in debug.c :
> 
> src/debug/breakcond.c: In function âBreakCond_DoDelayedActionsâ:
> src/debug/breakcond.c:1616:7: attention : variable âremovedâ set but not
> used [-Wunused-but-set-variable]
>    bool removed;
> 
> Problem is that "removed" is only used in an "assert" statement.

What do you think of the attached patch?


	- Eero
diff -r 7f67e8a74f2e src/debug/breakcond.c
--- a/src/debug/breakcond.c	Sun May 03 21:43:56 2015 +0300
+++ b/src/debug/breakcond.c	Mon May 04 23:43:53 2015 +0300
@@ -1612,8 +1612,8 @@
  */
 static int BreakCond_DoDelayedActions(bc_breakpoints_t *bps, int triggered)
 {
+	ASSERT_VARIABLE(bool removed);
 	bc_options_t *options;
-	bool removed;
 	int i;
 
 	assert(!bps->delayed_change);
diff -r 7f67e8a74f2e src/includes/main.h
--- a/src/includes/main.h	Sun May 03 21:43:56 2015 +0300
+++ b/src/includes/main.h	Mon May 04 23:43:53 2015 +0300
@@ -27,6 +27,13 @@
 # define unlikely(x)    (x)
 #endif
 
+/* avoid warnings with variables used only in asserts */
+#ifdef NDEBUG
+# define ASSERT_VARIABLE(x)
+#else
+# define ASSERT_VARIABLE(x) x
+#endif
+
 #ifdef WIN32
 #define PATHSEP '\\'
 #else


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/