Question

In file included from /home/epuser/ajayku/final_test/qemu/qemu-1.6.0.ajay /tcg/tcg.h:117:0,

from /home/epuser/ajayku/final_test/qemu/qemu-1.6.0.ajay/exec.c:29:
`/home/epuser/ajayku/final_test/qemu/qemu-1.6.0.ajay/tcg/tcg-op.h:27:1: error: expected` `identifier before ‘int’`

> And the initial content of "tcg-op.h" file is

int gen_new_label(void);

static inline void tcg_gen_op0(TCGOpcode opc)

{
    *tcg_ctx.gen_opc_ptr++ = opc;
}

static inline void tcg_gen_op1_i32(TCGOpcode opc, TCGv_i32 arg1)
{
    *tcg_ctx.gen_opc_ptr++ = opc;
    *tcg_ctx.gen_opparam_ptr++ = GET_TCGV_I32(arg1);
}

And the code where "tcg-op.h" is being called by "tcg.h" is as follow

typedef enum {
#define DEF(name, oargs, iargs, cargs, flags) INDEX_op_ ## name,
#include "tcg-op.h"
#undef DEF
 NB_OPS,
} TCGOpcode;
Was it helpful?

Solution

When you include "tcg-op.h" inside enum the required content of "tcg-op.h" are copied inside enum.

There is no error in tcg-op.h, but when you include it inside enum, compiler is shocked what the int gen_new_label(void); is doing inside an enum and throw error.

It should work, if you do -

#include "tcg-op.h"
#define DEF(name, oargs, iargs, cargs, flags) INDEX_op_ ## name,
typedef enum {
         DEF(ARG1, ARG2, ARG3, ARG4, ARG5)
         NB_OPS,
} TCGOpcode;
#undef DEF
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top