This patch changes the ui_out flags to be an enum flag.
gdb/ChangeLog:
* ui-out.h: Include "common/enum-flags.h".
(enum ui_flags): Rename to ...
(enum ui_out_flag): ... this.
(ui_out_flags): Define enum flag type.
(ui_out_test_flags): Change type of parameter to ui_out_flags.
(ui_out_new): Likewise.
* ui-out.c (ui_out_test_flags): Likewise.
(ui_out_new): Likewise.
* cli-out.c (cli_out_new): Update variable type.
* mi/mi-out.c (mi_out_new): Likewise.
* tui/tui-out.c (tui_out_new): Likewise.
+2016-12-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * ui-out.h: Include "common/enum-flags.h".
+ (enum ui_flags): Rename to ...
+ (enum ui_out_flag): ... this.
+ (ui_out_flags): Define enum flag type.
+ (ui_out_test_flags): Change type of parameter to ui_out_flags.
+ (ui_out_new): Likewise.
+ * ui-out.c (ui_out_test_flags): Likewise.
+ (ui_out_new): Likewise.
+ * cli-out.c (cli_out_new): Update variable type.
+ * mi/mi-out.c (mi_out_new): Likewise.
+ * tui/tui-out.c (tui_out_new): Likewise.
+
2016-12-02 Pedro Alves <palves@redhat.com>
* NEWS: Mention that user commands now accept an unlimited number
struct ui_out *
cli_out_new (struct ui_file *stream)
{
- int flags = ui_source_list;
+ ui_out_flags flags = ui_source_list;
cli_out_data *data = new cli_out_data ();
cli_out_data_ctor (data, stream);
struct ui_out *
mi_out_new (int mi_version)
{
- int flags = 0;
+ ui_out_flags flags = 0;
mi_out_data *data = new mi_out_data ();
struct ui_file *stream = mem_fileopen ();
struct ui_out *
tui_out_new (struct ui_file *stream)
{
- int flags = 0;
+ ui_out_flags flags = 0;
tui_out_data *data = new tui_out_data ();
/* Test the flags against the mask given. */
int
-ui_out_test_flags (struct ui_out *uiout, int mask)
+ui_out_test_flags (struct ui_out *uiout, ui_out_flags mask)
{
return (uiout->flags & mask);
}
struct ui_out *
ui_out_new (const struct ui_out_impl *impl, void *data,
- int flags)
+ ui_out_flags flags)
{
struct ui_out *uiout = new ui_out ();
#ifndef UI_OUT_H
#define UI_OUT_H 1
+#include "common/enum-flags.h"
+
/* The ui_out structure */
struct ui_out;
};
/* flags enum */
-enum ui_flags
+enum ui_out_flag
{
- ui_from_tty = 1,
- ui_source_list = 2
+ ui_source_list = (1 << 0),
};
+DEF_ENUM_FLAGS_TYPE (ui_out_flag, ui_out_flags);
/* Prototypes for ui-out API. */
extern void ui_out_flush (struct ui_out *uiout);
-extern int ui_out_test_flags (struct ui_out *uiout, int mask);
+extern int ui_out_test_flags (struct ui_out *uiout, ui_out_flags mask);
extern int ui_out_query_field (struct ui_out *uiout, int colno,
int *width, int *alignment,
/* Create a ui_out object */
-extern struct ui_out *ui_out_new (const struct ui_out_impl *impl,
- void *data,
- int flags);
+extern struct ui_out *ui_out_new (const struct ui_out_impl *impl, void *data,
+ ui_out_flags flags);
/* Redirect the ouptut of a ui_out object temporarily. */