Re: [PATCH v5 02/25] New gdbarch memory tagging hooks

Simon Marchi via Gdb-patches
2021-02-05T03:58:23Z

> +enum memtag_type
> +{
> + /* Logical tag, the tag that is stored in unused bits of a pointer to a
> + virtual address. */
> + tag_logical = 0,
> +
> + /* Allocation tag, the tag that is associated with every granule of memory in
> + the physical address space. Allocation tags are used to validate memory
> + accesses via pointers containing logical tags. */
> + tag_allocation,
> +};

Maybe one more suggestion: use enum class. I find that it ends up more
self-descriptive when you use it.

enum class memtag_type
{
/* ... */
logical,

/* ... */
allocation,
};

Without enum class (in C), I always try to prefix the enumerators with
the enum type name, to get the same self-decriptiveness (and to avoid
name clashes):

enum memtag_type
{
memtag_type_logical,
memtag_type_allocation,
};

... but enum class is just cleaner, and safer.

Simon