Userland: Resolve -Woverloaded-virtual in LibGUI and SoundPlayer

Enable the warning project-wide. It catches when a non-virtual method
creates an overload set with a virtual method. This might cause
surprising overload resolution depending on how the method is invoked.
This commit is contained in:
Andrew Kaster 2022-01-03 01:34:29 -07:00 committed by Brian Gianforcaro
parent ed3cb88898
commit c8cfd6661a
5 changed files with 7 additions and 8 deletions

View file

@ -195,7 +195,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wcast-align)
add_compile_options(-Wdouble-promotion)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
add_compile_options(-Wno-overloaded-virtual)
add_compile_options(-Wno-user-defined-literals)
add_compile_options(-Wno-atomic-alignment)
add_compile_options(-Wno-c99-designator)

View file

@ -13,10 +13,10 @@ class AutoSlider final : public GUI::Slider {
public:
~AutoSlider() override = default;
Function<void(int)> on_knob_released;
void set_value(int value)
virtual void set_value(int value, GUI::AllowCallback allow_callback = GUI::AllowCallback::Yes) override
{
if (!knob_dragging() && !mouse_is_down())
GUI::Slider::set_value(value);
GUI::Slider::set_value(value, allow_callback);
}
bool mouse_is_down() const { return m_mouse_is_down; }

View file

@ -682,7 +682,7 @@ void IconView::toggle_selection(ItemData& item_data)
if (!item_data.selected)
add_selection(item_data);
else
remove_selection(item_data);
remove_item_selection(item_data);
}
void IconView::toggle_selection(const ModelIndex& new_index)
@ -692,7 +692,7 @@ void IconView::toggle_selection(const ModelIndex& new_index)
toggle_selection(get_item_data(item_index));
}
void IconView::remove_selection(ItemData& item_data)
void IconView::remove_item_selection(ItemData& item_data)
{
if (!item_data.selected)
return;

View file

@ -143,7 +143,7 @@ private:
void do_clear_selection();
bool do_add_selection(ItemData&);
void add_selection(ItemData&);
void remove_selection(ItemData&);
void remove_item_selection(ItemData&);
void toggle_selection(ItemData&);
int m_horizontal_padding { 5 };

View file

@ -69,10 +69,10 @@ public:
auto& gcf_params = static_cast<const GenericConvolutionFilter::Parameters&>(parameters);
ApplyCache apply_cache;
apply(target_bitmap, target_rect, source_bitmap, source_rect, gcf_params, apply_cache);
apply_with_cache(target_bitmap, target_rect, source_bitmap, source_rect, gcf_params, apply_cache);
}
void apply(Bitmap& target, IntRect target_rect, const Bitmap& source, const IntRect& source_rect, const GenericConvolutionFilter::Parameters& parameters, ApplyCache& apply_cache)
void apply_with_cache(Bitmap& target, IntRect target_rect, const Bitmap& source, const IntRect& source_rect, const GenericConvolutionFilter::Parameters& parameters, ApplyCache& apply_cache)
{
// The target area (where the filter is applied) must be entirely
// contained by the source area. source_rect should be describing