예제 #1
0
/* Read the builtins table above and enter them, and language-specific
   macros, into the hash table.  HOSTED is true if this is a hosted
   environment.  */
void
cpp_init_builtins (cpp_reader *pfile, int hosted)
{
    cpp_init_special_builtins (pfile);

    if (!CPP_OPTION (pfile, traditional)
            && (! CPP_OPTION (pfile, stdc_0_in_system_headers)
                || CPP_OPTION (pfile, std)))
        _cpp_define_builtin (pfile, "__STDC__ 1");

    if (CPP_OPTION (pfile, cplusplus))
        _cpp_define_builtin (pfile, "__cplusplus 1");
    else if (CPP_OPTION (pfile, lang) == CLK_ASM)
        _cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
    else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
        _cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
    else if (CPP_OPTION (pfile, lang) == CLK_STDC1X
             || CPP_OPTION (pfile, lang) == CLK_GNUC1X)
        _cpp_define_builtin (pfile, "__STDC_VERSION__ 201000L");
    else if (CPP_OPTION (pfile, c99))
        _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");

    if (hosted)
        _cpp_define_builtin (pfile, "__STDC_HOSTED__ 1");
    else
        _cpp_define_builtin (pfile, "__STDC_HOSTED__ 0");

    if (CPP_OPTION (pfile, objc))
        _cpp_define_builtin (pfile, "__OBJC__ 1");
}
예제 #2
0
파일: cppinit.c 프로젝트: robinsonb5/zpugcc
/* Read the builtins table above and enter them, and language-specific
   macros, into the hash table.  HOSTED is true if this is a hosted
   environment.  */
void
cpp_init_builtins (cpp_reader *pfile, int hosted)
{
  const struct builtin *b;
  size_t n = ARRAY_SIZE (builtin_array);

  if (CPP_OPTION (pfile, traditional))
    n -= 2;

  for(b = builtin_array; b < builtin_array + n; b++)
    {
      cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
      hp->type = NT_MACRO;
      hp->flags |= NODE_BUILTIN | NODE_WARN;
      hp->value.builtin = b->value;
    }

  if (CPP_OPTION (pfile, cplusplus))
    _cpp_define_builtin (pfile, "__cplusplus 1");
  else if (CPP_OPTION (pfile, lang) == CLK_ASM)
    _cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
  else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
    _cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
  else if (CPP_OPTION (pfile, c99))
    _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");

  if (hosted)
    _cpp_define_builtin (pfile, "__STDC_HOSTED__ 1");
  else
    _cpp_define_builtin (pfile, "__STDC_HOSTED__ 0");

  if (CPP_OPTION (pfile, objc))
    _cpp_define_builtin (pfile, "__OBJC__ 1");
}
예제 #3
0
/* Read the builtins table above and enter them, and language-specific
   macros, into the hash table.  HOSTED is true if this is a hosted
   environment.  */
void
cpp_init_builtins (cpp_reader *pfile, int hosted)
{
  cpp_init_special_builtins (pfile);

  if (!CPP_OPTION (pfile, traditional)
      && (! CPP_OPTION (pfile, stdc_0_in_system_headers)
	  || CPP_OPTION (pfile, std)))
    _cpp_define_builtin (pfile, "__STDC__ 1");

  if (CPP_OPTION (pfile, cplusplus))
    {
      if (CPP_OPTION (pfile, lang) == CLK_CXX11
	   || CPP_OPTION (pfile, lang) == CLK_GNUCXX11)
	_cpp_define_builtin (pfile, "__cplusplus 201103L");
      else
	_cpp_define_builtin (pfile, "__cplusplus 199711L");
    }
  else if (CPP_OPTION (pfile, lang) == CLK_ASM)
    _cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
  else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
    _cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
  else if (CPP_OPTION (pfile, lang) == CLK_STDC11
	   || CPP_OPTION (pfile, lang) == CLK_GNUC11)
    _cpp_define_builtin (pfile, "__STDC_VERSION__ 201112L");
  else if (CPP_OPTION (pfile, c99))
    _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");

  if (CPP_OPTION (pfile, uliterals)
      && !CPP_OPTION (pfile, cplusplus))
    {
      _cpp_define_builtin (pfile, "__STDC_UTF_16__ 1");
      _cpp_define_builtin (pfile, "__STDC_UTF_32__ 1");
    }

  if (hosted)
    _cpp_define_builtin (pfile, "__STDC_HOSTED__ 1");
  else
    _cpp_define_builtin (pfile, "__STDC_HOSTED__ 0");

  if (CPP_OPTION (pfile, objc))
    _cpp_define_builtin (pfile, "__OBJC__ 1");
}