tools: Rename __fallthrough to fallthrough
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. Committer notes: Did some missing conversions to: builtin-list.c Also included gtk.h before the 'fallthrough' definition in: tools/perf/ui/gtk/hists.c tools/perf/ui/gtk/helpline.c tools/perf/ui/gtk/browser.c As it is the arg name for a macro in glib.h: /var/home/acme/git/perf-tools-next/tools/include/linux/compiler-gcc.h:16:55: error: missing binary operator before token "(" 16 | # define fallthrough __attribute__((__fallthrough__)) | ^ /usr/include/glib-2.0/glib/gmacros.h:637:28: note: in expansion of macro ‘fallthrough’ 637 | #if g_macro__has_attribute(fallthrough) Reviewed-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Liam Howlett <Liam.Howlett@oracle.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Tom Rix <trix@redhat.com> Cc: linux-sparse@vger.kernel.org <linux-sparse@vger.kernel.org> Cc: llvm@lists.linux.dev <llvm@lists.linux.dev> Link: https://lore.kernel.org/r/20221125154947.2163498-1-Liam.Howlett@oracle.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
0ea8920e86
commit
f7a858bffc
@ -12,8 +12,10 @@
|
|||||||
+ __GNUC_PATCHLEVEL__)
|
+ __GNUC_PATCHLEVEL__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GCC_VERSION >= 70000 && !defined(__CHECKER__)
|
#if __has_attribute(__fallthrough__)
|
||||||
# define __fallthrough __attribute__ ((fallthrough))
|
# define fallthrough __attribute__((__fallthrough__))
|
||||||
|
#else
|
||||||
|
# define fallthrough do {} while (0) /* fallthrough */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __has_attribute(__error__)
|
#if __has_attribute(__error__)
|
||||||
|
@ -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__. */
|
/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
|
||||||
#define ___PASTE(a, b) a##b
|
#define ___PASTE(a, b) a##b
|
||||||
#define __PASTE(a, b) ___PASTE(a, b)
|
#define __PASTE(a, b) ___PASTE(a, b)
|
||||||
|
@ -278,10 +278,10 @@ static void fix_escape_printf(struct strbuf *buf, const char *fmt, ...)
|
|||||||
strbuf_addstr(buf, "\\n");
|
strbuf_addstr(buf, "\\n");
|
||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case '\"':
|
case '\"':
|
||||||
strbuf_addch(buf, '\\');
|
strbuf_addch(buf, '\\');
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
default:
|
default:
|
||||||
strbuf_addch(buf, s[s_pos]);
|
strbuf_addch(buf, s[s_pos]);
|
||||||
break;
|
break;
|
||||||
|
@ -715,7 +715,7 @@ __cmd_probe(int argc, const char **argv)
|
|||||||
pr_err(" Error: --bootconfig doesn't support uprobes.\n");
|
pr_err(" Error: --bootconfig doesn't support uprobes.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case 'a':
|
case 'a':
|
||||||
|
|
||||||
/* Ensure the last given target is used */
|
/* Ensure the last given target is used */
|
||||||
|
@ -549,7 +549,7 @@ static void process_evlist(struct evlist *evlist, unsigned int interval)
|
|||||||
if (evlist__ctlfd_process(evlist, &cmd) > 0) {
|
if (evlist__ctlfd_process(evlist, &cmd) > 0) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case EVLIST_CTL_CMD_ENABLE:
|
case EVLIST_CTL_CMD_ENABLE:
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case EVLIST_CTL_CMD_DISABLE:
|
case EVLIST_CTL_CMD_DISABLE:
|
||||||
if (interval)
|
if (interval)
|
||||||
process_interval();
|
process_interval();
|
||||||
|
@ -709,7 +709,7 @@ repeat:
|
|||||||
case -1:
|
case -1:
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
default:
|
default:
|
||||||
c = getc(stdin);
|
c = getc(stdin);
|
||||||
tcsetattr(0, TCSAFLUSH, &save);
|
tcsetattr(0, TCSAFLUSH, &save);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include "gtk.h"
|
||||||
#include "../evsel.h"
|
#include "../evsel.h"
|
||||||
#include "../sort.h"
|
#include "../sort.h"
|
||||||
#include "../hist.h"
|
#include "../hist.h"
|
||||||
#include "../helpline.h"
|
#include "../helpline.h"
|
||||||
#include "gtk.h"
|
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include "gtk.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
|
||||||
#include "gtk.h"
|
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
#include "../helpline.h"
|
#include "../helpline.h"
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include "gtk.h"
|
||||||
#include "../evlist.h"
|
#include "../evlist.h"
|
||||||
#include "../callchain.h"
|
#include "../callchain.h"
|
||||||
#include "../evsel.h"
|
#include "../evsel.h"
|
||||||
@ -6,7 +7,6 @@
|
|||||||
#include "../hist.h"
|
#include "../hist.h"
|
||||||
#include "../helpline.h"
|
#include "../helpline.h"
|
||||||
#include "../string2.h"
|
#include "../string2.h"
|
||||||
#include "gtk.h"
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
|
@ -724,7 +724,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
|
|||||||
if (match != MATCH_ERROR)
|
if (match != MATCH_ERROR)
|
||||||
break;
|
break;
|
||||||
/* otherwise fall-back to symbol-based comparison below */
|
/* otherwise fall-back to symbol-based comparison below */
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case CCKEY_FUNCTION:
|
case CCKEY_FUNCTION:
|
||||||
if (node->ms.sym && cnode->ms.sym) {
|
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 */
|
/* otherwise fall-back to IP-based comparison below */
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case CCKEY_ADDRESS:
|
case CCKEY_ADDRESS:
|
||||||
default:
|
default:
|
||||||
match = match_chain_dso_addresses(cnode->ms.map, cnode->ip, node->ms.map, node->ip);
|
match = match_chain_dso_addresses(cnode->ms.map, cnode->ip, node->ms.map, node->ip);
|
||||||
|
@ -3546,7 +3546,7 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder)
|
|||||||
switch (decoder->packet.type) {
|
switch (decoder->packet.type) {
|
||||||
case INTEL_PT_TIP_PGD:
|
case INTEL_PT_TIP_PGD:
|
||||||
decoder->continuous_period = false;
|
decoder->continuous_period = false;
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case INTEL_PT_TIP_PGE:
|
case INTEL_PT_TIP_PGE:
|
||||||
case INTEL_PT_TIP:
|
case INTEL_PT_TIP:
|
||||||
case INTEL_PT_PTWRITE:
|
case INTEL_PT_PTWRITE:
|
||||||
@ -3616,7 +3616,7 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder)
|
|||||||
decoder->pge = false;
|
decoder->pge = false;
|
||||||
decoder->continuous_period = false;
|
decoder->continuous_period = false;
|
||||||
intel_pt_clear_tx_flags(decoder);
|
intel_pt_clear_tx_flags(decoder);
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
|
|
||||||
case INTEL_PT_TNT:
|
case INTEL_PT_TNT:
|
||||||
decoder->have_tma = false;
|
decoder->have_tma = false;
|
||||||
@ -3980,7 +3980,7 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder)
|
|||||||
decoder->have_last_ip = false;
|
decoder->have_last_ip = false;
|
||||||
decoder->last_ip = 0;
|
decoder->last_ip = 0;
|
||||||
decoder->ip = 0;
|
decoder->ip = 0;
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case INTEL_PT_STATE_ERR_RESYNC:
|
case INTEL_PT_STATE_ERR_RESYNC:
|
||||||
err = intel_pt_sync_ip(decoder);
|
err = intel_pt_sync_ip(decoder);
|
||||||
break;
|
break;
|
||||||
|
@ -730,7 +730,7 @@ int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf,
|
|||||||
case INTEL_PT_FUP:
|
case INTEL_PT_FUP:
|
||||||
if (!(packet->count))
|
if (!(packet->count))
|
||||||
return snprintf(buf, buf_len, "%s no ip", name);
|
return snprintf(buf, buf_len, "%s no ip", name);
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case INTEL_PT_CYC:
|
case INTEL_PT_CYC:
|
||||||
case INTEL_PT_VMCS:
|
case INTEL_PT_VMCS:
|
||||||
case INTEL_PT_MTC:
|
case INTEL_PT_MTC:
|
||||||
|
@ -284,7 +284,7 @@ static int __ordered_events__flush(struct ordered_events *oe, enum oe_flush how,
|
|||||||
switch (how) {
|
switch (how) {
|
||||||
case OE_FLUSH__FINAL:
|
case OE_FLUSH__FINAL:
|
||||||
show_progress = true;
|
show_progress = true;
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case OE_FLUSH__TOP:
|
case OE_FLUSH__TOP:
|
||||||
oe->next_flush = ULLONG_MAX;
|
oe->next_flush = ULLONG_MAX;
|
||||||
break;
|
break;
|
||||||
|
@ -274,7 +274,7 @@ static int strfilter_node__sprint(struct strfilter_node *node, char *buf)
|
|||||||
len = strfilter_node__sprint_pt(node->l, buf);
|
len = strfilter_node__sprint_pt(node->l, buf);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
return len;
|
return len;
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case '!':
|
case '!':
|
||||||
if (buf) {
|
if (buf) {
|
||||||
*(buf + len++) = *node->p;
|
*(buf + len++) = *node->p;
|
||||||
|
@ -35,7 +35,7 @@ s64 perf_atoll(const char *str)
|
|||||||
if (*p)
|
if (*p)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
__fallthrough;
|
fallthrough;
|
||||||
case '\0':
|
case '\0':
|
||||||
return length;
|
return length;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user