Linux kbuild commit
d936eb23874 sets $subject CFLAGS, so to play
catch-up, we also need to use gcc attribute(fallthrough) to label such
spots in switch() statements in our runtime / tapset. Tested on
linux5.14 gcc11 rawhide and linux3.10 gcc4 rhel7.
static void *kallsyms_copy_to_kernel_nofault;
#endif
+
+/* A fallthrough; macro to let the runtime survive -Wimplicit-fallthrough=5 */
+/* from <linux/compiler_attribute.h> */
+#ifndef fallthrough
+#if __GNUC__ < 5
+# define fallthrough do {} while (0) /* fallthrough */
+#else
+#if __has_attribute(__fallthrough__)
+# define fallthrough __attribute__((__fallthrough__))
+#else
+# define fallthrough do {} while (0) /* fallthrough */
+#endif
+#endif
+#endif
+
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
#include <linux/user_namespace.h>
#endif
k1 = 0; \
switch(mylen & 3) { \
case 3: k1 ^= tail[2] << 16; \
- /* fallthrough */ \
+ fallthrough; \
case 2: k1 ^= tail[1] << 8; \
- /* fallthrough */ \
+ fallthrough; \
case 1: k1 ^= tail[0]; \
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; \
} \
case 0:
if (!n--) break;
*args++ = regs->bx;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->cx;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->dx;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->si;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->di;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->bp;
case 0:
if (!n--) break;
*args++ = regs->rbx;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->rcx;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->rdx;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->rsi;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->rdi;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->rbp;
case 0:
if (!n--) break;
*args++ = regs->di;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->si;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->dx;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->r10;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->r8;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->r9;
case 0:
if (!n--) break;
*args++ = regs->rdi;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->rsi;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->rdx;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->r10;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->r8;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->r9;
case 6:
if (!n--) break;
*args++ = regs->r13;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->r15;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->r14;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->r10;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->r9;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->r11;
- /* fallthrough */
+ fallthrough;
case 0:
if (!n--) break;
- /* fallthrough */
+ fallthrough;
default:
BUG();
break;
case 0:
if (!n--) break;
*args++ = regs->orig_gpr2 & mask;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->gprs[3] & mask;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->gprs[4] & mask;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->gprs[5] & mask;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->gprs[6] & mask;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->args[0] & mask;
REG_STATE.cfa.reg = value;
dbug_unwind(1, "DW_CFA_def_cfa reg=%ld\n", REG_STATE.cfa.reg);
}
- /* fallthrough */
+ fallthrough;
case DW_CFA_def_cfa_offset:
if (REG_STATE.cfa_is_expr != 0) {
_stp_warn("Unexpected DW_CFA_def_cfa_offset\n");
value, DWARF_REG_MAP(value));
REG_STATE.cfa.reg = value;
}
- /* fallthrough */
+ fallthrough;
case DW_CFA_def_cfa_offset_sf:
if (REG_STATE.cfa_is_expr != 0) {
_stp_warn("Unexpected DW_CFA_def_cfa_offset_sf\n");
case DW_OP_bra:
if (POP == 0)
break;
- /* Fall through. */
+ fallthrough;
case DW_OP_skip:
NEED(sizeof(u.s16));
memcpy(&u.s16, expr, sizeof(u.s16));
value = _stp_get_unaligned(ptr.p32u++);
break;
}
- /* fallthrough */
+ fallthrough;
case DW_EH_PE_data8:
BUILD_BUG_ON(sizeof(u64) != sizeof(value));
#else
BUILD_BUG_ON(sizeof(u32) != sizeof(value));
#endif
- /* fallthrough */
+ fallthrough;
case DW_EH_PE_absptr:
if (compat_task)
{
case 'X':
flags |= STP_LARGE;
- /* fallthru */
+ fallthrough;
case 'x':
base = 16;
break;
case 'd':
case 'i':
flags |= STP_SIGN;
- /* fallthru */
+ fallthrough;
case 'u':
break;
case 'X':
flags |= STP_LARGE;
- /* fallthru */
+ fallthrough;
case 'x':
base = 16;
break;
case 'd':
case 'i':
flags |= STP_SIGN;
- /* fallthru */
+ fallthrough;
case 'u':
break;
{
switch (_NSIG_WORDS) {
case 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 );
- /*fallthrough*/
+ fallthrough;
case 3: set->sig[2] = compat->sig[4] | (((long)compat->sig[5]) << 32 );
- /*fallthrough*/
+ fallthrough;
case 2: set->sig[1] = compat->sig[2] | (((long)compat->sig[3]) << 32 );
- /*fallthrough*/
+ fallthrough;
case 1: set->sig[0] = compat->sig[0] | (((long)compat->sig[1]) << 32 );
}
}
{
case 4: act.sa_mask.sig[3] = act32.sa_mask.sig[6]
| (((long)act32.sa_mask.sig[7]) << 32);
- /* fallthrough */
+ fallthrough;
case 3: act.sa_mask.sig[2] = act32.sa_mask.sig[4]
| (((long)act32.sa_mask.sig[5]) << 32);
- /* fallthrough */
+ fallthrough;
case 2: act.sa_mask.sig[1] = act32.sa_mask.sig[2]
| (((long)act32.sa_mask.sig[3]) << 32);
- /* fallthrough */
+ fallthrough;
case 1: act.sa_mask.sig[0] = act32.sa_mask.sig[0]
| (((long)act32.sa_mask.sig[1]) << 32);
}