Add JQ_FALLTHROUGH and use it to quiet warnings
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Nicolas Williams · committed by Emanuele Torre · parent a6eb055 · Browse files · 4 files·+22 added−2 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+22 added−2 removed
- other:+22 added−2 removed
Provenance
- Commit
c8b30df- Tree
664dd57- Author
Nicolas Williams <nico@cryptonector.com>- Committer
Emanuele Torre <torreemanuele6@gmail.com>- Parent
a6eb055
4 files changed+22 added−2 removed
modified:src/execute.c+2 added-1 removed
573 unmodified lines574 }575 576 case STOREVN:577 stack_save(jq, pc - 1, stack_get_pos(jq));578+ JQ_FALLTHROUGH;579 case STOREV: {580 uint16_t level = *pc++;581 uint16_t v = *pc++;582 jv* var = frame_local_var(jq, v, level);159 unmodified lines742 goto do_backtrack;743 }744 stack_push(jq, container);745 stack_push(jq, jv_number(-1));745- // fallthrough746+ JQ_FALLTHROUGH;747 }748 case ON_BACKTRACK(EACH):749 case ON_BACKTRACK(EACH_OPT): {750 int idx = jv_number_value(stack_pop(jq));601 unmodified linesmodified:src/jv_dtoa.c+11 added-1 removed
193 unmodified lines194 195 #include "jv_dtoa.h"196 197 #include "jv_alloc.h"198+#include "jv.h"199 #define MALLOC jv_mem_alloc200 #define FREE jv_mem_free201 202 1520 unmodified lines1723 switch(*++s) {1724 case '-':1725 esign = 1;1726 /* no break */1727+ JQ_FALLTHROUGH;1728 case '+':1729 s++;1730 }1731 if ((n = hexdig[*s]) == 0 || n > 0x19) {596 unmodified lines2328 double2329 jvp_strtod2330 (struct dtoa_context* C, const char *s00, char **se)2331 {2330- int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1, test_scale;2332+ int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;2333+#ifdef Honor_FLT_ROUNDS2334+ int test_scale;2335+#endif2336 int esign, i, j, k, nd, nd0, nf, nz, nz0, nz1, sign;2337 CONST char *s, *s0, *s1;2338 double aadj, aadj1;2339 Long L;31 unmodified lines2371 for(s = s00;;s++) switch(*s) {2372 case '-':2373 sign = 1;2374 /* no break */2375+ JQ_FALLTHROUGH;2376 case '+':2377 if (*++s)2378 goto break2;2379 /* no break */2380+ JQ_FALLTHROUGH;2381 case 0:2382 goto ret0;2383 case '\t':2384 case '\n':99 unmodified lines2484 esign = 0;2485 switch(c = *++s) {2486 case '-':2487 esign = 1;2488+ JQ_FALLTHROUGH;2489 case '+':2490 c = *++s;2491 }2492 if (c >= '0' && c <= '9') {1213 unmodified lines3706 break;3707 case 2:3708 leftright = 0;3709 /* no break */3710+ JQ_FALLTHROUGH;3711 case 4:3712 if (ndigits <= 0)3713 ndigits = 1;3714 ilim = ilim1 = i = ndigits;3715 break;3716 case 3:3717 leftright = 0;3718 /* no break */3719+ JQ_FALLTHROUGH;3720 case 5:3721 i = ndigits + k + 1;3722 ilim = i;3723 ilim1 = i - 1;561 unmodified linesmodified:src/jv.c+2 added
1220 unmodified lines1221 uint32_t k1 = 0;1222 1223 switch(len & 3) {1224 case 3: k1 ^= tail[2] << 16;1225+ JQ_FALLTHROUGH;1226 case 2: k1 ^= tail[1] << 8;1227+ JQ_FALLTHROUGH;1228 case 1: k1 ^= tail[0];1229 k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1;1230 }1231 769 unmodified linesmodified:src/jv.h+7 added
3 unmodified lines4 #include <stdarg.h>5 #include <stdint.h>6 #include <stdio.h>7 8+#if (defined(__GNUC__) && __GNUC__ >= 7) || \9+ (defined(__clang__) && __clang_major__ >= 10)10+# define JQ_FALLTHROUGH __attribute__((fallthrough))11+#else12+# define JQ_FALLTHROUGH do {} while (0) /* fallthrough */13+#endif14+15 typedef enum {16 JV_KIND_INVALID,17 JV_KIND_NULL,18 JV_KIND_FALSE,268 unmodified lines