[vte] all: Fix implicit-fallthrough warnings



commit 28b24ba1850b1dad4215697a58f91c8313ce1b23
Author: Christian Persch <chpe src gnome org>
Date:   Thu Sep 27 18:07:50 2018 +0200

    all: Fix implicit-fallthrough warnings
    
    Use [[fallthrough]] attribute to make it clear where
    fallthrough is expected.

 configure.ac      | 2 ++
 src/parser-cat.cc | 4 ++--
 src/parser.cc     | 3 ++-
 src/utf8-test.cc  | 4 ++--
 src/vte.cc        | 4 ++--
 5 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index fdb77688..a597bdcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -183,6 +183,7 @@ m4_define([compiler_flags_common],[ dnl
 m4_define([compiler_flags_only_c],[ dnl
   -Waggregate-return dnl
   -Wimplicit dnl
+  -Wimplicit-fallthrough=3 dnl
   -Wnested-externs dnl
   -Wold-style-definition dnl
   -Wstrict-prototypes dnl
@@ -190,6 +191,7 @@ m4_define([compiler_flags_only_c],[ dnl
 
 m4_define([compiler_flags_only_cxx],[ dnl
   -Wstrict-null-sentinel dnl
+  -Wimplicit-fallthrough=5 dnl
   -fno-rtti dnl
   -fno-exceptions dnl
   -fvisibility=hidden dnl
diff --git a/src/parser-cat.cc b/src/parser-cat.cc
index 5c79b34e..8f262a6e 100644
--- a/src/parser-cat.cc
+++ b/src/parser-cat.cc
@@ -353,11 +353,11 @@ process_file_utf8(int fd,
                                  * next round this byte *will* be consumed.
                                  */
                                 --sptr;
-                                /* [[fallthrough]]; */
+                                [[fallthrough]];
                         case vte::base::UTF8Decoder::REJECT:
                                 decoder.reset();
                                 /* Fall through to insert the U+FFFD replacement character. */
-                                /* [[fallthrough]]; */
+                                [[fallthrough]];
                         case vte::base::UTF8Decoder::ACCEPT: {
                                 auto ret = vte_parser_feed(&parser, decoder.codepoint());
                                 if (G_UNLIKELY(ret < 0)) {
diff --git a/src/parser.cc b/src/parser.cc
index 2a1b5260..ccc20980 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -936,7 +936,8 @@ static int parser_feed_to_state(struct vte_parser *parser, uint32_t raw)
                 /* Do the deferred clear and fallthrough to STATE_ESC */
                 parser_transition(parser, 0x1b /* ESC */, STATE_ESC,
                                   ACTION_CLEAR_INT);
-                /* fallthrough */
+
+                [[fallthrough]];
         case STATE_ESC:
                 switch (raw) {
                 case 0x00 ... 0x1a:        /* C0 \ { ESC } */
diff --git a/src/utf8-test.cc b/src/utf8-test.cc
index 9d1b84c4..975c5b74 100644
--- a/src/utf8-test.cc
+++ b/src/utf8-test.cc
@@ -64,12 +64,12 @@ decode(uint8_t const* in,
                          * next round this byte *will* be consumed.
                          */
                         --iptr;
-                        // [[fallthrough]]; */
+                        [[fallthrough]];
                 case vte::base::UTF8Decoder::REJECT:
                         decoder.reset();
                         state = UTF8Decoder::ACCEPT;
                         /* Fall through to insert the U+FFFD replacement character. */
-                        /* [[fallthrough]]; */
+                        [[fallthrough]];
                 case vte::base::UTF8Decoder::ACCEPT:
                         out.push_back(decoder.codepoint());
                         break;
diff --git a/src/vte.cc b/src/vte.cc
index 6e4d85d1..3580d659 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -3595,11 +3595,11 @@ Terminal::process_incoming()
                                  * next round this byte *will* be consumed.
                                  */
                                 --ip;
-                                /* [[fallthrough]]; */
+                                [[fallthrough]];
                         case vte::base::UTF8Decoder::REJECT:
                                 m_utf8_decoder.reset();
                                 /* Fall through to insert the U+FFFD replacement character. */
-                                /* [[fallthrough]]; */
+                                [[fallthrough]];
                         case vte::base::UTF8Decoder::ACCEPT: {
                                 auto rv = m_parser.feed(m_utf8_decoder.codepoint());
                                 if (G_UNLIKELY(rv < 0)) {


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