[gtk/gtk-3-24] gtk-demo/main: Suppress implicit fallthru warning



commit d9f08c85f40758f31934560abfd2af3b29a8c722
Author: Daniel Boles <dboles src gmail com>
Date:   Fri Oct 12 22:09:42 2018 +0100

    gtk-demo/main: Suppress implicit fallthru warning
    
    Comments matched to reassure the compiler that fallthrough is
    intentional are supposed to precede the case or default keywords, at
    least in GCC, so the one here did not suppress the warning with GCC. We
    can just the if condition and put the comment at the end to solve that.
    
    https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

 demos/gtk-demo/main.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 616c33f38c..0413948b42 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -762,15 +762,14 @@ load_file (const gchar *demoname,
           /* Skipping blank lines */
           while (g_ascii_isspace (*p))
             p++;
-          if (*p)
-            {
-              p = lines[i];
-              state++;
-              /* Fall through */
-            }
-          else
+
+          if (!*p)
             break;
 
+          p = lines[i];
+          state++;
+          /* Fall through */
+
         case 3:
           /* Reading program body */
           gtk_text_buffer_insert (source_buffer, &start, p, -1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]