Skip to content

Commit 3e98f02

Browse files
Leo-Yannamhyung
authored andcommitted
perf cs-etm: Mute enumeration value warning
When the OpenCSD library introduces a new enumeration value (for example, in the v1.7.1 release), the perf build fails with an error: util/cs-etm-decoder/cs-etm-decoder.c:600:10: error: enumeration value 'OCSD_GEN_TRC_ELEM_ITMTRACE' not explicitly handled in switch [-Werror, -Wswitch-enum] 600 | switch (elem->elem_type) { | ^~~~~~~~~~~~~~~ 1 error generated. Convert to if-else sentences to mute the enumeration value warning, which can avoid build failures whenever the lib is updated. No functional change. Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Leo Yan <leo.yan@arm.com> Reviewed-by: James Clark <james.clark@linaro.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
1 parent 9960889 commit 3e98f02

File tree

1 file changed

+11
-33
lines changed

1 file changed

+11
-33
lines changed

tools/perf/util/cs-etm-decoder/cs-etm-decoder.c

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
588588
const ocsd_generic_trace_elem *elem)
589589
{
590590
ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
591+
ocsd_gen_trc_elem_t type;
591592
struct cs_etm_decoder *decoder = (struct cs_etm_decoder *) context;
592593
struct cs_etm_queue *etmq = decoder->data;
593594
struct cs_etm_packet_queue *packet_queue;
@@ -597,52 +598,29 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
597598
if (!packet_queue)
598599
return OCSD_RESP_FATAL_SYS_ERR;
599600

600-
switch (elem->elem_type) {
601-
case OCSD_GEN_TRC_ELEM_UNKNOWN:
602-
break;
603-
case OCSD_GEN_TRC_ELEM_EO_TRACE:
604-
case OCSD_GEN_TRC_ELEM_NO_SYNC:
605-
case OCSD_GEN_TRC_ELEM_TRACE_ON:
601+
type = elem->elem_type;
602+
603+
if (type == OCSD_GEN_TRC_ELEM_EO_TRACE ||
604+
type == OCSD_GEN_TRC_ELEM_NO_SYNC ||
605+
type == OCSD_GEN_TRC_ELEM_TRACE_ON)
606606
resp = cs_etm_decoder__buffer_discontinuity(etmq, packet_queue,
607607
trace_chan_id);
608-
break;
609-
case OCSD_GEN_TRC_ELEM_INSTR_RANGE:
608+
else if (type == OCSD_GEN_TRC_ELEM_INSTR_RANGE)
610609
resp = cs_etm_decoder__buffer_range(etmq, packet_queue, elem,
611610
trace_chan_id);
612-
break;
613-
case OCSD_GEN_TRC_ELEM_EXCEPTION:
611+
else if (type == OCSD_GEN_TRC_ELEM_EXCEPTION)
614612
resp = cs_etm_decoder__buffer_exception(etmq, packet_queue, elem,
615613
trace_chan_id);
616-
break;
617-
case OCSD_GEN_TRC_ELEM_EXCEPTION_RET:
614+
else if (type == OCSD_GEN_TRC_ELEM_EXCEPTION_RET)
618615
resp = cs_etm_decoder__buffer_exception_ret(etmq, packet_queue,
619616
trace_chan_id);
620-
break;
621-
case OCSD_GEN_TRC_ELEM_TIMESTAMP:
617+
else if (type == OCSD_GEN_TRC_ELEM_TIMESTAMP)
622618
resp = cs_etm_decoder__do_hard_timestamp(etmq, elem,
623619
trace_chan_id,
624620
indx);
625-
break;
626-
case OCSD_GEN_TRC_ELEM_PE_CONTEXT:
621+
else if (type == OCSD_GEN_TRC_ELEM_PE_CONTEXT)
627622
resp = cs_etm_decoder__set_tid(etmq, packet_queue,
628623
elem, trace_chan_id);
629-
break;
630-
/* Unused packet types */
631-
case OCSD_GEN_TRC_ELEM_I_RANGE_NOPATH:
632-
case OCSD_GEN_TRC_ELEM_ADDR_NACC:
633-
case OCSD_GEN_TRC_ELEM_CYCLE_COUNT:
634-
case OCSD_GEN_TRC_ELEM_ADDR_UNKNOWN:
635-
case OCSD_GEN_TRC_ELEM_EVENT:
636-
case OCSD_GEN_TRC_ELEM_SWTRACE:
637-
case OCSD_GEN_TRC_ELEM_CUSTOM:
638-
case OCSD_GEN_TRC_ELEM_SYNC_MARKER:
639-
case OCSD_GEN_TRC_ELEM_MEMTRANS:
640-
#if (OCSD_VER_NUM >= 0x010400)
641-
case OCSD_GEN_TRC_ELEM_INSTRUMENTATION:
642-
#endif
643-
default:
644-
break;
645-
}
646624

647625
return resp;
648626
}

0 commit comments

Comments
 (0)