summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2018-03-06 23:52:08 +0000
committerDmitry V. Levin <ldv@altlinux.org>2018-03-06 23:52:08 +0000
commit0b03de74bc5b19692e4b77df64882c6602f41161 (patch)
tree7a665402407ba5399434df2c76d15bc289cf0d37
parent2f0842fe61f01f300aeee539cc83164b0dfd25d5 (diff)
downloadstrace-0b03de74bc5b19692e4b77df64882c6602f41161.tar.gz
build: prepare for -Wimplicit-fallthrough=5
* gcc_compat.h (ATTRIBUTE_FALLTHROUGH): New macro. * block.c (block_ioctl): Use it instead of "fall through" comment. * btrfs.c (btrfs_ioctl): Likewise. * loop.c (loop_ioctl): Likewise. * mtd.c (mtd_ioctl): Likewise. * rtc.c (rtc_ioctl): Likewise. * v4l2.c (v4l2_ioctl): Likewise. * dm.c (dm_decode_values): Likewise. * process.c (SYS_FUNC(ptrace)): Likewise. * quota.c (decode_cmd_data): Likewise. * ucopy.c (umovestr): Likewise. * unwind.c (unwind_print_stacktrace, unwind_capture_stacktrace)): Likewise. * term.c (term_ioctl): Add ATTRIBUTE_FALLTHROUGH. * ioctl.c (ioctl_decode) [ALPHA || POWERPC]: Likewise. * m4/st_warn_cflags.m4 (gl_WARN_ADD): Add -Wimplicit-fallthrough=5. * tests/ioctl_v4l2.c (init_v4l2_format): Reorganize the switch statement without implicit fallthrough.
-rw-r--r--block.c2
-rw-r--r--btrfs.c4
-rw-r--r--dm.c2
-rw-r--r--gcc_compat.h6
-rw-r--r--ioctl.c1
-rw-r--r--loop.c4
-rw-r--r--m4/st_warn_cflags.m41
-rw-r--r--mtd.c2
-rw-r--r--process.c2
-rw-r--r--quota.c6
-rw-r--r--rtc.c6
-rw-r--r--term.c6
-rw-r--r--tests/ioctl_v4l2.c11
-rw-r--r--ucopy.c2
-rw-r--r--unwind.c4
-rw-r--r--v4l2.c6
16 files changed, 41 insertions, 24 deletions
diff --git a/block.c b/block.c
index b402f6835..f31ef1428 100644
--- a/block.c
+++ b/block.c
@@ -168,7 +168,7 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
case BLKALIGNOFF:
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
/* take a signed int */
case BLKROSET:
case BLKBSZSET:
diff --git a/btrfs.c b/btrfs.c
index ed3120ae3..3016ec843 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -538,7 +538,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
case BTRFS_IOC_START_SYNC: /* R */
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
/* takes a u64 */
case BTRFS_IOC_DEFAULT_SUBVOL: /* W */
case BTRFS_IOC_WAIT_SYNC: /* W */
@@ -1318,7 +1318,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
case BTRFS_IOC_GET_FSLABEL: /* R */
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case BTRFS_IOC_SET_FSLABEL: { /* W */
char label[BTRFS_LABEL_SIZE];
diff --git a/dm.c b/dm.c
index 32b331011..17470fa1e 100644
--- a/dm.c
+++ b/dm.c
@@ -91,7 +91,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code,
case DM_DEV_SUSPEND:
if (ioc->flags & DM_SUSPEND_FLAG)
break;
- /* Fall through */
+ ATTRIBUTE_FALLTHROUGH;
case DM_DEV_RENAME:
case DM_DEV_REMOVE:
case DM_DEV_WAIT:
diff --git a/gcc_compat.h b/gcc_compat.h
index 956aff176..b55092fd9 100644
--- a/gcc_compat.h
+++ b/gcc_compat.h
@@ -93,4 +93,10 @@
# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */
#endif
+#if GNUC_PREREQ(7, 0)
+# define ATTRIBUTE_FALLTHROUGH __attribute__((__fallthrough__))
+#else
+# define ATTRIBUTE_FALLTHROUGH ((void) 0)
+#endif
+
#endif /* !STRACE_GCC_COMPAT_H */
diff --git a/ioctl.c b/ioctl.c
index 9fd74924f..5a59f379e 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -263,6 +263,7 @@ ioctl_decode(struct tcb *tcp)
int ret = file_ioctl(tcp, code, arg);
if (ret != RVAL_DECODED)
return ret;
+ ATTRIBUTE_FALLTHROUGH;
}
case 't':
case 'T':
diff --git a/loop.c b/loop.c
index 33bd03857..291f5646c 100644
--- a/loop.c
+++ b/loop.c
@@ -156,7 +156,7 @@ MPERS_PRINTER_DECL(int, loop_ioctl,
case LOOP_GET_STATUS:
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case LOOP_SET_STATUS:
decode_loop_info(tcp, arg);
break;
@@ -164,7 +164,7 @@ MPERS_PRINTER_DECL(int, loop_ioctl,
case LOOP_GET_STATUS64:
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case LOOP_SET_STATUS64:
decode_loop_info64(tcp, arg);
break;
diff --git a/m4/st_warn_cflags.m4 b/m4/st_warn_cflags.m4
index 04d45442d..35f40b589 100644
--- a/m4/st_warn_cflags.m4
+++ b/m4/st_warn_cflags.m4
@@ -3,6 +3,7 @@ gl_WARN_ADD([-Wall])
gl_WARN_ADD([-Wempty-body])
gl_WARN_ADD([-Wformat-security])
gl_WARN_ADD([-Wignored-qualifiers])
+gl_WARN_ADD([-Wimplicit-fallthrough=5])
gl_WARN_ADD([-Winit-self])
gl_WARN_ADD([-Wlogical-op])
gl_WARN_ADD([-Wmissing-parameter-type])
diff --git a/mtd.c b/mtd.c
index 52957f9d3..cf4e30c3d 100644
--- a/mtd.c
+++ b/mtd.c
@@ -274,7 +274,7 @@ MPERS_PRINTER_DECL(int, mtd_ioctl, struct tcb *const tcp,
case OTPGETREGIONINFO:
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case OTPLOCK:
decode_otp_info(tcp, arg);
break;
diff --git a/process.c b/process.c
index 895fc4b8f..f5733417c 100644
--- a/process.c
+++ b/process.c
@@ -219,7 +219,7 @@ SYS_FUNC(ptrace)
/* print data on exiting syscall */
return 0;
}
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
default:
printaddr(data);
break;
diff --git a/quota.c b/quota.c
index ba1d7612a..a051bd883 100644
--- a/quota.c
+++ b/quota.c
@@ -177,7 +177,7 @@ decode_cmd_data(struct tcb *tcp, uint32_t id, uint32_t cmd, kernel_ulong_t data)
return 0;
}
- /* Fall-through */
+ ATTRIBUTE_FALLTHROUGH;
case Q_SETQUOTA:
{
struct if_dqblk dq;
@@ -247,7 +247,7 @@ decode_cmd_data(struct tcb *tcp, uint32_t id, uint32_t cmd, kernel_ulong_t data)
return 0;
}
- /* Fall-through */
+ ATTRIBUTE_FALLTHROUGH;
case Q_XSETQLIM:
{
struct xfs_dqblk dq;
@@ -310,7 +310,7 @@ decode_cmd_data(struct tcb *tcp, uint32_t id, uint32_t cmd, kernel_ulong_t data)
return 0;
}
- /* Fall-through */
+ ATTRIBUTE_FALLTHROUGH;
case Q_SETINFO:
{
struct if_dqinfo dq;
diff --git a/rtc.c b/rtc.c
index 9c02cbd50..b5c65da9f 100644
--- a/rtc.c
+++ b/rtc.c
@@ -93,7 +93,7 @@ MPERS_PRINTER_DECL(int, rtc_ioctl, struct tcb *const tcp,
case RTC_RD_TIME:
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case RTC_ALM_SET:
case RTC_SET_TIME:
tprints(", ");
@@ -113,7 +113,7 @@ MPERS_PRINTER_DECL(int, rtc_ioctl, struct tcb *const tcp,
case RTC_WKALM_RD:
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case RTC_WKALM_SET:
tprints(", ");
decode_rtc_wkalrm(tcp, arg);
@@ -121,7 +121,7 @@ MPERS_PRINTER_DECL(int, rtc_ioctl, struct tcb *const tcp,
case RTC_PLL_GET:
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case RTC_PLL_SET:
tprints(", ");
decode_rtc_pll_info(tcp, arg);
diff --git a/term.c b/term.c
index 9368e5fd5..0f13f5f11 100644
--- a/term.c
+++ b/term.c
@@ -160,6 +160,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
case TIOCGLCKTRMIOS:
if (entering(tcp))
return 0;
+ ATTRIBUTE_FALLTHROUGH;
case TCSETS:
#ifdef TCSETS2
case TCSETS2:
@@ -180,6 +181,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
case TCGETA:
if (entering(tcp))
return 0;
+ ATTRIBUTE_FALLTHROUGH;
case TCSETA:
case TCSETAW:
case TCSETAF:
@@ -190,6 +192,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
case TIOCGWINSZ:
if (entering(tcp))
return 0;
+ ATTRIBUTE_FALLTHROUGH;
case TIOCSWINSZ:
decode_winsize(tcp, arg);
break;
@@ -199,6 +202,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
case TIOCGSIZE:
if (entering(tcp))
return 0;
+ ATTRIBUTE_FALLTHROUGH;
case TIOCSSIZE:
decode_ttysize(tcp, arg);
break;
@@ -223,6 +227,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
case TIOCMGET:
if (entering(tcp))
return 0;
+ ATTRIBUTE_FALLTHROUGH;
case TIOCMBIS:
case TIOCMBIC:
case TIOCMSET:
@@ -245,6 +250,7 @@ term_ioctl(struct tcb *const tcp, const unsigned int code,
#endif
if (entering(tcp))
return 0;
+ ATTRIBUTE_FALLTHROUGH;
case TIOCSPGRP:
case TIOCSETD:
case FIONBIO:
diff --git a/tests/ioctl_v4l2.c b/tests/ioctl_v4l2.c
index 8cf22777c..4b7a1262a 100644
--- a/tests/ioctl_v4l2.c
+++ b/tests/ioctl_v4l2.c
@@ -157,14 +157,17 @@ init_v4l2_format(struct v4l2_format *const f,
#if HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT
case V4L2_BUF_TYPE_SDR_OUTPUT:
f->fmt.sdr.pixelformat = sf_magic;
+# ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE
+ f->fmt.sdr.buffersize = 0x25afabfb;
+# endif
+ break;
#endif
#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
case V4L2_BUF_TYPE_SDR_CAPTURE:
- if (buf_type == V4L2_BUF_TYPE_SDR_CAPTURE)
- f->fmt.sdr.pixelformat = magic;
-#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE
+ f->fmt.sdr.pixelformat = magic;
+# ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE
f->fmt.sdr.buffersize = 0x25afabfb;
-#endif
+# endif
break;
#endif
}
diff --git a/ucopy.c b/ucopy.c
index 2d9ffb38c..a31f5243c 100644
--- a/ucopy.c
+++ b/ucopy.c
@@ -306,7 +306,7 @@ umovestr(struct tcb *const tcp, kernel_ulong_t addr, unsigned int len,
if (!nread)
return umovestr_peekdata(pid, addr,
len, laddr);
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case EFAULT: case EIO:
/* address space is inaccessible */
if (nread)
diff --git a/unwind.c b/unwind.c
index cbb5206bc..a272fba8f 100644
--- a/unwind.c
+++ b/unwind.c
@@ -398,7 +398,7 @@ unwind_print_stacktrace(struct tcb *tcp)
} else switch (mmap_cache_rebuild_if_invalid(tcp, __func__)) {
case MMAP_CACHE_REBUILD_RENEWED:
unw_flush_cache(libunwind_as, 0, 0);
- /* Fall through */
+ ATTRIBUTE_FALLTHROUGH;
case MMAP_CACHE_REBUILD_READY:
debug_func_msg("walk: tcp=%p, queue=%p", tcp, tcp->queue->head);
stacktrace_walk(tcp, print_call_cb, print_error_cb, NULL);
@@ -427,7 +427,7 @@ unwind_capture_stacktrace(struct tcb *tcp)
switch (mmap_cache_rebuild_if_invalid(tcp, __func__)) {
case MMAP_CACHE_REBUILD_RENEWED:
unw_flush_cache(libunwind_as, 0, 0);
- /* Fall through */
+ ATTRIBUTE_FALLTHROUGH;
case MMAP_CACHE_REBUILD_READY:
stacktrace_walk(tcp, queue_put_call, queue_put_error,
tcp->queue);
diff --git a/v4l2.c b/v4l2.c
index 41f62c7f8..7081c81cc 100644
--- a/v4l2.c
+++ b/v4l2.c
@@ -1022,7 +1022,7 @@ MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb *const tcp,
case VIDIOC_G_FBUF: /* R */
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case VIDIOC_S_FBUF: /* W */
return print_v4l2_framebuffer(tcp, arg);
@@ -1037,7 +1037,7 @@ MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb *const tcp,
case VIDIOC_G_STD: /* R */
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case VIDIOC_S_STD: /* W */
tprints(", ");
printnum_int64(tcp, arg, "%#" PRIx64);
@@ -1063,7 +1063,7 @@ MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb *const tcp,
case VIDIOC_G_INPUT: /* R */
if (entering(tcp))
return 0;
- /* fall through */
+ ATTRIBUTE_FALLTHROUGH;
case VIDIOC_S_INPUT: /* RW */
tprints(", ");
printnum_int(tcp, arg, "%u");