wm: enable strict warning level

Issue #3094
This commit is contained in:
Norman Feske 2018-12-10 16:23:43 +01:00
parent 7f1692b3ca
commit b3fa7b0650
6 changed files with 94 additions and 58 deletions

View File

@ -19,33 +19,40 @@
#include <util/xml_generator.h>
#include <report_session/client.h>
struct Local_reporter
class Local_reporter
{
Report::Session_client _session;
private:
Genode::Attached_dataspace _ds;
Local_reporter(Local_reporter const &);
Local_reporter &operator = (Local_reporter const &);
char const *_name;
Report::Session_client _session;
Local_reporter(Genode::Region_map &rm, char const *name,
Genode::Capability<Report::Session> session_cap)
:
_session(session_cap), _ds(rm, _session.dataspace()), _name(name)
{ }
Genode::Attached_dataspace _ds;
struct Xml_generator : public Genode::Xml_generator
{
template <typename FUNC>
Xml_generator(Local_reporter &reporter, FUNC const &func)
char const *_name;
public:
Local_reporter(Genode::Region_map &rm, char const *name,
Genode::Capability<Report::Session> session_cap)
:
Genode::Xml_generator(reporter._ds.local_addr<char>(),
reporter._ds.size(),
reporter._name,
func)
_session(session_cap), _ds(rm, _session.dataspace()), _name(name)
{ }
struct Xml_generator : public Genode::Xml_generator
{
reporter._session.submit(used());
}
};
template <typename FUNC>
Xml_generator(Local_reporter &reporter, FUNC const &func)
:
Genode::Xml_generator(reporter._ds.local_addr<char>(),
reporter._ds.size(),
reporter._name,
func)
{
reporter._session.submit(used());
}
};
};
#endif /* _INCLUDE__GEMS__LOCAL_REPORTER_H_ */

View File

@ -36,6 +36,7 @@ namespace Wm { class Main;
using Genode::Attached_ram_dataspace;
using Genode::Signal_handler;
using Genode::Reporter;
using Genode::Interface;
}
@ -47,7 +48,7 @@ namespace Wm {
}
struct Wm::Decorator_content_callback
struct Wm::Decorator_content_callback : Interface
{
virtual void content_geometry(Window_registry::Id win_id, Rect rect) = 0;
@ -81,7 +82,7 @@ class Wm::Decorator_content_registry
{ }
};
List<Entry> _list;
List<Entry> _list { };
Allocator &_entry_alloc;
Entry const &_lookup(Nitpicker::Session::View_handle view_handle) const
@ -149,8 +150,11 @@ class Wm::Decorator_content_registry
struct Wm::Decorator_nitpicker_session : Genode::Rpc_object<Nitpicker::Session>,
List<Decorator_nitpicker_session>::Element
private List<Decorator_nitpicker_session>::Element
{
friend class List<Decorator_nitpicker_session>;
using List<Decorator_nitpicker_session>::Element::next;
typedef Nitpicker::View_capability View_capability;
typedef Nitpicker::Session::View_handle View_handle;
@ -162,7 +166,7 @@ struct Wm::Decorator_nitpicker_session : Genode::Rpc_object<Nitpicker::Session>,
Nitpicker::Connection _nitpicker_session { _env, "decorator" };
Genode::Signal_context_capability _mode_sigh;
Genode::Signal_context_capability _mode_sigh { };
typedef Nitpicker::Session::Command_buffer Command_buffer;

View File

@ -37,7 +37,7 @@ struct Wm::Layouter_nitpicker_session : Genode::Rpc_object<Nitpicker::Session>
*/
Nitpicker::Connection _mode_sigh_nitpicker;
Genode::Signal_context_capability _mode_sigh;
Genode::Signal_context_capability _mode_sigh { };
Attached_ram_dataspace _command_ds;

View File

@ -51,6 +51,7 @@ namespace Wm {
using Genode::Signal_transmitter;
using Genode::Reporter;
using Genode::Capability;
using Genode::Interface;
}
namespace Wm { namespace Nitpicker {
@ -81,19 +82,24 @@ namespace Wm { namespace Nitpicker {
* clicks into an already focused window should be of no interest to the
* layouter. So we hide them from the layouter.
*/
struct Wm::Nitpicker::Click_handler
struct Wm::Nitpicker::Click_handler : Interface
{
virtual void handle_click(Point pos) = 0;
virtual void handle_enter(Point pos) = 0;
};
struct Nitpicker::View { GENODE_RPC_INTERFACE(); };
struct Nitpicker::View : Genode::Interface { GENODE_RPC_INTERFACE(); };
class Wm::Nitpicker::View : public Genode::Weak_object<View>,
class Wm::Nitpicker::View : private Genode::Weak_object<View>,
public Genode::Rpc_object< ::Nitpicker::View>
{
private:
friend class Genode::Weak_ptr<View>;
friend class Genode::Locked_ptr<View>;
protected:
typedef Genode::String<100> Title;
@ -102,12 +108,12 @@ class Wm::Nitpicker::View : public Genode::Weak_object<View>,
Session_label _session_label;
Nitpicker::Session_client &_real_nitpicker;
View_handle _real_handle;
Title _title;
Rect _geometry;
Point _buffer_offset;
Weak_ptr<View> _neighbor_ptr;
bool _neighbor_behind;
View_handle _real_handle { };
Title _title { };
Rect _geometry { };
Point _buffer_offset { };
Weak_ptr<View> _neighbor_ptr { };
bool _neighbor_behind { };
bool _has_alpha;
View(Nitpicker::Session_client &real_nitpicker,
@ -165,6 +171,9 @@ class Wm::Nitpicker::View : public Genode::Weak_object<View>,
_real_nitpicker.destroy_view(_real_handle);
}
using Genode::Weak_object<View>::weak_ptr;
using Genode::Weak_object<View>::lock_for_destruction;
Point virtual_position() const { return _geometry.p1(); }
virtual bool belongs_to_win_id(Window_registry::Id id) const = 0;
@ -194,7 +203,7 @@ class Wm::Nitpicker::View : public Genode::Weak_object<View>,
virtual Point input_anchor_position() const = 0;
virtual void stack(Weak_ptr<View> neighbor_ptr, bool behind) { }
virtual void stack(Weak_ptr<View>, bool) { }
View_handle real_handle() const { return _real_handle; }
@ -218,11 +227,13 @@ class Wm::Nitpicker::View : public Genode::Weak_object<View>,
class Wm::Nitpicker::Top_level_view : public View,
public List<Top_level_view>::Element
private List<Top_level_view>::Element
{
private:
Window_registry::Id _win_id;
friend class List<Top_level_view>;
Window_registry::Id _win_id { };
Window_registry &_window_registry;
@ -230,11 +241,11 @@ class Wm::Nitpicker::Top_level_view : public View,
* Geometry of window-content view, which corresponds to the location
* of the window content as known by the decorator.
*/
Rect _content_geometry;
Rect _content_geometry { };
bool _resizeable = false;
Title _window_title;
Title _window_title { };
Session_label _session_label;
typedef Nitpicker::Session::Command Command;
@ -259,6 +270,8 @@ class Wm::Nitpicker::Top_level_view : public View,
View::lock_for_destruction();
}
using List<Top_level_view>::Element::next;
void _propagate_view_geometry() override { }
void geometry(Rect geometry) override
@ -337,10 +350,12 @@ class Wm::Nitpicker::Top_level_view : public View,
class Wm::Nitpicker::Child_view : public View,
public List<Child_view>::Element
private List<Child_view>::Element
{
private:
friend class List<Child_view>;
Weak_ptr<View> mutable _parent;
public:
@ -360,6 +375,8 @@ class Wm::Nitpicker::Child_view : public View,
View::lock_for_destruction();
}
using List<Child_view>::Element::next;
void _propagate_view_geometry() override
{
_real_nitpicker.enqueue<Command::Geometry>(_real_handle, _geometry);
@ -418,7 +435,7 @@ class Wm::Nitpicker::Child_view : public View,
};
struct Wm::Nitpicker::Session_control_fn
struct Wm::Nitpicker::Session_control_fn : Interface
{
virtual void session_control(char const *selector, Session::Session_control) = 0;
@ -426,10 +443,12 @@ struct Wm::Nitpicker::Session_control_fn
class Wm::Nitpicker::Session_component : public Rpc_object<Nitpicker::Session>,
public List<Session_component>::Element
private List<Session_component>::Element
{
private:
friend class List<Session_component>;
typedef Nitpicker::Session::View_handle View_handle;
Genode::Env &_env;
@ -442,13 +461,13 @@ class Wm::Nitpicker::Session_component : public Rpc_object<Nitpicker::Session>,
Session_control_fn &_session_control_fn;
Tslab<Top_level_view, 4000> _top_level_view_alloc;
Tslab<Child_view, 4000> _child_view_alloc;
List<Top_level_view> _top_level_views;
List<Child_view> _child_views;
List<Top_level_view> _top_level_views { };
List<Child_view> _child_views { };
Input::Session_component _input_session { _env, _ram };
Input::Session_capability _input_session_cap;
Click_handler &_click_handler;
Signal_context_capability _mode_sigh;
Area _requested_size;
Signal_context_capability _mode_sigh { };
Area _requested_size { };
bool _resize_requested = false;
bool _has_alpha = false;
Point const _initial_pointer_pos { -1, -1 };
@ -744,6 +763,8 @@ class Wm::Nitpicker::Session_component : public Rpc_object<Nitpicker::Session>,
_env.ep().dissolve(_input_session);
}
using List<Session_component>::Element::next;
void upgrade(char const *args)
{
size_t const ram_quota = Arg_string::find_arg(args, "ram_quota").ulong_value(0);
@ -986,6 +1007,12 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
{
private:
/**
* Noncopyable
*/
Root(Root const &);
Root &operator = (Root const &);
Genode::Env &_env;
Genode::Attached_rom_dataspace _config { _env, "config" };
@ -1064,11 +1091,11 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
/**
* List of regular sessions
*/
List<Session_component> _sessions;
List<Session_component> _sessions { };
Layouter_nitpicker_session *_layouter_session = nullptr;
List<Decorator_nitpicker_session> _decorator_sessions;
List<Decorator_nitpicker_session> _decorator_sessions { };
/**
* Nitpicker session used to perform session-control operations
@ -1104,7 +1131,7 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object<Genode::Typed_root<Session
********************/
Genode::Session_capability session(Session_args const &args,
Affinity const &affinity) override
Affinity const &) override
{
Genode::Session_label const session_label =
Genode::label_from_args(args.string());

View File

@ -2,5 +2,3 @@ TARGET = wm
SRC_CC = main.cc
LIBS = base
INC_DIR += $(PRG_DIR)
CC_CXX_WARN_STRICT =

View File

@ -76,9 +76,9 @@ class Wm::Window_registry
struct Attr
{
Title title;
Session_label label;
Area size;
Title title { };
Session_label label { };
Area size { };
Has_alpha has_alpha = HAS_NO_ALPHA;
Hidden hidden = NOT_HIDDEN;
Resizeable resizeable = NOT_RESIZEABLE;
@ -94,8 +94,8 @@ class Wm::Window_registry
}
};
Attr _attr;
Attr mutable _flushed_attr;
Attr _attr { };
Attr mutable _flushed_attr { };
friend class Window_registry;
@ -164,9 +164,9 @@ class Wm::Window_registry
enum { MAX_WINDOWS = 1024 };
Genode::Bit_allocator<MAX_WINDOWS> _window_ids;
Genode::Bit_allocator<MAX_WINDOWS> _window_ids { };
List<Window> _windows;
List<Window> _windows { };
Window *_lookup(Id id)
{