This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

General search for symbols...


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));
    }
  }




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]