how to interpret this c statement

C

chao liu

hi, all,

Just confused with the following type definition. I will greatly appreciate
your comments on it and especially to explanations

struct prod_token_parm_item;
typedef struct GTY(()) prod_token_parm_item item;

so why there are so many brace following GTY and what's the meaning of this?

thanks,
Chao
 
J

jacob navia

chao liu said:
hi, all,

Just confused with the following type definition. I will greatly appreciate
your comments on it and especially to explanations

struct prod_token_parm_item;
typedef struct GTY(()) prod_token_parm_item item;

so why there are so many brace following GTY and what's the meaning of this?

thanks,
Chao

To understand this code you have to run it through the preprocessor.
Normally GTY should be a macro since it is all in uppercase, Traditionally
macros are written all in uppercase.

The first step of a compilation is to run the preprocessor, translating
macros.

Most compilers will answer to

cc -E

or similar, and will write the preprocessor output either into a file
or into the screen.

Then look at the line where you find both the word
"typedef"
and
"prod_token_parm_item"

and verify if this is the correct line.

Then, look at the output, and see what C statement was being
generated.

This is the only way to understand this, or try to find the macro definition
of GTY.

grep GTY *.h

comes to mind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top