Exemplo n.º 1
0
void
init_reswords (void)
{
    unsigned int i;
    tree id;
    int mask = ((flag_no_asm ? D_ASM : 0)
                | D_OBJC
                | (flag_no_gnu_keywords ? D_EXT : 0));

    ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
    for (i = 0; i < ARRAY_SIZE (reswords); i++)
    {
        id = get_identifier (reswords[i].word);
        C_RID_CODE (id) = reswords[i].rid;
        ridpointers [(int) reswords[i].rid] = id;
        if (! (reswords[i].disable & mask))
            C_IS_RESERVED_WORD (id) = 1;
    }

    /* APPLE LOCAL begin private extern  Radar 2872481 --ilr */
    /* For C++ there is always a -D__private_extern__=extern on the
       command line.  However, if -fpreprocessed was specified then
       macros are not expanded so the -D is meaningless.  But this
       replacement is required for C++.  There for we have to "pretend"
       that '__private_extern__' is 'extern' and we can do this simply by
       making the rid code for '__private_extern__' be the same as for
       extern.  Note, we probably could always do this here since
       '__private_extern__' is always to be treated like 'extern' for
       c++.  But we'll be conservative and only do it when -fpreprocessed
       is specified and depend on the macro substitution in all other
       cases.  */
    if (flag_preprocessed)
    {
        id = get_identifier ("__private_extern__");
        C_RID_CODE (id) = RID_EXTERN;
    }
    /* APPLE LOCAL end private extern  Radar 2872481 --ilr */
}
Exemplo n.º 2
0
void
init_reswords (void)
{
  unsigned int i;
  tree id;
  int mask = ((flag_no_asm ? D_ASM : 0)
	      | D_OBJC
	      | (flag_no_gnu_keywords ? D_EXT : 0));

  ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
  for (i = 0; i < ARRAY_SIZE (reswords); i++)
    {
      id = get_identifier (reswords[i].word);
      C_RID_CODE (id) = reswords[i].rid;
      ridpointers [(int) reswords[i].rid] = id;
      if (! (reswords[i].disable & mask))
	C_IS_RESERVED_WORD (id) = 1;
    }
}
Exemplo n.º 3
0
static void
c_lex_one_token (c_token *token)
{
#if 0
  timevar_push (TV_LEX);
  token->type = c_lex_with_flags (&token->value, &token->location, NULL);
#else
  token->type = clilex();
  token->value = yylval.type_node_p;
#endif
  token->in_system_header = in_system_header;
  switch (token->type)
    {
    case T_NAME:
    case CPP_NAME:
      token->id_kind = C_ID_NONE;
      token->keyword = RID_MAX;
      {
	tree decl;

	int objc_force_identifier = objc_need_raw_identifier;
#if 0
	OBJC_NEED_RAW_IDENTIFIER (0);
#endif

	if (0/*C_IS_RESERVED_WORD (token->value)*/)
	  {
	    enum rid rid_code = 0/*C_RID_CODE (token->value)*/;

#if 0
	    if (c_dialect_objc ())
	      {
		if (!OBJC_IS_AT_KEYWORD (rid_code)
		    && (!OBJC_IS_PQ_KEYWORD (rid_code) || objc_pq_context))
		  {
		    /* Return the canonical spelling for this keyword.  */
		    token->value = ridpointers[(int) rid_code];
		    token->type = CPP_KEYWORD;
		    token->keyword = rid_code;
		    break;
		  }
	      }
	    else
#endif
	      {
		/* Return the canonical spelling for this keyword.  */
#if 0
		token->value = ridpointers[(int) rid_code];
#endif
		token->type = CPP_KEYWORD;
		token->keyword = rid_code;
		break;
	      }
	  }

#if 0
	decl = lookup_name (token->value);
	if (decl)
	  {
	    if (TREE_CODE (decl) == TYPE_DECL)
	      {
		token->id_kind = C_ID_TYPENAME;
		break;
	      }
	  }
#if 0
	else if (c_dialect_objc ())
	  {
	    tree objc_interface_decl = objc_is_class_name (token->value);
	    /* Objective-C class names are in the same namespace as
	       variables and typedefs, and hence are shadowed by local
	       declarations.  */
	    if (objc_interface_decl
		&& (global_bindings_p ()
		    || (!objc_force_identifier && !decl)))
	      {
		token->value = objc_interface_decl;
		token->id_kind = C_ID_CLASSNAME;
		break;
	      }
	  }
#endif
#endif
      }
      token->id_kind = C_ID_ID;
      break;
#if 0
    case CPP_AT_NAME:
      /* This only happens in Objective-C; it must be a keyword.  */
      token->type = CPP_KEYWORD;
      token->id_kind = C_ID_NONE;
      token->keyword = C_RID_CODE (token->value);
      break;
#endif
    case ':':
    case ',':
    case ')':
    case ';':
    case CPP_COLON:
    case CPP_COMMA:
    case CPP_CLOSE_PAREN:
    case CPP_SEMICOLON:
      /* These tokens may affect the interpretation of any identifiers
	 following, if doing Objective-C.  */
#if 0
      OBJC_NEED_RAW_IDENTIFIER (0);
#endif
      token->id_kind = C_ID_NONE;
      token->keyword = RID_MAX;
      break;
    default:
      token->id_kind = C_ID_NONE;
      token->keyword = RID_MAX;
      break;
    }
#if 0
  timevar_pop (TV_LEX);
#endif
}