+2018-10-03 Tom Tromey <tom@tromey.com>
+
+ * common/enum-flags.h (enum_flags::operator~): Add static assert.
+ * symfile-add-flags.h (enum symfile_add_flag): Use unsigned as
+ base type.
+ * objfile-flags.h (enum objfile_flag): Use unsigned as base type.
+ * gdbtypes.h (enum type_instance_flag_value): Use unsigned as base
+ type.
+ * c-lang.h (enum c_string_type_values): Use unsigned as base
+ type.
+ * btrace.h (enum btrace_thread_flag): Use unsigned as base type.
+
2018-10-03 Tom Tromey <tom@tromey.com>
* dwarf2-frame.h (dwarf2_frame_state_reg_info)
};
/* Branch trace thread flags. */
-enum btrace_thread_flag
+enum btrace_thread_flag : unsigned
{
/* The thread is to be stepped forwards. */
BTHR_STEP = (1 << 0),
/* The various kinds of C string and character. Note that these
values are chosen so that they may be or'd together in certain
ways. */
-enum c_string_type_values
+enum c_string_type_values : unsigned
{
/* An ordinary string: "value". */
C_STRING = 0,
}
enum_flags operator~ () const
{
+ // We only the underlying type to be unsigned when actually using
+ // operator~ -- if it were not unsigned, undefined behavior could
+ // result. However, asserting this in the class itself would
+ // require too many unnecessary changes to otherwise ok enum
+ // types.
+ gdb_static_assert (std::is_unsigned<underlying_type>::value);
return (enum_type) ~underlying_value ();
}
/* * Some bits for the type's instance_flags word. See the macros
below for documentation on each bit. */
-enum type_instance_flag_value
+enum type_instance_flag_value : unsigned
{
TYPE_INSTANCE_FLAG_CONST = (1 << 0),
TYPE_INSTANCE_FLAG_VOLATILE = (1 << 1),
/* Defines for the objfile flags field. Defined in a separate file to
break circular header dependencies. */
-enum objfile_flag
+enum objfile_flag : unsigned
{
/* When an object file has its functions reordered (currently
Irix-5.2 shared libraries exhibit this behaviour), we will need
symbol_file_add, etc. Defined in a separate file to break circular
header dependencies. */
-enum symfile_add_flag
+enum symfile_add_flag : unsigned
{
/* Be chatty about what you are doing. */
SYMFILE_VERBOSE = 1 << 1,