This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 22/22] Introduce enum_flag type for ui_out flags
- From: Simon Marchi <simon dot marchi at polymtl dot ca>
- To: gdb-patches at sourceware dot org
- Cc: Simon Marchi <simon dot marchi at polymtl dot ca>
- Date: Thu, 24 Nov 2016 10:32:28 -0500
- Subject: [PATCH 22/22] Introduce enum_flag type for ui_out flags
- Authentication-results: sourceware.org; auth=none
- References: <20161124152428.24725-1-simon.marchi@polymtl.ca>
This patch changes the ui_out flags to be an enum flag.
gdb/ChangeLog:
* ui-out.c (ui_out::test_flags): Change type of parameter to
ui_out_flags.
(ui_out::ui_out): Likewise.
* ui-out.h (enum ui_flags): Rename to ...
(enum ui_out_flag): ... this.
(ui_out_flags): Define enum flag type.
(ui_out::ui_out): Change type of parameter to ui_out_flags.
(ui_out::test_flags): Likewise.
(ui_out::m_flags): Likewise.
---
gdb/ui-out.c | 6 +++---
gdb/ui-out.h | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 3257f89..e262cd8 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -558,8 +558,8 @@ ui_out::redirect (ui_file *outstream)
}
/* Test the flags against the mask given. */
-int
-ui_out::test_flags (int mask)
+ui_out_flags
+ui_out::test_flags (ui_out_flags mask)
{
return m_flags & mask;
}
@@ -626,7 +626,7 @@ ui_out::query_table_field (int colno, int *width, int *alignment,
/* The constructor. */
-ui_out::ui_out (ui_out_impl_base *impl, int flags)
+ui_out::ui_out (ui_out_impl_base *impl, ui_out_flags flags)
: m_impl (impl),
m_flags (flags)
{
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index a0d8348..ea6440e 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -45,12 +45,12 @@ enum ui_align
};
/* flags enum */
-enum ui_flags
+enum ui_out_flag
{
- ui_from_tty = 1,
ui_source_list = 2
};
+DEF_ENUM_FLAGS_TYPE (ui_out_flag, ui_out_flags);
/* Prototypes for ui-out API. */
@@ -162,7 +162,7 @@ class ui_out
{
public:
- ui_out (ui_out_impl_base *impl, int flags = 0);
+ ui_out (ui_out_impl_base *impl, ui_out_flags flags = 0);
ui_out_impl_base *impl ();
@@ -204,7 +204,7 @@ class ui_out
/* Redirect the output of a ui_out object temporarily. */
int redirect (ui_file *outstream);
- int test_flags (int mask);
+ ui_out_flags test_flags (ui_out_flags mask);
/* HACK: Code in GDB is currently checking to see the type of ui_out
builder when determining which output to produce. This function is
@@ -221,7 +221,7 @@ class ui_out
/* Specific implementation of ui-out. */
std::unique_ptr<ui_out_impl_base> m_impl;
- int m_flags;
+ ui_out_flags m_flags;
/* Vector to store and track the ui-out levels. */
std::vector<std::unique_ptr<ui_out_level>> m_levels;
--
2.10.0