Commit 3e52fecd authored by BogDan Vatra's avatar BogDan Vatra

Don't generate MIN & MAX enum values if "--no-prefix" is used.

Close #3892
parent cccd7003
......@@ -179,6 +179,7 @@ static void GenEnum(const Parser &parser, EnumDef &enum_def,
maxv = !maxv || maxv->value < ev.value ? &ev : maxv;
anyv |= ev.value;
}
if (parser.opts.scoped_enums || parser.opts.prefixed_enums) {
assert(minv && maxv);
if (enum_def.attributes.Lookup("bit_flags")) {
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, maxv->name, parser.opts) + "\n";
}
}
code += "};\n";
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";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment