sed-devel
[Top][All Lists]
Advanced

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

[PATCH] maint: update to work with GCC7's


From: Jim Meyering
Subject: [PATCH] maint: update to work with GCC7's
Date: Wed, 22 Nov 2017 19:25:31 -0800

FYI, I've just pushed this:

maint: update to work with GCC7's -Werror=implicit-fallthrough=
* sed/sed.h (FALLTHROUGH): Define.
* sed/execute.c (execute_program): Use new FALLTHROUGH macro in place
of each comment.
* sed/compile.c (mark_subst_opts, compile_program): Likewise.
---
 sed/compile.c | 8 ++++----
 sed/execute.c | 4 ++--
 sed/sed.h     | 8 ++++++++
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/sed/compile.c b/sed/compile.c
index 99292a3..53a1ce9 100644
--- a/sed/compile.c
+++ b/sed/compile.c
@@ -658,7 +658,7 @@ mark_subst_opts (struct subst *cmd)
       case CLOSE_BRACE:
       case '#':
         savchar(ch);
-        /* Fall Through */
+        FALLTHROUGH;
       case EOF:
       case '\n':
       case ';':
@@ -667,7 +667,7 @@ mark_subst_opts (struct subst *cmd)
       case '\r':
         if (inchar() == '\n')
           return flags;
-        /* FALLTHROUGH */
+        FALLTHROUGH;

       default:
         bad_prog(_(UNKNOWN_S_OPT));
@@ -1068,7 +1068,7 @@ compile_program(struct vector *vector)
            case 'e': case 'F': case 'v': case 'z': case 'L':
            case 'Q': case 'T': case 'R': case 'W':
              bad_command(ch);
-             /* FALLTHROUGH */
+             FALLTHROUGH;

             case 'a': case 'i': case 'l':
             case '=': case 'r':
@@ -1181,7 +1181,7 @@ compile_program(struct vector *vector)
         case 'q':
           if (cur_cmd->a2)
             bad_prog(_(ONE_ADDR));
-          /* Fall through */
+          FALLTHROUGH;

         case 'L':
         case 'l':
diff --git a/sed/execute.c b/sed/execute.c
index 2302a1e..0d8fa2c 100644
--- a/sed/execute.c
+++ b/sed/execute.c
@@ -1324,7 +1324,7 @@ execute_program(struct vector *vec, struct input *input)
                             &output_file);
               /* POSIX.2 is silent about c starting a new cycle,
                  but it seems to be expected (and make sense). */
-              /* Fall Through */
+              FALLTHROUGH;
             case 'd':
               return -1;

@@ -1480,7 +1480,7 @@ execute_program(struct vector *vec, struct input *input)
                 output_line(line.active, line.length, line.chomped,
                             &output_file);
               dump_append_queue();
-              /* FALLTHROUGH */
+              FALLTHROUGH;

             case 'Q':
               return cur_cmd->x.int_arg == -1 ? 0 : cur_cmd->x.int_arg;
diff --git a/sed/sed.h b/sed/sed.h
index 7510b0a..c65f6f7 100644
--- a/sed/sed.h
+++ b/sed/sed.h
@@ -278,3 +278,11 @@ extern void cancel_cleanup (void);
 #else
 # define IF_LINT(Code) /* empty */
 #endif
+
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+#  define FALLTHROUGH ((void) 0)
+# else
+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif
-- 
2.14.1.729.g59c0ea183




reply via email to

[Prev in Thread] Current Thread [Next in Thread]