summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2017-05-17 22:51:31 -0700
committerJim Meyering <meyering@fb.com>2017-05-18 10:39:59 -0700
commitd3b51e7f02994c76b88b83857e253b4116706f91 (patch)
tree3bac126e74c5acc80a5153ea5f7822443c570d5e
parent646268f5c6472d248ae0e98960f7983656a9d0e3 (diff)
downloaddiffutils-d3b51e7f02994c76b88b83857e253b4116706f91.tar.gz
maint: update to work with GCC7's -Werror=implicit-fallthrough=
* src/system.h (FALLTHROUGH): Define. Use new FALLTHROUGH macro in place of comments * src/cmp.c: FIXME * src/diff3.c: FIXME * src/ifdef.c: FIXME * src/sdiff.c: FIXME * src/side.c: FIXME * src/util.c: FIXME
-rw-r--r--src/cmp.c2
-rw-r--r--src/diff3.c4
-rw-r--r--src/ifdef.c2
-rw-r--r--src/sdiff.c8
-rw-r--r--src/side.c2
-rw-r--r--src/system.h8
-rw-r--r--src/util.c4
7 files changed, 19 insertions, 11 deletions
diff --git a/src/cmp.c b/src/cmp.c
index 2e6f793..bc39153 100644
--- a/src/cmp.c
+++ b/src/cmp.c
@@ -516,7 +516,7 @@ cmp (void)
c0, s0, c1, s1);
}
}
- /* Fall through. */
+ FALLTHROUGH;
case type_status:
return EXIT_FAILURE;
diff --git a/src/diff3.c b/src/diff3.c
index b82c1fc..5f3c7cb 100644
--- a/src/diff3.c
+++ b/src/diff3.c
@@ -301,10 +301,10 @@ main (int argc, char **argv)
break;
case 'X':
overlap_only = true;
- /* Fall through. */
+ FALLTHROUGH;
case 'E':
flagging = true;
- /* Fall through. */
+ FALLTHROUGH;
case 'e':
incompat++;
break;
diff --git a/src/ifdef.c b/src/ifdef.c
index ad9f734..c7dae8d 100644
--- a/src/ifdef.c
+++ b/src/ifdef.c
@@ -362,7 +362,7 @@ do_printf_spec (FILE *out, char const *spec,
printint print_value = value;
size_t spec_prefix_len = f - spec - 2;
size_t pI_len = sizeof pI - 1;
-#if HAVE_C_VARARRAYS
+#if 0
char format[spec_prefix_len + pI_len + 2];
#else
char *format = xmalloc (spec_prefix_len + pI_len + 2);
diff --git a/src/sdiff.c b/src/sdiff.c
index 96ec0f5..1ae3dcb 100644
--- a/src/sdiff.c
+++ b/src/sdiff.c
@@ -918,10 +918,10 @@ edit (struct line_filter *left, char const *lname, lin lline, lin llen,
cmd0 = 'q';
break;
}
- /* Fall through. */
+ FALLTHROUGH;
default:
flush_line ();
- /* Fall through. */
+ FALLTHROUGH;
case '\n':
give_help ();
continue;
@@ -974,7 +974,7 @@ edit (struct line_filter *left, char const *lname, lin lline, lin llen,
else
fprintf (tmp, "--- %s %"pI"d,%"pI"d\n", lname, l1, l2);
}
- /* Fall through. */
+ FALLTHROUGH;
case '1': case 'b': case 'l':
lf_copy (left, llen, tmp);
break;
@@ -996,7 +996,7 @@ edit (struct line_filter *left, char const *lname, lin lline, lin llen,
else
fprintf (tmp, "+++ %s %"pI"d,%"pI"d\n", rname, l1, l2);
}
- /* Fall through. */
+ FALLTHROUGH;
case '2': case 'b': case 'r':
lf_copy (right, rlen, tmp);
break;
diff --git a/src/side.c b/src/side.c
index 647f5b7..7f902da 100644
--- a/src/side.c
+++ b/src/side.c
@@ -150,7 +150,7 @@ print_half_line (char const *const *line, size_t indent, size_t out_bound)
break;
}
}
- /* Fall through. */
+ FALLTHROUGH;
case '\f':
case '\v':
if (in_position < out_bound)
diff --git a/src/system.h b/src/system.h
index 759b63c..a8936ba 100644
--- a/src/system.h
+++ b/src/system.h
@@ -230,3 +230,11 @@ verify (LIN_MAX <= TYPE_MAXIMUM (printint));
#endif
#define STREQ(a, b) (strcmp (a, b) == 0)
+
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+# define FALLTHROUGH ((void) 0)
+# else
+# define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif
diff --git a/src/util.c b/src/util.c
index 09c5316..88955da 100644
--- a/src/util.c
+++ b/src/util.c
@@ -382,7 +382,7 @@ get_funky_string (char **dest, const char **src, bool equals_end,
state = ST_END; /* End */
break;
}
- /* fall through */
+ FALLTHROUGH;
default:
*(q++) = *(p++);
++count;
@@ -1089,7 +1089,7 @@ lines_differ (char const *s1, char const *s2)
}
if (ignore_white_space == IGNORE_TRAILING_SPACE)
break;
- /* Fall through. */
+ FALLTHROUGH;
case IGNORE_TAB_EXPANSION:
if ((c1 == ' ' && c2 == '\t')
|| (c1 == '\t' && c2 == ' '))