Skip to content

Commit

Permalink
kernelshark: Mute all "unused parameter" warnings
Browse files Browse the repository at this point in the history
Non of this warnings is an actual bug.

Signed-off-by: Yordan Karadzhov <[email protected]>
  • Loading branch information
yordan-karadzhov committed Mar 10, 2024
1 parent 3f2fa6e commit 932b147
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 57 deletions.
5 changes: 3 additions & 2 deletions src/KsMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ void KsMainWindow::_captureFinished(int ret, QProcess::ExitStatus st)
_captureErrorMessage(capture);
}

void KsMainWindow::_captureError(QProcess::ProcessError error)
void KsMainWindow::_captureError([[maybe_unused]] QProcess::ProcessError error)
{
QProcess *capture = static_cast<QProcess*>(sender());
_captureErrorMessage(capture);
Expand Down Expand Up @@ -1595,7 +1595,8 @@ void KsMainWindow::_readSocket()
loadDataFile(fileName);
}

void KsMainWindow::_splitterMoved(int pos, int index)
void KsMainWindow::_splitterMoved([[maybe_unused]] int pos,
[[maybe_unused]] int index)
{
_session.saveSplitterSize(_splitter);
}
Expand Down
4 changes: 2 additions & 2 deletions src/KsModels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ KsFilterProxyModel::KsFilterProxyModel(QObject *parent)

/**
* Returns False if the item in the row indicated by the sourceRow and
* sourceParentshould be filtered out. Otherwise returns True.
* sourceParent should be filtered out. Otherwise returns True.
*/
bool
KsFilterProxyModel::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const
[[maybe_unused]] const QModelIndex &sourceParent) const
{
if (_data[sourceRow]->visible & KS_TEXT_VIEW_FILTER_MASK)
return true;
Expand Down
3 changes: 2 additions & 1 deletion src/KsModels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ class KsGraphModel : public QAbstractTableModel
* This dummy function is an implementation of the pure
* virtual method of the abstract model class.
*/
QVariant data(const QModelIndex &index, int role) const override
QVariant data([[maybe_unused]] const QModelIndex &index,
[[maybe_unused]] int role) const override
{
return {};
}
Expand Down
8 changes: 5 additions & 3 deletions src/KsPlotTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ Color getColor(const ColorTable *colors, int id)
* @param x: The X coordinate of the click.
* @param y: The Y coordinate of the click.
*/
double PlotObject::distance(int x, int y) const
double PlotObject::distance([[maybe_unused]] int x,
[[maybe_unused]] int y) const
{
return std::numeric_limits<double>::max();
}
Expand Down Expand Up @@ -652,7 +653,7 @@ void TextBox::setBoxAppearance(const Color &col, int l, int h)
_box.setPoint(3, _box.pointX(0) + l, _box.pointY(0));
}

void TextBox::_draw(const Color &col, float size) const
void TextBox::_draw(const Color &col, [[maybe_unused]]float size) const
{
_box.draw();
if (!_font || _text.empty())
Expand Down Expand Up @@ -1518,7 +1519,8 @@ void Graph::draw(float size)
}
}

void VirtGap::_draw(const Color &col, float size) const
void VirtGap::_draw([[maybe_unused]]const Color &col,
[[maybe_unused]] float size) const
{
if (_entryPoint.x() - _exitPoint.x() < 4)
return;
Expand Down
5 changes: 3 additions & 2 deletions src/KsPlugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ getLastInBinEvents(kshark_trace_histo *histo, kshark_data_container *data,
* Do not resolve. This means that only the very last (in time)
* appearance of the event in the bin will be visualized.
*/
resolveFunc resolve = [] (kshark_data_container *data, ssize_t i,
PlotPointList *list) {};
resolveFunc resolve = [] ([[maybe_unused]] kshark_data_container *data,
[[maybe_unused]] ssize_t i,
[[maybe_unused]] PlotPointList *list) {};

return getInBinEvents(histo, data, isApplicable, push, resolve);
}
Expand Down
3 changes: 2 additions & 1 deletion src/KsSearchFSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ static bool matchCond(const QString &searchText, const QString &itemText)
return (itemText.compare(searchText, Qt::CaseInsensitive) == 0);
}

static bool noCond(const QString &searchText, const QString &itemText)
static bool noCond([[maybe_unused]] const QString &searchText,
[[maybe_unused]] const QString &itemText)
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/KsTraceGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ void KsTraceGraph::updateGeom()
* Reimplemented event handler used to update the geometry of the widget on
* resize events.
*/
void KsTraceGraph::resizeEvent(QResizeEvent* event)
void KsTraceGraph::resizeEvent([[maybe_unused]] QResizeEvent* event)
{
updateGeom();
}
Expand Down
10 changes: 5 additions & 5 deletions src/KsTraceViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* Reimplemented handler for creating delegate widget.
*/
QWidget *KsTableItemDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const {
[[maybe_unused]] const QStyleOptionViewItem &option,
[[maybe_unused]] const QModelIndex &index) const {
QTextEdit *edit = new QTextEdit(parent);
edit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
edit->setReadOnly(true);
Expand Down Expand Up @@ -295,12 +295,12 @@ void KsTraceViewer::_onCustomContextMenu(const QPoint &point)
}
}

void KsTraceViewer::_searchEdit(int index)
void KsTraceViewer::_searchEdit([[maybe_unused]] int index)
{
_searchReset(); // The search has been modified.
}

void KsTraceViewer::_searchEditText(const QString &text)
void KsTraceViewer::_searchEditText([[maybe_unused]] const QString &text)
{
_searchReset(); // The search has been modified.
}
Expand Down Expand Up @@ -550,7 +550,7 @@ void KsTraceViewer::markSwitch()
* Reimplemented event handler used to update the geometry of the widget on
* resize events.
*/
void KsTraceViewer::resizeEvent(QResizeEvent* event)
void KsTraceViewer::resizeEvent([[maybe_unused]] QResizeEvent* event)
{
int nColumns = _model.header().count();
int tableSize(0), viewSize, freeSpace;
Expand Down
2 changes: 1 addition & 1 deletion src/KsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ QCheckBox *addCheckBoxToMenu(QMenu *menu, QString name)
* @returns True if the CPU of the entry matches the value of "cpu" and
* the entry is visibility in Graph. Otherwise false.
*/
bool matchCPUVisible(struct kshark_context *kshark_ctx,
bool matchCPUVisible([[maybe_unused]] struct kshark_context *kshark_ctx,
struct kshark_entry *e, int sd, int *cpu)
{
return (e->cpu == *cpu &&
Expand Down
4 changes: 2 additions & 2 deletions src/KsWidgetsLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void KsCheckBoxTable::mousePressEvent(QMouseEvent *event)
QTableWidget::mousePressEvent(event);
}

void KsCheckBoxTable::_doubleClicked(int row, int col)
void KsCheckBoxTable::_doubleClicked(int row, [[maybe_unused]] int col)
{
emit changeState(row);
for (auto &i: selectedItems())
Expand Down Expand Up @@ -854,7 +854,7 @@ void KsCheckBoxTreeWidget::_adjustSize()
_topLayout.contentsMargins().right());
}

void KsCheckBoxTreeWidget::_update(QTreeWidgetItem *item, int column)
void KsCheckBoxTreeWidget::_update(QTreeWidgetItem *item, [[maybe_unused]] int column)
{
/* Get the new state of the item. */
Qt::CheckState state = item->checkState(0);
Expand Down
2 changes: 1 addition & 1 deletion src/KsWidgetsLib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class KsCheckBoxWidget : public QWidget
* Reimplemented event handler used to update the geometry of the widget on
* resize events.
*/
void resizeEvent(QResizeEvent* event) override
void resizeEvent([[maybe_unused]] QResizeEvent* event) override
{
KsUtils::setElidedText(&_streamLabel, _streamName,
Qt::ElideLeft, width());
Expand Down
4 changes: 2 additions & 2 deletions src/libkshark-model.c
Original file line number Diff line number Diff line change
Expand Up @@ -1274,14 +1274,14 @@ bool ksmodel_task_visible_event_exist(struct kshark_trace_histo *histo,
return true;
}

static bool match_cpu_missed_events(struct kshark_context *kshark_ctx,
static bool match_cpu_missed_events(__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry *e, int sd, int *cpu)
{
return e->event_id == KS_EVENT_OVERFLOW &&
e->cpu == *cpu && e->stream_id == sd;
}

static bool match_pid_missed_events(struct kshark_context *kshark_ctx,
static bool match_pid_missed_events(__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry *e, int sd, int *pid)
{
return e->event_id == KS_EVENT_OVERFLOW &&
Expand Down
6 changes: 3 additions & 3 deletions src/libkshark-tepdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,9 @@ static int tepdata_get_event_id(struct kshark_data_stream *stream,
return (event_id == -1)? -EFAULT : event_id;
}

static char* missed_events_dump(struct kshark_data_stream *stream,
const struct kshark_entry *entry,
bool get_info)
static char* missed_events_dump(__attribute__ ((unused)) struct kshark_data_stream *stream,
const struct kshark_entry *entry,
bool get_info)
{
char *buffer;
int size = 0;
Expand Down
10 changes: 5 additions & 5 deletions src/libkshark.c
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ ssize_t kshark_find_entry_by_time(int64_t time,
* @returns True if the Pid of the entry matches the value of "pid".
* Else false.
*/
bool kshark_match_pid(struct kshark_context *kshark_ctx,
bool kshark_match_pid(__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry *e, int sd, int *pid)
{
if (e->stream_id == sd && e->pid == *pid)
Expand All @@ -1592,7 +1592,7 @@ bool kshark_match_pid(struct kshark_context *kshark_ctx,
* @returns True if the Cpu of the entry matches the value of "cpu".
* Else false.
*/
bool kshark_match_cpu(struct kshark_context *kshark_ctx,
bool kshark_match_cpu(__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry *e, int sd, int *cpu)
{
if (e->stream_id == sd && e->cpu == *cpu)
Expand All @@ -1612,7 +1612,7 @@ bool kshark_match_cpu(struct kshark_context *kshark_ctx,
* @returns True if the event Id of the entry matches the value of "event_id".
* Else false.
*/
bool kshark_match_event_id(struct kshark_context *kshark_ctx,
bool kshark_match_event_id(__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry *e, int sd, int *event_id)
{
return e->stream_id == sd && e->event_id == *event_id;
Expand All @@ -1630,7 +1630,7 @@ bool kshark_match_event_id(struct kshark_context *kshark_ctx,
* @returns True if the event Id of the entry matches the values.
* Else false.
*/
bool kshark_match_event_and_pid(struct kshark_context *kshark_ctx,
bool kshark_match_event_and_pid(__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry *e,
int sd, int *values)
{
Expand All @@ -1651,7 +1651,7 @@ bool kshark_match_event_and_pid(struct kshark_context *kshark_ctx,
* @returns True if the event Id of the entry matches the values.
* Else false.
*/
bool kshark_match_event_and_cpu(struct kshark_context *kshark_ctx,
bool kshark_match_event_and_cpu(__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry *e,
int sd, int *values)
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/EventFieldDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void KsEFPDialog::_reset()
_gui_ptr->wipPtr()->hide(work);
}

static void showDialog(KsMainWindow *ks)
static void showDialog([[maybe_unused]] KsMainWindow *ks)
{
efp_dialog->update();
efp_dialog->show();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/LatencyPlotDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void LatencyPlotDialog::_reset()
_gui_ptr->wipPtr()->hide(work);
}

static void showDialog(KsMainWindow *ks)
static void showDialog([[maybe_unused]] KsMainWindow *ks)
{
lp_dialog->update();
lp_dialog->show();
Expand Down
16 changes: 8 additions & 8 deletions tests/test-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "libkshark-plugin.h"

static ssize_t load_entries(struct kshark_data_stream *stream,
struct kshark_context *kshark_ctx,
__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry ***data_rows)
{
struct kshark_entry **rows;
Expand All @@ -36,7 +36,7 @@ static ssize_t load_entries(struct kshark_data_stream *stream,
return total;
}

static char *dump_entry(struct kshark_data_stream *stream,
static char *dump_entry(__attribute__ ((unused)) struct kshark_data_stream *stream,
const struct kshark_entry *entry)
{
char *entry_str;
Expand All @@ -59,7 +59,7 @@ const char *KSHARK_INPUT_FORMAT()
return format_name;
}

bool KSHARK_INPUT_CHECK(const char *file, char **format)
bool KSHARK_INPUT_CHECK(const char *file, __attribute__ ((unused)) char **format)
{
char *ext = strrchr(file, '.');

Expand All @@ -69,14 +69,14 @@ bool KSHARK_INPUT_CHECK(const char *file, char **format)
return false;
}

static int get_pid(struct kshark_data_stream *stream,
static int get_pid(__attribute__ ((unused)) struct kshark_data_stream *stream,
const struct kshark_entry *entry)
{
return entry->pid;
}

static char *get_task(struct kshark_data_stream *stream,
const struct kshark_entry *entry)
static char *get_task(__attribute__ ((unused)) struct kshark_data_stream *stream,
__attribute__ ((unused)) const struct kshark_entry *entry)
{
char *entry_str;
int ret;
Expand All @@ -89,7 +89,7 @@ static char *get_task(struct kshark_data_stream *stream,
return entry_str;
}

static char *get_event_name(struct kshark_data_stream *stream,
static char *get_event_name(__attribute__ ((unused)) struct kshark_data_stream *stream,
const struct kshark_entry *entry)
{
char *evt_str;
Expand Down Expand Up @@ -130,5 +130,5 @@ int KSHARK_INPUT_INITIALIZER(struct kshark_data_stream *stream)
return 0;
}

void KSHARK_INPUT_DEINITIALIZER(struct kshark_data_stream *stream)
void KSHARK_INPUT_DEINITIALIZER(__attribute__ ((unused)) struct kshark_data_stream *stream)
{}
18 changes: 9 additions & 9 deletions tests/test-input_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "libkshark-plugin.h"

static ssize_t load_entries(struct kshark_data_stream *stream,
struct kshark_context *kshark_ctx,
__attribute__ ((unused)) struct kshark_context *kshark_ctx,
struct kshark_entry ***data_rows)
{
struct kshark_entry **rows;
Expand All @@ -37,7 +37,7 @@ static ssize_t load_entries(struct kshark_data_stream *stream,
return total;
}

static char *dump_entry(struct kshark_data_stream *stream,
static char *dump_entry(__attribute__ ((unused)) struct kshark_data_stream *stream,
const struct kshark_entry *entry)
{
char *entry_str;
Expand All @@ -61,7 +61,7 @@ const char *KSHARK_INPUT_FORMAT()
return format_name;
}

bool KSHARK_INPUT_CHECK(const char *file, char **format)
bool KSHARK_INPUT_CHECK(const char *file, __attribute__ ((unused)) char **format)
{
char *ext = strrchr(file, '.');

Expand All @@ -71,14 +71,14 @@ bool KSHARK_INPUT_CHECK(const char *file, char **format)
return false;
}

static int get_pid(struct kshark_data_stream *stream,
static int get_pid(__attribute__ ((unused)) struct kshark_data_stream *stream,
const struct kshark_entry *entry)
{
return entry->pid;
}

static char *get_task(struct kshark_data_stream *stream,
const struct kshark_entry *entry)
static char *get_task(__attribute__ ((unused)) struct kshark_data_stream *stream,
__attribute__ ((unused)) const struct kshark_entry *entry)
{
char *entry_str;
int ret;
Expand All @@ -91,7 +91,7 @@ static char *get_task(struct kshark_data_stream *stream,
return entry_str;
}

static char *get_event_name(struct kshark_data_stream *stream,
static char *get_event_name(__attribute__ ((unused)) struct kshark_data_stream *stream,
const struct kshark_entry *entry)
{
char *evt_str;
Expand Down Expand Up @@ -130,11 +130,11 @@ int KSHARK_INPUT_INITIALIZER(struct kshark_data_stream *stream)
return 0;
}

void KSHARK_INPUT_DEINITIALIZER(struct kshark_data_stream *stream)
void KSHARK_INPUT_DEINITIALIZER(__attribute__ ((unused)) struct kshark_data_stream *stream)
{}

/** Initialize the control interface of the plugin. */
void *KSHARK_MENU_PLUGIN_INITIALIZER(void *ptr)
void *KSHARK_MENU_PLUGIN_INITIALIZER(__attribute__ ((unused)) void *ptr)
{
return NULL;
}
Loading

0 comments on commit 932b147

Please sign in to comment.