Skip to content

Commit

Permalink
Enable and fix extra and pedantic warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasWM committed Feb 25, 2024
1 parent 4649188 commit 480614c
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 30 deletions.
8 changes: 8 additions & 0 deletions fluid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ else()

endif()

if (MSVC)
target_compile_options(fluid-lib PRIVATE /W4 /WX)
target_compile_options(fluid PRIVATE /W4 /WX)
else()
target_compile_options(fluid-lib PRIVATE -std=c++11 -Wall -Wextra -pedantic -Werror -Wno-missing-field-initializers)
target_compile_options(fluid PRIVATE -std=c++11 -Wall -Wextra -pedantic -Werror -Wno-missing-field-initializers)
endif()

target_link_libraries(fluid PRIVATE fluid-lib)

# Build the console app on Windows
Expand Down
19 changes: 10 additions & 9 deletions fluid/Fd_Snap_Action.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,7 @@ class Fd_Snap_Window_Grid : public Fd_Snap_Grid {
layout->top_window_margin, layout->window_grid_y, d.win->o->h()-layout->bottom_window_margin);
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
(void)d;
draw_grid(nearest_x, nearest_y, layout->window_grid_x, layout->window_grid_y);
};
};
Expand All @@ -1428,7 +1429,7 @@ class Fd_Snap_Group_Grid : public Fd_Snap_Grid {
g->y()+layout->top_group_margin, layout->group_grid_y, g->y()+g->h()-layout->bottom_group_margin);
}
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
draw_grid(nearest_x, nearest_y, layout->group_grid_x, layout->group_grid_y);
};
};
Expand Down Expand Up @@ -1482,7 +1483,7 @@ class Fd_Snap_Siblings_Left_Same : public Fd_Snap_Sibling {
int sibling_check(Fd_Snap_Data &d, Fl_Widget *s) FL_OVERRIDE {
return check_x_(d, d.bx, s->x());
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
if (best_match) draw_left_brace(best_match);
};
};
Expand All @@ -1498,7 +1499,7 @@ class Fd_Snap_Siblings_Left : public Fd_Snap_Sibling {
return fd_min(check_x_(d, d.bx, s->x()+s->w()),
check_x_(d, d.bx, s->x()+s->w()+layout->widget_gap_x) );
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
if (best_match) draw_right_brace(best_match);
};
};
Expand All @@ -1510,7 +1511,7 @@ class Fd_Snap_Siblings_Right_Same : public Fd_Snap_Sibling {
int sibling_check(Fd_Snap_Data &d, Fl_Widget *s) FL_OVERRIDE {
return check_x_(d, d.br, s->x()+s->w());
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
if (best_match) draw_right_brace(best_match);
};
};
Expand All @@ -1523,7 +1524,7 @@ class Fd_Snap_Siblings_Right : public Fd_Snap_Sibling {
return fd_min(check_x_(d, d.br, s->x()),
check_x_(d, d.br, s->x()-layout->widget_gap_x));
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
if (best_match) draw_left_brace(best_match);
};
};
Expand All @@ -1535,7 +1536,7 @@ class Fd_Snap_Siblings_Top_Same : public Fd_Snap_Sibling {
int sibling_check(Fd_Snap_Data &d, Fl_Widget *s) FL_OVERRIDE {
return check_y_(d, d.by, s->y());
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
if (best_match) draw_top_brace(best_match);
};
};
Expand All @@ -1548,7 +1549,7 @@ class Fd_Snap_Siblings_Top : public Fd_Snap_Sibling {
return fd_min(check_y_(d, d.by, s->y()+s->h()),
check_y_(d, d.by, s->y()+s->h()+layout->widget_gap_y));
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
if (best_match) draw_bottom_brace(best_match);
};
};
Expand All @@ -1560,7 +1561,7 @@ class Fd_Snap_Siblings_Bottom_Same : public Fd_Snap_Sibling {
int sibling_check(Fd_Snap_Data &d, Fl_Widget *s) FL_OVERRIDE {
return check_y_(d, d.bt, s->y()+s->h());
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
if (best_match) draw_bottom_brace(best_match);
};
};
Expand All @@ -1573,7 +1574,7 @@ class Fd_Snap_Siblings_Bottom : public Fd_Snap_Sibling {
return fd_min(check_y_(d, d.bt, s->y()),
check_y_(d, d.bt, s->y()-layout->widget_gap_y));
}
void draw(Fd_Snap_Data &d) FL_OVERRIDE {
void draw(Fd_Snap_Data &) FL_OVERRIDE {
if (best_match) draw_top_brace(best_match);
};
};
Expand Down
2 changes: 1 addition & 1 deletion fluid/Fd_Snap_Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Fd_Snap_Action {
Fd_Snap_Action() : ex(0x7fff), ey(0x7fff), dx(128), dy(128), type(0), mask(0) { }
virtual ~Fd_Snap_Action() { }
virtual void check(Fd_Snap_Data &d) = 0;
virtual void draw(Fd_Snap_Data &d) { }
virtual void draw(Fd_Snap_Data &d) { (void)d; }
virtual bool matches(Fd_Snap_Data &d);
public:
static int eex, eey;
Expand Down
8 changes: 4 additions & 4 deletions fluid/Fl_Function_Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Fl_Code_Type : public Fl_Type
Fl_Type *make(Strategy strategy) FL_OVERRIDE;
void write(Fd_Project_Writer &f) FL_OVERRIDE;
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { }
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { (void)f; }
void open() FL_OVERRIDE;
const char *type_name() FL_OVERRIDE {return "code";}
int is_code_block() const FL_OVERRIDE {return 0;}
Expand Down Expand Up @@ -135,7 +135,7 @@ class Fl_Decl_Type : public Fl_Type
Fl_Decl_Type();
Fl_Type *make(Strategy strategy) FL_OVERRIDE;
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { }
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { (void)f; }
void open() FL_OVERRIDE;
const char *type_name() FL_OVERRIDE {return "decl";}
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
Expand All @@ -158,7 +158,7 @@ class Fl_Data_Type : public Fl_Decl_Type
~Fl_Data_Type();
Fl_Type *make(Strategy strategy) FL_OVERRIDE;
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE {}
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { (void)f; }
void open() FL_OVERRIDE;
const char *type_name() FL_OVERRIDE {return "data";}
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
Expand Down Expand Up @@ -203,7 +203,7 @@ class Fl_Comment_Type : public Fl_Type
Fl_Comment_Type();
Fl_Type *make(Strategy strategy) FL_OVERRIDE;
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { }
void write_code2(Fd_Code_Writer& f) FL_OVERRIDE { (void)f; }
void open() FL_OVERRIDE;
const char *type_name() FL_OVERRIDE {return "comment";}
void write_properties(Fd_Project_Writer &f) FL_OVERRIDE;
Expand Down
16 changes: 8 additions & 8 deletions fluid/Fl_Grid_Type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -820,13 +820,13 @@ void grid_set_row_cb(Fluid_Coord_Input* i, void* v) {
grid_child_cb(i, v, 8);
if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
}
void grid_dec_row_cb(Fl_Button* i, void* v) {
void grid_dec_row_cb(Fl_Button*, void* v) {
if (v!=LOAD) {
grid_child_cb(widget_grid_row_input, v, 0x0100 + 8);
widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
}
}
void grid_inc_row_cb(Fl_Button* i, void* v) {
void grid_inc_row_cb(Fl_Button*, void* v) {
if (v!=LOAD) {
grid_child_cb(widget_grid_row_input, v, 0x0200 + 8);
widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
Expand All @@ -836,13 +836,13 @@ void grid_set_col_cb(Fluid_Coord_Input* i, void* v) {
grid_child_cb(i, v, 9);
if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
}
void grid_dec_col_cb(Fl_Button* i, void* v) {
void grid_dec_col_cb(Fl_Button*, void* v) {
if (v!=LOAD) {
grid_child_cb(widget_grid_col_input, v, 0x0100 + 9);
widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
}
}
void grid_inc_col_cb(Fl_Button* i, void* v) {
void grid_inc_col_cb(Fl_Button*, void* v) {
if (v!=LOAD) {
grid_child_cb(widget_grid_col_input, v, 0x0200 + 9);
widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
Expand All @@ -852,13 +852,13 @@ void grid_set_rowspan_cb(Fluid_Coord_Input* i, void* v) {
grid_child_cb(i, v, 10);
if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
}
void grid_dec_rowspan_cb(Fl_Button* i, void* v) {
void grid_dec_rowspan_cb(Fl_Button*, void* v) {
if (v!=LOAD) {
grid_child_cb(widget_grid_rowspan_input, v, 0x0100 + 10);
widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
}
}
void grid_inc_rowspan_cb(Fl_Button* i, void* v) {
void grid_inc_rowspan_cb(Fl_Button*, void* v) {
if (v!=LOAD) {
grid_child_cb(widget_grid_rowspan_input, v, 0x0200 + 10);
widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
Expand All @@ -868,13 +868,13 @@ void grid_set_colspan_cb(Fluid_Coord_Input* i, void* v) {
grid_child_cb(i, v, 11);
if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
}
void grid_dec_colspan_cb(Fl_Button* i, void* v) {
void grid_dec_colspan_cb(Fl_Button*, void* v) {
if (v!=LOAD) {
grid_child_cb(widget_grid_colspan_input, v, 0x0100 + 11);
widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
}
}
void grid_inc_colspan_cb(Fl_Button* i, void* v) {
void grid_inc_colspan_cb(Fl_Button*, void* v) {
if (v!=LOAD) {
grid_child_cb(widget_grid_colspan_input, v, 0x0200 + 11);
widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);
Expand Down
4 changes: 2 additions & 2 deletions fluid/Fl_Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ class Fl_Type {

virtual Fl_Type* click_test(int,int) { return NULL; }

virtual void add_child(Fl_Type*, Fl_Type* beforethis) { }
virtual void move_child(Fl_Type*, Fl_Type* beforethis) { }
virtual void add_child(Fl_Type*, Fl_Type* beforethis) { (void)beforethis; }
virtual void move_child(Fl_Type*, Fl_Type* beforethis) { (void)beforethis; }
virtual void remove_child(Fl_Type*) { }

/** Give widgets a change to arrange their children after all children were add.
Expand Down
1 change: 1 addition & 0 deletions fluid/Fl_Widget_Type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ Fluid_Coord_Input *x_input, *y_input, *w_input, *h_input;
static int widget_i = 0;

static int vars_i_cb(const Fluid_Coord_Input*, void *v) {
(void)v;
return widget_i;
}

Expand Down
4 changes: 4 additions & 0 deletions fluid/Fl_Window_Type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,8 @@ void toggle_guides(Fl_Widget *,void *) {
This is called from the check button in the Settings dialog.
*/
void toggle_guides_cb(Fl_Check_Button *o, void *v) {
(void)o;
(void)v;
toggle_guides(NULL, NULL);
}

Expand Down Expand Up @@ -829,6 +831,8 @@ void toggle_ghosted_outline_cb(Fl_Check_Button *,void *) {
This is called from the check button in the Settings dialog.
*/
void toggle_restricted_cb(Fl_Check_Button *o, void *v) {
(void)o;
(void)v;
toggle_restricted(NULL, NULL);
}

Expand Down
1 change: 1 addition & 0 deletions fluid/Fluid_Image.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ void Fluid_Image::write_code(Fd_Code_Writer& f, int bind, const char *var, int i
}

void Fluid_Image::write_inline(Fd_Code_Writer& f, int inactive) {
(void)inactive;
if (img)
f.write_c("%s()", function_name_);
}
Expand Down
3 changes: 2 additions & 1 deletion fluid/alignment_panel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,7 @@ Fl_Menu_Item menu_Condition[] = {
};

static void cb_Label(Fl_Input* o, void* v) {
(void)o;
if (v == LOAD) {
// o->value(g_shell_command.c_str());
} else {
Expand Down Expand Up @@ -2438,6 +2439,7 @@ Fl_Double_Window* make_settings_window() {
o->image( image_general_64() );
o->image()->scale(36, 24, 0, 1);
o->labelsize(11);
o->hide();
{ Fl_Group* o = new Fl_Group(120, 78, 130, 25);
o->callback((Fl_Callback*)cb_);
{ scheme_choice = new Fl_Scheme_Choice(120, 78, 120, 25, "Scheme: ");
Expand Down Expand Up @@ -2999,7 +3001,6 @@ itional data in code and project files.");
w_settings_shell_tab->image()->scale(36, 24, 0, 1);
w_settings_shell_tab->labelsize(11);
w_settings_shell_tab->callback((Fl_Callback*)propagate_load);
w_settings_shell_tab->hide();
{ Fl_Group* o = new Fl_Group(10, 90, 320, 132);
o->callback((Fl_Callback*)propagate_load);
{ w_settings_shell_list = new Fl_Browser(100, 90, 220, 110, "Shell\ncommand\nlist:");
Expand Down
11 changes: 6 additions & 5 deletions fluid/alignment_panel.fl
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ Function {make_settings_window()} {open
xywh {10 10 320 530} selection_color 12 labelsize 11 labelcolor 255 resizable
} {
Fl_Group {} {
label General open selected
scale_image {36 24} image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 resizable
label General open
scale_image {36 24} image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide resizable
} {
Fl_Group {} {
callback {propagate_load(o, v);} open
Expand Down Expand Up @@ -893,7 +893,7 @@ g_layout_list.update_dialogs();}
Fl_Group w_settings_shell_tab {
label Shell
callback propagate_load open
scale_image {36 24} image {icons/shell_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
scale_image {36 24} image {icons/shell_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11
} {
Fl_Group {} {
callback propagate_load open
Expand Down Expand Up @@ -1244,11 +1244,12 @@ if (v == LOAD) {
}
Fl_Input {} {
label {Label:}
callback {if (v == LOAD) {
callback {(void)o;
if (v == LOAD) {
// o->value(g_shell_command.c_str());
} else {
// g_shell_command = o->value();
}}
}} selected
xywh {230 348 90 20} labelfont 1 labelsize 11 textfont 4 textsize 11 hide
}
Fl_Group {} {
Expand Down
2 changes: 2 additions & 0 deletions fluid/shell_command.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ void Fd_Shell_Command_List::clear(Fd_Tool_Store storage) {
Read shell configuration from a preferences group.
*/
void Fd_Shell_Command_List::read(Fl_Preferences &prefs, Fd_Tool_Store storage) {
(void)storage;
// import the old shell commands from previous user settings
if (&fluid_prefs == &prefs) {
int version;
Expand Down Expand Up @@ -751,6 +752,7 @@ void Fd_Shell_Command_List::read(Fl_Preferences &prefs, Fd_Tool_Store storage) {
Write shell configuration to a preferences group.
*/
void Fd_Shell_Command_List::write(Fl_Preferences &prefs, Fd_Tool_Store storage) {
(void)storage;
Fl_Preferences shell_commands(prefs, "shell_commands");
shell_commands.delete_all_groups();
int index = 0;
Expand Down
1 change: 1 addition & 0 deletions fluid/widget_panel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ Fluid_Coord_Input *widget_grid_col_input=(Fluid_Coord_Input *)0;
Fl_Box *widget_grid_transient=(Fl_Box *)0;

static void cb_widget_grid_transient(Fl_Box* o, void* v) {
(void)o;
if (v==LOAD) {
Fl_Widget *child = ((Fl_Widget_Type*)current_widget)->o;
Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Fl_Widget_Type*)current_widget->parent)->o);
Expand Down

0 comments on commit 480614c

Please sign in to comment.