Exemple #1
0
/* Set up the identifier hash table.  Use TABLE if non-null, otherwise
   create our own.  */
void
_cpp_init_hashtable (cpp_reader *pfile, hash_table *table)
{
  struct spec_nodes *s;

  if (table == NULL)
    {
      pfile->our_hashtable = 1;
      table = ht_create (13);	/* 8K (=2^13) entries.  */
      table->alloc_node = (hashnode (*) (hash_table *)) alloc_node;

      _obstack_begin (&pfile->hash_ob, 0, 0,
		      (void *(*) (long)) xmalloc,
		      (void (*) (void *)) free);
    }

  table->pfile = pfile;
  pfile->hash_table = table;

  /* Now we can initialize things that use the hash table.  */
  _cpp_init_directives (pfile);
  _cpp_init_internal_pragmas (pfile);

  s = &pfile->spec_nodes;
  s->n_defined		= cpp_lookup (pfile, DSC("defined"));
  s->n_true		= cpp_lookup (pfile, DSC("true"));
  s->n_false		= cpp_lookup (pfile, DSC("false"));
  s->n__VA_ARGS__       = cpp_lookup (pfile, DSC("__VA_ARGS__"));
  s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC;
}
Exemple #2
0
/* Set up the identifier hash table.  Use TABLE if non-null, otherwise
   create our own.  */
void
_cpp_init_hashtable (cpp_reader *pfile, cpp_hash_table *table)
{
  struct spec_nodes *s;

  if (table == NULL)
    {
      pfile->our_hashtable = 1;
      table = ht_create (13);	/* 8K (=2^13) entries.  */
      table->alloc_node = alloc_node;

      obstack_specify_allocation (&pfile->hash_ob, 0, 0, xmalloc, free);
    }

  table->pfile = pfile;
  pfile->hash_table = table;

  /* Now we can initialize things that use the hash table.  */
  _cpp_init_directives (pfile);
  _cpp_init_internal_pragmas (pfile);

  s = &pfile->spec_nodes;
  s->n_defined		= cpp_lookup (pfile, DSC("defined"));
  s->n_true		= cpp_lookup (pfile, DSC("true"));
  s->n_false		= cpp_lookup (pfile, DSC("false"));
  s->n__VA_ARGS__       = cpp_lookup (pfile, DSC("__VA_ARGS__"));
  s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC;
  s->n__has_include__   = cpp_lookup (pfile, DSC("__has_include__"));
  s->n__has_include_next__ = cpp_lookup (pfile, DSC("__has_include_next__"));
  s->n__has_attribute__   = cpp_lookup (pfile, DSC("__has_attribute__"));
}
Exemple #3
0
/* SDCPP specific option initialization */
static unsigned int
sdcpp_init_options (unsigned int argc, const char **argv)
{
    unsigned int ret = sdcpp_common_init_options(argc, argv);

    CPP_OPTION (parse_in, allow_naked_hash) = 0;
    CPP_OPTION (parse_in, preproc_asm) = 1;
    CPP_OPTION (parse_in, pedantic_parse_number) = 0;
    CPP_OPTION (parse_in, obj_ext) = NULL;

    /* Kevin abuse for SDCC. */
    cpp_register_pragma(parse_in, 0, "sdcc_hash", do_pragma_sdcc_hash, false);
    /* SDCC _asm specific */
    cpp_register_pragma(parse_in, 0, "preproc_asm", do_pragma_preproc_asm, false);
    /* SDCC specific */
    cpp_register_pragma(parse_in, 0, "pedantic_parse_number", do_pragma_pedantic_parse_number, false);

    /* SDCC _asm specific */
    parse_in->spec_nodes.n__asm = cpp_lookup (parse_in, DSC("__asm"));
    parse_in->spec_nodes.n__endasm = cpp_lookup (parse_in, DSC("__endasm"));

    return ret;
}