]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tools: Rename __fallthrough to fallthrough
authorLiam Howlett <Liam.Howlett@oracle.com>
Fri, 25 Nov 2022 15:19:18 +0000 (10:19 -0500)
committerLiam Howlett <Liam.Howlett@oracle.com>
Fri, 25 Nov 2022 15:48:00 +0000 (10:48 -0500)
Rename the fallthrough attribute to better align with the kernel
version.  Copy the definition from include/linux/compiler_attributes.h
including the #else clause.  Adding the #else clause allows the tools
compiler.h header to drop the check for a definition entirely and keeps
both definitions together.

Change any __fallthrough statements to fallthrough anywhere it was used
within perf.

This allows other tools to use the same key word as the kernel.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Tom Rix <trix@redhat.com>
Signed-off-by: Liam Howlett <Liam.Howlett@oracle.com>
tools/include/linux/compiler-gcc.h
tools/include/linux/compiler.h
tools/perf/builtin-probe.c
tools/perf/builtin-stat.c
tools/perf/builtin-top.c
tools/perf/util/callchain.c
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c
tools/perf/util/ordered-events.c
tools/perf/util/strfilter.c
tools/perf/util/string.c

index 8816f06fc6c7623ede69136c32ab79ccac862aee..62e7c901ac28c5006fa94b2a54a5fc82ab616bd4 100644 (file)
                     + __GNUC_PATCHLEVEL__)
 #endif
 
-#if GCC_VERSION >= 70000 && !defined(__CHECKER__)
-# define __fallthrough __attribute__ ((fallthrough))
+#if __has_attribute(__fallthrough__)
+# define fallthrough                    __attribute__((__fallthrough__))
+#else
+# define fallthrough                    do {} while (0)  /* fallthrough */
 #endif
 
 #if __has_attribute(__error__)
index 90ba44a99199732c986d70e9fcf6fab30e82a811..9d36c8ce1fe7fb7fa4e662fd604abbb7d937d72f 100644 (file)
@@ -186,10 +186,6 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
 })
 
 
-#ifndef __fallthrough
-# define __fallthrough
-#endif
-
 /* Indirect macros required for expanded argument pasting, eg. __LINE__. */
 #define ___PASTE(a, b) a##b
 #define __PASTE(a, b) ___PASTE(a, b)
index f62298f5db3b442478329eb30c58a582277646f4..8539843d1909b6ff6e9dc77bbd62162c9d24f1a5 100644 (file)
@@ -706,7 +706,7 @@ __cmd_probe(int argc, const char **argv)
                        pr_err("  Error: --bootconfig doesn't support uprobes.\n");
                        return -EINVAL;
                }
-               __fallthrough;
+               fallthrough;
        case 'a':
 
                /* Ensure the last given target is used */
index 265b051579726aad7ff6a01722b80aef208004db..19b0278d496ccc96cd7774f9d0653b51257b213f 100644 (file)
@@ -616,7 +616,7 @@ static void process_evlist(struct evlist *evlist, unsigned int interval)
        if (evlist__ctlfd_process(evlist, &cmd) > 0) {
                switch (cmd) {
                case EVLIST_CTL_CMD_ENABLE:
-                       __fallthrough;
+                       fallthrough;
                case EVLIST_CTL_CMD_DISABLE:
                        if (interval)
                                process_interval();
index 4b3ff7687236e450550879a6f55d551da9507a09..cfe1cde35528f4148773bad94bb9229167d1de54 100644 (file)
@@ -707,7 +707,7 @@ repeat:
                case -1:
                        if (errno == EINTR)
                                continue;
-                       __fallthrough;
+                       fallthrough;
                default:
                        c = getc(stdin);
                        tcsetattr(0, TCSAFLUSH, &save);
index a093a15f048fa84e227bbc72464b462592007a4b..588f86a84eaa3a152acbd7dd414e9f657d211228 100644 (file)
@@ -724,7 +724,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
                if (match != MATCH_ERROR)
                        break;
                /* otherwise fall-back to symbol-based comparison below */
-               __fallthrough;
+               fallthrough;
        case CCKEY_FUNCTION:
                if (node->ms.sym && cnode->ms.sym) {
                        /*
@@ -745,7 +745,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
                        }
                }
                /* otherwise fall-back to IP-based comparison below */
-               __fallthrough;
+               fallthrough;
        case CCKEY_ADDRESS:
        default:
                match = match_chain_dso_addresses(cnode->ms.map, cnode->ip, node->ms.map, node->ip);
index 0ac860c8dd2b809c2e65a3f38233546dde0bd4bc..57dea8074777c0ae30f9ca5832a728ee67dfa062 100644 (file)
@@ -3544,7 +3544,7 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder)
                switch (decoder->packet.type) {
                case INTEL_PT_TIP_PGD:
                        decoder->continuous_period = false;
-                       __fallthrough;
+                       fallthrough;
                case INTEL_PT_TIP_PGE:
                case INTEL_PT_TIP:
                case INTEL_PT_PTWRITE:
@@ -3614,7 +3614,7 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder)
                        decoder->pge = false;
                        decoder->continuous_period = false;
                        intel_pt_clear_tx_flags(decoder);
-                       __fallthrough;
+                       fallthrough;
 
                case INTEL_PT_TNT:
                        decoder->have_tma = false;
@@ -3978,7 +3978,7 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder)
                        decoder->have_last_ip = false;
                        decoder->last_ip = 0;
                        decoder->ip = 0;
-                       __fallthrough;
+                       fallthrough;
                case INTEL_PT_STATE_ERR_RESYNC:
                        err = intel_pt_sync_ip(decoder);
                        break;
index 18f97f43e01a30532ccb61289af339dda3702cee..af9710622a1fa9a1554911d6314862319804810a 100644 (file)
@@ -730,7 +730,7 @@ int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf,
        case INTEL_PT_FUP:
                if (!(packet->count))
                        return snprintf(buf, buf_len, "%s no ip", name);
-               __fallthrough;
+               fallthrough;
        case INTEL_PT_CYC:
        case INTEL_PT_VMCS:
        case INTEL_PT_MTC:
index b887dfeea673e23c5c2f406bf900c386baca0417..8c62611f10aa456c3f7fe0d93e5e210adf9b1883 100644 (file)
@@ -284,7 +284,7 @@ static int __ordered_events__flush(struct ordered_events *oe, enum oe_flush how,
        switch (how) {
        case OE_FLUSH__FINAL:
                show_progress = true;
-               __fallthrough;
+               fallthrough;
        case OE_FLUSH__TOP:
                oe->next_flush = ULLONG_MAX;
                break;
index 78aa4c3b990dcb10646d152bc71f375f6ea0d873..02807b9d4122808cc737472ae3c658235b20b939 100644 (file)
@@ -274,7 +274,7 @@ static int strfilter_node__sprint(struct strfilter_node *node, char *buf)
                len = strfilter_node__sprint_pt(node->l, buf);
                if (len < 0)
                        return len;
-               __fallthrough;
+               fallthrough;
        case '!':
                if (buf) {
                        *(buf + len++) = *node->p;
index 4f12a96f33cc404ca532112159eeef6a6eda0d39..cf05b0b56c57bc417e6ee2bf6b44f411dfd95860 100644 (file)
@@ -35,7 +35,7 @@ s64 perf_atoll(const char *str)
                        if (*p)
                                goto out_err;
 
-                       __fallthrough;
+                       fallthrough;
                case '\0':
                        return length;
                default: