Add warning about unused parameters to CMake config and fix code accordingly

This commit is contained in:
Mario Hüttel 2019-08-26 20:01:32 +02:00
parent f60150e8c7
commit 3489b74027
6 changed files with 34 additions and 1 deletions

View File

@ -32,7 +32,7 @@ set(SOURCE
${LAYER_SELECTOR_SOURCES}
)
add_compile_options(-Wall -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized)
add_compile_options(-Wall -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter)
add_executable(${PROJECT_NAME} ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c)
add_dependencies(${PROJECT_NAME} glib-resources)

View File

@ -42,6 +42,7 @@ enum {
void lib_cell_renderer_init(LibCellRenderer *self)
{
(void)self;
/* Nothing to do */
}
@ -111,6 +112,8 @@ static void lib_cell_renderer_get_property(GObject *object,
GValue *value,
GParamSpec *pspec)
{
(void)value;
switch (param_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);

View File

@ -86,6 +86,7 @@ G_DEFINE_TYPE(GdsRenderGui, gds_render_gui, G_TYPE_OBJECT)
static gboolean on_window_close(gpointer window, GdkEvent *event, gpointer user)
{
GdsRenderGui *self;
(void)event;
self = RENDERER_GUI(user);
/* Don't close window in case of error */

View File

@ -91,6 +91,17 @@ void bounding_box_prepare_empty(union bounding_box *box)
box->vectors.upper_right.y = -DBL_MAX;
}
/**
* @brief Calculate path miter points for a pathwith a \p width and the anchors \p a \p b \p c.
* @param[in] a
* @param[in] b
* @param[in] c
* @param[out] m1
* @param[out] m2
* @param[in] width
* @return Miter points in \p m1 and \p m2
* @note This function is currently unused (and untested). Ignore any compiler warning regarding this function.
*/
static void calculate_path_miter_points(struct vector_2d *a, struct vector_2d *b, struct vector_2d *c,
struct vector_2d *m1, struct vector_2d *m2, double width)
{

View File

@ -158,6 +158,14 @@ static void layer_selector_drag_data_received(GtkWidget *widget, GdkDragContext
GtkWidget *source;
int pos;
/* Handle unused parameters */
(void)context;
(void)x;
(void)y;
(void)info;
(void)time;
(void)data;
row_before = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "row-before"));
row_after = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "row-after"));
@ -196,6 +204,10 @@ static gboolean layer_selector_drag_motion(GtkWidget *widget, GdkDragContext *co
GtkWidget *drag_row;
GtkWidget *row_before;
GtkWidget *row_after;
(void)context;
(void)x;
(void)y;
(void)time;
row = GTK_WIDGET(gtk_list_box_get_row_at_y(GTK_LIST_BOX(widget), y));
@ -249,6 +261,8 @@ static void layer_selector_drag_leave(GtkWidget *widget, GdkDragContext *context
GtkWidget *drag_row;
GtkWidget *row_before;
GtkWidget *row_after;
(void)context;
(void)time;
drag_row = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "drag-row"));
row_before = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "row-before"));
@ -664,6 +678,7 @@ static void layer_selector_load_mapping_clicked(GtkWidget *button, gpointer user
GtkWidget *dialog;
gint res;
gchar *file_name;
(void)button;
sel = LAYER_SELECTOR(user_data);
@ -723,6 +738,7 @@ static void layer_selector_save_mapping_clicked(GtkWidget *button, gpointer user
gint res;
gchar *file_name;
LayerSelector *sel;
(void)button;
sel = LAYER_SELECTOR(user_data);

View File

@ -321,6 +321,8 @@ static void gds_output_renderer_async_wrapper(GTask *task,
GdsOutputRenderer *renderer;
GdsOutputRendererPrivate *priv;
int ret;
(void)task_data;
(void)cancellable;
renderer = GDS_RENDER_OUTPUT_RENDERER(source_object);
priv = gds_output_renderer_get_instance_private(renderer);