Don't generate MIN & MAX enum values if "--no-prefix" is used.
Close #3892
This commit is contained in:
parent
cccd7003ed
commit
3e52fecd1e
|
@ -179,6 +179,7 @@ static void GenEnum(const Parser &parser, EnumDef &enum_def,
|
||||||
maxv = !maxv || maxv->value < ev.value ? &ev : maxv;
|
maxv = !maxv || maxv->value < ev.value ? &ev : maxv;
|
||||||
anyv |= ev.value;
|
anyv |= ev.value;
|
||||||
}
|
}
|
||||||
|
if (parser.opts.scoped_enums || parser.opts.prefixed_enums) {
|
||||||
assert(minv && maxv);
|
assert(minv && maxv);
|
||||||
if (enum_def.attributes.Lookup("bit_flags")) {
|
if (enum_def.attributes.Lookup("bit_flags")) {
|
||||||
if (minv->value != 0) // If the user didn't defined NONE value
|
if (minv->value != 0) // If the user didn't defined NONE value
|
||||||
|
@ -191,6 +192,7 @@ static void GenEnum(const Parser &parser, EnumDef &enum_def,
|
||||||
code += " " + GenEnumVal(enum_def, "MAX", parser.opts) + " = ";
|
code += " " + GenEnumVal(enum_def, "MAX", parser.opts) + " = ";
|
||||||
code += GenEnumVal(enum_def, maxv->name, parser.opts) + "\n";
|
code += GenEnumVal(enum_def, maxv->name, parser.opts) + "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
code += "};\n";
|
code += "};\n";
|
||||||
if (parser.opts.scoped_enums && enum_def.attributes.Lookup("bit_flags"))
|
if (parser.opts.scoped_enums && enum_def.attributes.Lookup("bit_flags"))
|
||||||
code += "DEFINE_BITMASK_OPERATORS(" + enum_def.name + ", " + GenTypeBasic(enum_def.underlying_type, false) + ")\n";
|
code += "DEFINE_BITMASK_OPERATORS(" + enum_def.name + ", " + GenTypeBasic(enum_def.underlying_type, false) + ")\n";
|
||||||
|
|
Loading…
Reference in New Issue