• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cpp_define函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cpp_define函数的典型用法代码示例。如果您正苦于以下问题:C++ cpp_define函数的具体用法?C++ cpp_define怎么用?C++ cpp_define使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cpp_define函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ix86_target_macros

void
ix86_target_macros (void)
{
  /* 32/64-bit won't change with target specific options, so do the assert and
     builtin_define_std calls here.  */
  if (TARGET_64BIT)
    {
      cpp_assert (parse_in, "cpu=x86_64");
      cpp_assert (parse_in, "machine=x86_64");
      cpp_define (parse_in, "__amd64");
      cpp_define (parse_in, "__amd64__");
      cpp_define (parse_in, "__x86_64");
      cpp_define (parse_in, "__x86_64__");
    }
  else
    {
      cpp_assert (parse_in, "cpu=i386");
      cpp_assert (parse_in, "machine=i386");
      builtin_define_std ("i386");
    }

  ix86_target_macros_internal (ix86_isa_flags,
			       ix86_arch,
			       ix86_tune,
			       ix86_fpmath,
			       cpp_define);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:27,代码来源:i386-c.c


示例2: define_builtin_macros_for_compilation_flags

/* Define various built-in CPP macros that depend on language-independent
   compilation flags.  */
static void
define_builtin_macros_for_compilation_flags (cpp_reader *pfile)
{
  if (flag_pic)
    {
      cpp_define_formatted (pfile, "__pic__=%d", flag_pic);
      cpp_define_formatted (pfile, "__PIC__=%d", flag_pic);
    }
  if (flag_pie)
    {
      cpp_define_formatted (pfile, "__pie__=%d", flag_pie);
      cpp_define_formatted (pfile, "__PIE__=%d", flag_pie);
    }

  if (optimize_size)
    cpp_define (pfile, "__OPTIMIZE_SIZE__");
  if (optimize)
    cpp_define (pfile, "__OPTIMIZE__");

  if (fast_math_flags_set_p (&global_options))
    cpp_define (pfile, "__FAST_MATH__");
  if (flag_signaling_nans)
    cpp_define (pfile, "__SUPPORT_SNAN__");

  cpp_define_formatted (pfile, "__FINITE_MATH_ONLY__=%d",
			flag_finite_math_only);
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:29,代码来源:cppbuiltin.c


示例3: spu_cpu_cpp_builtins

void
spu_cpu_cpp_builtins (struct cpp_reader *pfile)
{
  builtin_define_std ("__SPU__");
  cpp_assert (pfile, "cpu=spu");
  cpp_assert (pfile, "machine=spu");
  if (spu_arch == PROCESSOR_CELLEDP)
    builtin_define_std ("__SPU_EDP__");
  builtin_define_std ("__vector=__attribute__((__spu_vector__))");

  if (!flag_iso)
    {
      /* Define this when supporting context-sensitive keywords.  */
      cpp_define (pfile, "__VECTOR_KEYWORD_SUPPORTED__");
      cpp_define (pfile, "vector=vector");

      /* Initialize vector keywords.  */
      __vector_keyword = get_identifier ("__vector");
      C_CPP_HASHNODE (__vector_keyword)->flags |= NODE_CONDITIONAL;
      vector_keyword = get_identifier ("vector");
      C_CPP_HASHNODE (vector_keyword)->flags |= NODE_CONDITIONAL;

      /* Enable context-sensitive macros.  */
      cpp_get_callbacks (pfile)->macro_to_expand = spu_macro_to_expand;
    }
}
开发者ID:PennPanda,项目名称:MIT--6.828,代码行数:26,代码来源:spu-c.c


示例4: define_builtin_macros_for_lp64

/* Define built-in macros for LP64 targets. */
static void
define_builtin_macros_for_lp64 (cpp_reader *pfile)
{
  if (TYPE_PRECISION (long_integer_type_node) == 64
      && POINTER_SIZE == 64
      && TYPE_PRECISION (integer_type_node) == 32)
    {
      cpp_define (pfile, "_LP64");
      cpp_define (pfile, "__LP64__");
    }
}
开发者ID:AHelper,项目名称:gcc,代码行数:12,代码来源:cppbuiltin.c


示例5: define_builtin_macros_for_type_sizes

/* Define macros for size of basic C types.  */
static void
define_builtin_macros_for_type_sizes (cpp_reader *pfile)
{
#define define_type_sizeof(NAME, TYPE)                             \
    cpp_define_formatted (pfile, NAME"="HOST_WIDE_INT_PRINT_DEC,   \
                          tree_to_uhwi (TYPE_SIZE_UNIT (TYPE)))

  define_type_sizeof ("__SIZEOF_INT__", integer_type_node);
  define_type_sizeof ("__SIZEOF_LONG__", long_integer_type_node);
  define_type_sizeof ("__SIZEOF_LONG_LONG__", long_long_integer_type_node);
  define_type_sizeof ("__SIZEOF_SHORT__", short_integer_type_node);
  define_type_sizeof ("__SIZEOF_FLOAT__", float_type_node);
  define_type_sizeof ("__SIZEOF_DOUBLE__", double_type_node);
  define_type_sizeof ("__SIZEOF_LONG_DOUBLE__", long_double_type_node);
  define_type_sizeof ("__SIZEOF_SIZE_T__", size_type_node);

#undef define_type_sizeof

  cpp_define_formatted (pfile, "__CHAR_BIT__=%u",
			TYPE_PRECISION (char_type_node));
  cpp_define_formatted (pfile, "__BIGGEST_ALIGNMENT__=%d",
			BIGGEST_ALIGNMENT / BITS_PER_UNIT);

  /* Define constants useful for implementing endian.h.  */
  cpp_define (pfile, "__ORDER_LITTLE_ENDIAN__=1234");
  cpp_define (pfile, "__ORDER_BIG_ENDIAN__=4321");
  cpp_define (pfile, "__ORDER_PDP_ENDIAN__=3412");

  if (WORDS_BIG_ENDIAN == BYTES_BIG_ENDIAN)
    cpp_define_formatted (pfile, "__BYTE_ORDER__=%s",
			  (WORDS_BIG_ENDIAN
			   ? "__ORDER_BIG_ENDIAN__"
			   : "__ORDER_LITTLE_ENDIAN__"));
  else
    {
      /* Assert that we're only dealing with the PDP11 case.  */
      gcc_assert (!BYTES_BIG_ENDIAN);
      gcc_assert (WORDS_BIG_ENDIAN);

      cpp_define (pfile, "__BYTE_ORDER__=__ORDER_PDP_ENDIAN__");
    }

  cpp_define_formatted (pfile, "__FLOAT_WORD_ORDER__=%s",
                        (targetm.float_words_big_endian ()
                         ? "__ORDER_BIG_ENDIAN__"
                         : "__ORDER_LITTLE_ENDIAN__"));

  /* ptr_type_node can't be used here since ptr_mode is only set when
     toplev calls backend_init which is not done with -E switch.  */
  cpp_define_formatted (pfile, "__SIZEOF_POINTER__=%d",
			1 << ceil_log2 ((POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT));
}
开发者ID:AHelper,项目名称:gcc,代码行数:53,代码来源:cppbuiltin.c


示例6: gcc_python_define_macro

static PyObject*
gcc_python_define_macro(PyObject *self,
                        PyObject *args, PyObject *kwargs)
{
    const char *macro;
    char *keywords[] = {"macro",
                        NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
                                     "s:define_preprocessor_name", keywords,
                                     &macro)) {
        return NULL;
    }

    if (0) {
        fprintf(stderr, "gcc.define_macro(\"%s\")\n", macro);
    }

    if (!parse_in) {
        return PyErr_Format(PyExc_ValueError,
                            "gcc.define_macro(\"%s\") called without a compilation unit",
                            macro);
    }

    if (!gcc_python_is_within_event(NULL)) {
        return PyErr_Format(PyExc_ValueError,
                            "gcc.define_macro(\"%s\") called from outside an event callback",
                            macro);
    }

    cpp_define (parse_in, macro);

    Py_RETURN_NONE;
}
开发者ID:eevee,项目名称:gcc-python-plugin,代码行数:34,代码来源:gcc-python.c


示例7: def_or_undef_macro

static void
def_or_undef_macro(struct cpp_reader* pfile, const char *name, bool def_p)
{
  if (def_p)
    cpp_define (pfile, name);
  else
    cpp_undef (pfile, name);
}
开发者ID:ollie314,项目名称:gcc,代码行数:8,代码来源:arm-c.c


示例8: s390_cpu_cpp_builtins

/* Define platform dependent macros.  */
void
s390_cpu_cpp_builtins (cpp_reader *pfile)
{
  struct cl_target_option opts;

  cpp_assert (pfile, "cpu=s390");
  cpp_assert (pfile, "machine=s390");
  cpp_define (pfile, "__s390__");
  if (TARGET_ZARCH)
    cpp_define (pfile, "__zarch__");
  if (TARGET_64BIT)
    cpp_define (pfile, "__s390x__");
  if (TARGET_LONG_DOUBLE_128)
    cpp_define (pfile, "__LONG_DOUBLE_128__");
  cl_target_option_save (&opts, &global_options);
  s390_cpu_cpp_builtins_internal (pfile, &opts, NULL);
}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:18,代码来源:s390-c.c


示例9: aarch64_def_or_undef

static void
aarch64_def_or_undef (bool def_p, const char *macro, cpp_reader *pfile)
{
  if (def_p)
    cpp_define (pfile, macro);
  else
    cpp_undef (pfile, macro);
}
开发者ID:nguyentu1602,项目名称:gcc,代码行数:8,代码来源:aarch64-c.c


示例10: cci_attribute

static void cci_attribute(void *pfile_v,const char *keyword, const char *target,
                   int varargs, int n) {
  struct cpp_reader *pfile = (struct cpp_reader *)pfile_v;
  int params_specified = 0;
  char *buffer,*c;
  int size;
  int i;

  if (n) {
    for (c = target; *c; c++) {
      if ((*c == 'P') && (c[1] >= '0') && (c[1] <= '9')) {
        params_specified=1;
        break;
      }
    }
  }
  size = strlen(keyword)+sizeof("__attribute__(())")+strlen(target)+1;
  if (n) {
    if (params_specified == 0) {
      size += 8 * n;  /* up to 99 params: Pnn, */
    }
  }
  if (varargs) size += strlen("=()(),...__VA_ARGS__");
  buffer = (char *)xmalloc(size);
  c = buffer;
  c += sprintf(c,"%s",keyword);
  if (n || varargs) {
    *c++ = '(';
    for (i = 1; i <= n; i++) {
      c += sprintf(c, "P%d", i);
      if (i < n) *c += ',';
    }
    if (varargs) {
      if (n) *c++=',';
      c += sprintf(c, "...");
    }
    *c++ = ')';
  }
  c += sprintf(c, "=__attribute__((%s", target);
  if ((n || varargs) && !params_specified) {
    *c++ = '(';
    for (i = 1; i <= n; i++) {
      c += sprintf(c, "P%d", i);
      if (i < n) *c += ',';
    }
    if (varargs) {
      if (n) *c++=',';
      c += sprintf(c, "__VA_ARGS__");
    }
    *c++ = ')';
  }
  *c++ = ')';
  *c++ = ')';
  *c++ = 0;

  cpp_define(pfile, buffer);
  free(buffer);
}
开发者ID:fabio-d,项目名称:xc16plusplus-source,代码行数:58,代码来源:cci.c


示例11: s390_cpu_cpp_builtins_internal

/* Internal function to either define or undef the appropriate system
   macros.  */
static void
s390_cpu_cpp_builtins_internal (cpp_reader *pfile,
				struct cl_target_option *opts,
				const struct cl_target_option *old_opts)
{
  s390_def_or_undef_macro (pfile, MASK_OPT_HTM, old_opts, opts,
			   "__HTM__", "__HTM__");
  s390_def_or_undef_macro (pfile, MASK_OPT_VX, old_opts, opts,
			   "__VX__", "__VX__");
  s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts,
			   "__VEC__=10302", "__VEC__");
  s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts,
			   "__vector=__attribute__((vector_size(16)))",
			   "__vector__");
  s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts,
			   "__bool=__attribute__((s390_vector_bool)) unsigned",
			   "__bool");
  {
    char macro_def[64];
    gcc_assert (s390_arch != PROCESSOR_NATIVE);
    sprintf (macro_def, "__ARCH__=%d", processor_table[s390_arch].arch_level);
    cpp_undef (pfile, "__ARCH__");
    cpp_define (pfile, macro_def);
  }

  if (!flag_iso)
    {
      s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts,
			       "__VECTOR_KEYWORD_SUPPORTED__",
			       "__VECTOR_KEYWORD_SUPPORTED__");
      s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts,
			       "vector=vector", "vector");
      s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts,
			       "bool=bool", "bool");
      if (TARGET_ZVECTOR_P (opts->x_target_flags) && __vector_keyword == NULL)
	{
	  __vector_keyword = get_identifier ("__vector");
	  C_CPP_HASHNODE (__vector_keyword)->flags |= NODE_CONDITIONAL;

	  vector_keyword = get_identifier ("vector");
	  C_CPP_HASHNODE (vector_keyword)->flags |= NODE_CONDITIONAL;

	  __bool_keyword = get_identifier ("__bool");
	  C_CPP_HASHNODE (__bool_keyword)->flags |= NODE_CONDITIONAL;

	  bool_keyword = get_identifier ("bool");
	  C_CPP_HASHNODE (bool_keyword)->flags |= NODE_CONDITIONAL;

	  _Bool_keyword = get_identifier ("_Bool");
	  C_CPP_HASHNODE (_Bool_keyword)->flags |= NODE_CONDITIONAL;

	  /* Enable context-sensitive macros.  */
	  cpp_get_callbacks (pfile)->macro_to_expand = s390_macro_to_expand;
	}
    }
}
开发者ID:Lucretia,项目名称:gcc,代码行数:58,代码来源:s390-c.c


示例12: ix86_target_macros

void
ix86_target_macros (void)
{
  /* 32/64-bit won't change with target specific options, so do the assert and
     builtin_define_std calls here.  */
  if (TARGET_64BIT)
    {
      cpp_assert (parse_in, "cpu=x86_64");
      cpp_assert (parse_in, "machine=x86_64");
      cpp_define (parse_in, "__amd64");
      cpp_define (parse_in, "__amd64__");
      cpp_define (parse_in, "__x86_64");
      cpp_define (parse_in, "__x86_64__");
      if (TARGET_X32)
	{
	  cpp_define (parse_in, "_ILP32");
	  cpp_define (parse_in, "__ILP32__");
	}
    }
  else
    {
      cpp_assert (parse_in, "cpu=i386");
      cpp_assert (parse_in, "machine=i386");
      builtin_define_std ("i386");
    }

  cpp_define_formatted (parse_in, "__ATOMIC_HLE_ACQUIRE=%d", IX86_HLE_ACQUIRE);
  cpp_define_formatted (parse_in, "__ATOMIC_HLE_RELEASE=%d", IX86_HLE_RELEASE);

  ix86_target_macros_internal (ix86_isa_flags,
			       ix86_arch,
			       ix86_tune,
			       ix86_fpmath,
			       cpp_define);
}
开发者ID:keparo,项目名称:gcc,代码行数:35,代码来源:i386-c.c


示例13: sparc_target_macros

void
sparc_target_macros (void)
{
  builtin_define_std ("sparc");

  if (TARGET_64BIT)
    {
      cpp_assert (parse_in, "cpu=sparc64");
      cpp_assert (parse_in, "machine=sparc64");
    }
  else
    {
      cpp_assert (parse_in, "cpu=sparc");
      cpp_assert (parse_in, "machine=sparc");
    }

  if (TARGET_VIS3)
    {
      cpp_define (parse_in, "__VIS__=0x300");
      cpp_define (parse_in, "__VIS=0x300");
    }
  else if (TARGET_VIS2)
    {
      cpp_define (parse_in, "__VIS__=0x200");
      cpp_define (parse_in, "__VIS=0x200");
    }
  else if (TARGET_VIS)
    {
      cpp_define (parse_in, "__VIS__=0x100");
      cpp_define (parse_in, "__VIS=0x100");
    }
}
开发者ID:earonesty,项目名称:gcc,代码行数:32,代码来源:sparc-c.c


示例14: main

int main(int argc, char *argv[])
{
    int ofd = 1;
    int i = 1;
    char *s1, *s2;
    int len = 0;
    char *cbuf;
    int clen;
    while (i < argc && argv[i][0] == '-') {
        if (argv[i][1] == 'I')
            cpp_addpath(argv[i][2] ? argv[i] + 2 : argv[++i]);
        if (argv[i][1] == 'D') {
            char *name = argv[i] + 2;
            char *def = "";
            char *eq = strchr(name, '=');
            if (eq) {
                *eq = '\0';
                def = eq + 1;
            }
            cpp_define(name, def);
        }
        i++;
    }
    if (i + 1 >= argc) {
        printf("usage: npp [-I idir] [-D define] input output\n");
        return 0;
    }
    if (cpp_init(argv[i++]))
        die("npp: cannot open <%s>\n", argv[i - 1]);
    ofd = open(argv[i++], O_WRONLY | O_TRUNC | O_CREAT, 0600);
    if (ofd < 0)
        die("npp: cannot open <%s>\n", argv[i - 1]);
    s1 = malloc(OBUFSZ);
    s2 = malloc(OBUFSZ);
    if (!s1 || !s2)
        die("npp: cannot allocate enough memory\n");
    while (!cpp_read(&cbuf, &clen)) {
        memcpy(s1 + len, cbuf, clen);
        len += clen;
    }
    len = rmcomments(s2, s1, len);
    xwrite(ofd, s2, len);
    close(ofd);
    return 0;
}
开发者ID:gaoxiaojun,项目名称:neatcc,代码行数:45,代码来源:npp.c


示例15: cci_define

static void cci_define(void *pfile_v, const char *keyword, const char *target) {
  struct cpp_reader *pfile = (struct cpp_reader *)pfile_v;
  char *buffer;

  if (target)
    {
      buffer = (char *)xmalloc(strlen(keyword) + strlen(target) + 6);
      sprintf(buffer,"%s=%s", keyword, target);
    }
  else
    {
      buffer = (char *)xmalloc(strlen(keyword) + strlen("=") + 6);
      sprintf(buffer,"%s=", keyword);
    }
  cpp_define(pfile, buffer);
  free(buffer);
  return;
}
开发者ID:fabio-d,项目名称:xc16plusplus-source,代码行数:18,代码来源:cci.c


示例16: s390_def_or_undef_macro

/* Helper function that defines or undefines macros.  If SET is true, the macro
   MACRO_DEF is defined.  If SET is false, the macro MACRO_UNDEF is undefined.
   Nothing is done if SET and WAS_SET have the same value.  */
static void
s390_def_or_undef_macro (cpp_reader *pfile,
			 unsigned int mask,
			 const struct cl_target_option *old_opts,
			 const struct cl_target_option *new_opts,
			 const char *macro_def, const char *macro_undef)
{
  bool was_set;
  bool set;

  was_set = (!old_opts) ? false : old_opts->x_target_flags & mask;
  set = new_opts->x_target_flags & mask;
  if (was_set == set)
    return;
  if (set)
    cpp_define (pfile, macro_def);
  else
    cpp_undef (pfile, macro_undef);
}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:22,代码来源:s390-c.c


示例17: c_cpp_builtins_optimize_pragma

/* Adjust the optimization macros when a #pragma GCC optimization is done to
   reflect the current level.  */
void
c_cpp_builtins_optimize_pragma (cpp_reader *pfile, tree prev_tree,
				tree cur_tree)
{
  struct cl_optimization *prev = TREE_OPTIMIZATION (prev_tree);
  struct cl_optimization *cur  = TREE_OPTIMIZATION (cur_tree);
  bool prev_fast_math;
  bool cur_fast_math;

  /* -undef turns off target-specific built-ins.  */
  if (flag_undef)
    return;

  /* Other target-independent built-ins determined by command-line
     options.  */
  if (!prev->x_optimize_size && cur->x_optimize_size)
    cpp_define (pfile, "__OPTIMIZE_SIZE__");
  else if (prev->x_optimize_size && !cur->x_optimize_size)
    cpp_undef (pfile, "__OPTIMIZE_SIZE__");

  if (!prev->x_optimize && cur->x_optimize)
    cpp_define (pfile, "__OPTIMIZE__");
  else if (prev->x_optimize && !cur->x_optimize)
    cpp_undef (pfile, "__OPTIMIZE__");

  prev_fast_math = fast_math_flags_struct_set_p (prev);
  cur_fast_math  = fast_math_flags_struct_set_p (cur);
  if (!prev_fast_math && cur_fast_math)
    cpp_define (pfile, "__FAST_MATH__");
  else if (prev_fast_math && !cur_fast_math)
    cpp_undef (pfile, "__FAST_MATH__");

  if (!prev->x_flag_signaling_nans && cur->x_flag_signaling_nans)
    cpp_define (pfile, "__SUPPORT_SNAN__");
  else if (prev->x_flag_signaling_nans && !cur->x_flag_signaling_nans)
    cpp_undef (pfile, "__SUPPORT_SNAN__");

  if (!prev->x_flag_finite_math_only && cur->x_flag_finite_math_only)
    {
      cpp_undef (pfile, "__FINITE_MATH_ONLY__");
      cpp_define (pfile, "__FINITE_MATH_ONLY__=1");
    }
  else if (prev->x_flag_finite_math_only && !cur->x_flag_finite_math_only)
    {
      cpp_undef (pfile, "__FINITE_MATH_ONLY__");
      cpp_define (pfile, "__FINITE_MATH_ONLY__=0");
    }
}
开发者ID:ds2dev,项目名称:gcc,代码行数:50,代码来源:c-cppbuiltin.c


示例18: define_builtin_macros_for_compilation_flags

/* Define various built-in CPP macros that depend on language-independent
   compilation flags.  */
static void
define_builtin_macros_for_compilation_flags (cpp_reader *pfile)
{
  if (flag_pic)
    {
      cpp_define_formatted (pfile, "__pic__=%d", flag_pic);
      cpp_define_formatted (pfile, "__PIC__=%d", flag_pic);
    }
  if (flag_pie)
    {
      cpp_define_formatted (pfile, "__pie__=%d", flag_pie);
      cpp_define_formatted (pfile, "__PIE__=%d", flag_pie);
    }

  if (flag_sanitize & SANITIZE_ADDRESS)
    cpp_define (pfile, "__SANITIZE_ADDRESS__");

  if (optimize_size)
    cpp_define (pfile, "__OPTIMIZE_SIZE__");
  if (optimize)
    cpp_define (pfile, "__OPTIMIZE__");

  if (fast_math_flags_set_p (&global_options))
    cpp_define (pfile, "__FAST_MATH__");
  if (flag_signaling_nans)
    cpp_define (pfile, "__SUPPORT_SNAN__");
  if (!flag_errno_math)
    cpp_define (pfile, "__NO_MATH_ERRNO__");

  cpp_define_formatted (pfile, "__FINITE_MATH_ONLY__=%d",
			flag_finite_math_only);
  if (flag_cilkplus)
    cpp_define (pfile, "__cilk=200");

  if (flag_check_pointer_bounds)
    cpp_define (pfile, "__CHKP__");
}
开发者ID:AHelper,项目名称:gcc,代码行数:39,代码来源:cppbuiltin.c


示例19: spu_cpu_cpp_builtins

void
spu_cpu_cpp_builtins (struct cpp_reader *pfile)
{
  cpp_define (pfile, "__SPU__");
  cpp_assert (pfile, "cpu=spu");
  cpp_assert (pfile, "machine=spu");
  if (spu_arch == PROCESSOR_CELLEDP)
    cpp_define (pfile, "__SPU_EDP__");
  if (cpp_get_options (pfile)->lang != CLK_ASM)
    cpp_define (pfile, "__vector=__attribute__((__spu_vector__))");
  switch (spu_ea_model)
    {
    case 32:
      cpp_define (pfile, "__EA32__");
      break;
    case 64:
      cpp_define (pfile, "__EA64__");
      break;
    default:
       gcc_unreachable ();
    }

  if (!flag_iso && cpp_get_options (pfile)->lang != CLK_ASM)
    {
      /* Define this when supporting context-sensitive keywords.  */
      cpp_define (pfile, "__VECTOR_KEYWORD_SUPPORTED__");
      cpp_define (pfile, "vector=vector");

      /* Initialize vector keywords.  */
      __vector_keyword = get_identifier ("__vector");
      C_CPP_HASHNODE (__vector_keyword)->flags |= NODE_CONDITIONAL;
      vector_keyword = get_identifier ("vector");
      C_CPP_HASHNODE (vector_keyword)->flags |= NODE_CONDITIONAL;

      /* Enable context-sensitive macros.  */
      cpp_get_callbacks (pfile)->macro_to_expand = spu_macro_to_expand;
    }
}
开发者ID:KangDroid,项目名称:gcc,代码行数:38,代码来源:spu-c.c


示例20: c_cpp_builtins

/* Hook that registers front end and target-specific built-ins.  */
void
c_cpp_builtins (cpp_reader *pfile)
{
  /* -undef turns off target-specific built-ins.  */
  if (flag_undef)
    return;

  define_language_independent_builtin_macros (pfile);

  if (c_dialect_cxx ())
  {
    int major;
    parse_basever (&major, NULL, NULL);
    cpp_define_formatted (pfile, "__GNUG__=%d", major);
  }

  /* For stddef.h.  They require macros defined in c-common.c.  */
  c_stddef_cpp_builtins ();

  /* Set include test macros for all C/C++ (not for just C++11 etc.)
     the builtins __has_include__ and __has_include_next__ are defined
     in libcpp.  */
  cpp_define (pfile, "__has_include(STR)=__has_include__(STR)");
  cpp_define (pfile, "__has_include_next(STR)=__has_include_next__(STR)");

  if (c_dialect_cxx ())
    {
      if (flag_weak && SUPPORTS_ONE_ONLY)
	cpp_define (pfile, "__GXX_WEAK__=1");
      else
	cpp_define (pfile, "__GXX_WEAK__=0");

      if (warn_deprecated)
	cpp_define (pfile, "__DEPRECATED");

      if (flag_rtti)
	cpp_define (pfile, "__GXX_RTTI");

      if (cxx_dialect >= cxx11)
        cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__");

      /* Binary literals have been allowed in g++ before C++11
	 and were standardized for C++14.  */
      if (!pedantic || cxx_dialect > cxx11)
	cpp_define (pfile, "__cpp_binary_literals=201304");
      if (cxx_dialect >= cxx11)
	{
	  /* Set feature test macros for C++11  */
	  cpp_define (pfile, "__cpp_unicode_characters=200704");
	  cpp_define (pfile, "__cpp_raw_strings=200710");
	  cpp_define (pfile, "__cpp_unicode_literals=200710");
	  cpp_define (pfile, "__cpp_user_defined_literals=200809");
	  cpp_define (pfile, "__cpp_lambdas=200907");
	  cpp_define (pfile, "__cpp_constexpr=200704");
	  cpp_define (pfile, "__cpp_static_assert=200410");
	  cpp_define (pfile, "__cpp_decltype=200707");
	  cpp_define (pfile, "__cpp_attributes=200809");
	  cpp_define (pfile, "__cpp_rvalue_reference=200610");
	  cpp_define (pfile, "__cpp_variadic_templates=200704");
	  cpp_define (pfile, "__cpp_alias_templates=200704");
	}
      if (cxx_dialect > cxx11)
	{
	  /* Set feature test macros for C++14  */
	  cpp_define (pfile, "__cpp_return_type_deduction=201304");
	  cpp_define (pfile, "__cpp_init_captures=201304");
	  cpp_define (pfile, "__cpp_generic_lambdas=201304");
	  //cpp_undef (pfile, "__cpp_constexpr");
	  //cpp_define (pfile, "__cpp_constexpr=201304");
	  cpp_define (pfile, "__cpp_decltype_auto=201304");
	  //cpp_define (pfile, "__cpp_aggregate_nsdmi=201304");
	  //cpp_define (pfile, "__cpp_variable_templates=201304");
	  cpp_define (pfile, "__cpp_digit_separators=201309");
	  cpp_define (pfile, "__cpp_attribute_deprecated=201309");
	  //cpp_define (pfile, "__cpp_sized_deallocation=201309");
	  /* We'll have to see where runtime arrays wind up.
	     Let's put it in C++14 for now.  */
	  cpp_define (pfile, "__cpp_runtime_arrays=201304");
	}
    }
  /* Note that we define this for C as well, so that we know if
     __attribute__((cleanup)) will interface with EH.  */
  if (flag_exceptions)
    cpp_define (pfile, "__EXCEPTIONS");

  /* Represents the C++ ABI version, always defined so it can be used while
     preprocessing C and assembler.  */
  if (flag_abi_version == 0)
    /* Use a very large value so that:

	 #if __GXX_ABI_VERSION >= <value for version X>

       will work whether the user explicitly says "-fabi-version=x" or
       "-fabi-version=0".  Do not use INT_MAX because that will be
       different from system to system.  */
    builtin_define_with_int_value ("__GXX_ABI_VERSION", 999999);
  else if (flag_abi_version == 1)
    /* Due to a historical accident, this version had the value
       "102".  */
//.........这里部分代码省略.........
开发者ID:ds2dev,项目名称:gcc,代码行数:101,代码来源:c-cppbuiltin.c



注:本文中的cpp_define函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cpp_get_options函数代码示例发布时间:2022-05-30
下一篇:
C++ cpos函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap