General search for symbols...
Stephen Biggs
xyzzy@hotpop.com
Wed Apr 2 14:10:00 GMT 2003
I am trying to port GCC to another machine.
Given that I have a file <new gcc
path>/gcc/config/<machine>/<machine>.c, how would I, within any of the
functions in that file find out if a certain symbol has been defined by
a "#define" statement in the C source that is being compiled?
E.g., the source file consists of one line:
#define DEFINED_CONSTANT_2
Note: my call to print_node CRASHES the compiler.
I have tried various versions of:
if((decl = getdecls()))
print_node(stderr,"tree: ",decl,4); /* this CRASHES!!! */
for ( ; decl; decl = TREE_CHAIN (decl))
{
if (TREE_CODE (decl) == IDENTIFIER_NODE)
{
if(!strcmp(IDENTIFIER_POINTER(decl),"DEFINED_CONSTANT_1"))
fprintf(stderr,"DEFINED_CONSTANT_1" found, code
%d\n",TREE_CODE(decl));
else if(!strcmp(IDENTIFIER_POINTER(decl),"DEFINED_CONSTANT_2"))
fprintf(stderr,"DEFINED_CONSTANT_2 found, code
%d\n",TREE_CODE(decl));
}
}
More information about the Gcc
mailing list