Repository: dotnet/runtime
File: src/coreclr/jit/emitfmtswasm.h (C/C++)

Code before:
#ifdef DEFINE_ID_OPS
enum ID_OPS
{
    ID_OP_NONE,
};
#undef DEFINE_ID_OPS

#else // !DEFINE_ID_OPS

#ifndef IF_DEF
#error Must define IF_DEF macro before including this file
#endif

//////////////////////////////////////////////////////////////////////////////
//
// enum insFormat   instruction            enum ID_OPS
//                  scheduling
//                  (unused)
//////////////////////////////////////////////////////////////////////////////

IF_DEF(NONE,          IS_NONE, NONE)
IF_DEF(OPCODE,        IS_NONE, NONE) // <opcode>
IF_DEF(BLOCK,         IS_NONE, NONE) // <opcode> <0x40>
IF_DEF(RAW_ULEB128,   IS_NONE, NONE) // <ULEB128 immediate>
IF_DEF(ULEB128,       IS_NONE, NONE) // <opcode> <ULEB128 immediate>
IF_DEF(CALL,          IS_NONE, NONE) // <opcode> <ULEB128 immediate (function index reloc)>
IF_DEF(SLEB128,       IS_NONE, NONE) // <opcode> <LEB128 immediate (signed)>
IF_DEF(MEMADDR,       IS_NONE, NONE) // <opcode> <SLEB128 immediate (memory address reloc)>
IF_DEF(FUNCPTR,       IS_NONE, NONE) // <opcode> <SLEB128 immediate (function pointer reloc)>
IF_DEF(F32,           IS_NONE, NONE) // <opcode> <f32 immediate (stored as 64-bit integer constant)>
IF_DEF(F64,           IS_NONE, NONE) // <opcode> <f64 immediate (stored as 64-bit integer constant)>
IF_DEF(MEMARG,        IS_NONE, NONE) // <opcode> <memarg> (<align> <offset>)
IF_DEF(LOCAL_DECL,    IS_NONE, NONE) // <ULEB128 immediate> <byte>
IF_DEF(CALL_INDIRECT, IS_NONE, NONE) // <opcode> <ULEB128 immediate> <ULEB128 immediate>

#undef IF_DEF
#endif // !DEFINE_ID_OPS
// clang-format on


Review comment (suggestion):
Nit: we are a bit inconsistent, but I think the better pattern for formats (since they are resuable) is to have them describe their operands. In that logic, this should be `IF_FUNCIDX`.

Code after:
#ifdef DEFINE_ID_OPS
enum ID_OPS
{
    ID_OP_NONE,
};
#undef DEFINE_ID_OPS

#else // !DEFINE_ID_OPS

#ifndef IF_DEF
#error Must define IF_DEF macro before including this file
#endif

//////////////////////////////////////////////////////////////////////////////
//
// enum insFormat   instruction            enum ID_OPS
//                  scheduling
//                  (unused)
//////////////////////////////////////////////////////////////////////////////

IF_DEF(NONE,          IS_NONE, NONE)
IF_DEF(OPCODE,        IS_NONE, NONE) // <opcode>
IF_DEF(BLOCK,         IS_NONE, NONE) // <opcode> <0x40>
IF_DEF(RAW_ULEB128,   IS_NONE, NONE) // <ULEB128 immediate>
IF_DEF(ULEB128,       IS_NONE, NONE) // <opcode> <ULEB128 immediate>
IF_DEF(FUNCIDX,       IS_NONE, NONE) // <opcode> <ULEB128 immediate (function index reloc)>
IF_DEF(SLEB128,       IS_NONE, NONE) // <opcode> <LEB128 immediate (signed)>
IF_DEF(MEMADDR,       IS_NONE, NONE) // <opcode> <SLEB128 immediate (memory address reloc)>
IF_DEF(FUNCPTR,       IS_NONE, NONE) // <opcode> <SLEB128 immediate (function pointer reloc)>
IF_DEF(F32,           IS_NONE, NONE) // <opcode> <f32 immediate (stored as 64-bit integer constant)>
IF_DEF(F64,           IS_NONE, NONE) // <opcode> <f64 immediate (stored as 64-bit integer constant)>
IF_DEF(MEMARG,        IS_NONE, NONE) // <opcode> <memarg> (<align> <offset>)
IF_DEF(LOCAL_DECL,    IS_NONE, NONE) // <ULEB128 immediate> <byte>
IF_DEF(CALL_INDIRECT, IS_NONE, NONE) // <opcode> <ULEB128 immediate> <ULEB128 immediate>

#undef IF_DEF
#endif // !DEFINE_ID_OPS
// clang-format on