当前位置: 首页>>代码示例>>C++>>正文


C++ c_dialect_cxx函数代码示例

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


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

示例1: pp_c_bool_constant

static void
pp_c_bool_constant (c_pretty_printer *pp, tree b)
{
  if (b == boolean_false_node)
    {
      if (c_dialect_cxx ())
	pp_c_identifier (pp, "false");
      else if (flag_isoc99)
	pp_c_identifier (pp, "_False");
      else
	pp_unsupported_tree (pp, b);
    }
  else if (b == boolean_true_node)
    {
      if (c_dialect_cxx ())
	pp_c_identifier (pp, "true");
      else if (flag_isoc99)
	pp_c_identifier (pp, "_True");
      else
	pp_unsupported_tree (pp, b);
    }
  else if (TREE_CODE (b) == INTEGER_CST)
    pp_c_integer_constant (pp, b);
  else
    pp_unsupported_tree (pp, b);
}
开发者ID:DmitrySkiba,项目名称:itoa-toolchain,代码行数:26,代码来源:c-pretty-print.c

示例2: c_common_init_options

/* Common initialization before parsing options.  */
unsigned int
c_common_init_options (unsigned int argc, const char **argv)
{
  static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
  unsigned int i, result;

  /* This is conditionalized only because that is the way the front
     ends used to do it.  Maybe this should be unconditional?  */
  if (c_dialect_cxx ())
    {
      /* By default wrap lines at 80 characters.  Is getenv
	 ("COLUMNS") preferable?  */
      diagnostic_line_cutoff (global_dc) = 80;
      /* By default, emit location information once for every
	 diagnostic message.  */
      diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
    }

  parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89,
				ident_hash, &line_table);

  cpp_opts = cpp_get_options (parse_in);
  cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
  cpp_opts->objc = c_dialect_objc ();

  /* Reset to avoid warnings on internal definitions.  We set it just
     before passing on command-line options to cpplib.  */
  cpp_opts->warn_dollars = 0;

  flag_exceptions = c_dialect_cxx ();
  warn_pointer_arith = c_dialect_cxx ();
  warn_write_strings = c_dialect_cxx();

  deferred_opts = XNEWVEC (struct deferred_opt, argc);

  result = lang_flags[c_language];

  if (c_language == clk_c)
    {
      /* If preprocessing assembly language, accept any of the C-family
	 front end options since the driver may pass them through.  */
      for (i = 1; i < argc; i++)
	if (! strcmp (argv[i], "-lang-asm"))
	  {
	    result |= CL_C | CL_ObjC | CL_CXX | CL_ObjCXX;
	    break;
	  }

#ifdef CL_Fortran
      for (i = 1; i < argc; i++)
	if (! strcmp (argv[i], "-lang-fortran"))
	{
	    result |= CL_Fortran;
	    break;
	}
#endif
    }

  return result;
}
开发者ID:0mp,项目名称:freebsd,代码行数:61,代码来源:c-opts.c

示例3: c_common_init_options_struct

/* Initialize options structure OPTS.  */
void
c_common_init_options_struct (struct gcc_options *opts)
{
  opts->x_flag_exceptions = c_dialect_cxx ();
  opts->x_warn_pointer_arith = c_dialect_cxx ();
  opts->x_warn_write_strings = c_dialect_cxx ();
  opts->x_flag_warn_unused_result = true;

  /* By default, C99-like requirements for complex multiply and divide.  */
  opts->x_flag_complex_method = 2;
}
开发者ID:yesboyhongtai,项目名称:gcc,代码行数:12,代码来源:c-opts.c

示例4: c_common_init_options

/* Common initialization before calling option handlers.  */
void
c_common_init_options (unsigned int decoded_options_count,
		       struct cl_decoded_option *decoded_options)
{
  unsigned int i;
  struct cpp_callbacks *cb;

  parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89,
				ident_hash, line_table);
  cb = cpp_get_callbacks (parse_in);
  cb->error = c_cpp_error;

  cpp_opts = cpp_get_options (parse_in);
  cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
  cpp_opts->objc = c_dialect_objc ();

  /* Reset to avoid warnings on internal definitions.  We set it just
     before passing on command-line options to cpplib.  */
  cpp_opts->warn_dollars = 0;

  deferred_opts = XNEWVEC (struct deferred_opt, decoded_options_count);

  if (c_language == clk_c)
    {
      /* If preprocessing assembly language, accept any of the C-family
	 front end options since the driver may pass them through.  */
      for (i = 1; i < decoded_options_count; i++)
	if (decoded_options[i].opt_index == OPT_lang_asm)
	  {
	    accept_all_c_family_options = true;
	    break;
	  }
    }
}
开发者ID:yesboyhongtai,项目名称:gcc,代码行数:35,代码来源:c-opts.c

示例5: lex_charconst

/* Converts a (possibly wide) character constant token into a tree.  */
static tree
lex_charconst (const cpp_token *token)
{
  cppchar_t result;
  tree type, value;
  unsigned int chars_seen;
  int unsignedp;

  result = cpp_interpret_charconst (parse_in, token,
				    &chars_seen, &unsignedp);

  if (token->type == CPP_WCHAR)
    type = wchar_type_node;
  /* In C, a character constant has type 'int'.
     In C++ 'char', but multi-char charconsts have type 'int'.  */
  else if (!c_dialect_cxx () || chars_seen > 1)
    type = integer_type_node;
  else
    type = char_type_node;

  /* Cast to cppchar_signed_t to get correct sign-extension of RESULT
     before possibly widening to HOST_WIDE_INT for build_int_cst.  */
  if (unsignedp || (cppchar_signed_t) result >= 0)
    value = build_int_cst_wide (type, result, 0);
  else
    value = build_int_cst_wide (type, (cppchar_signed_t) result, -1);

  return value;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:30,代码来源:c-lex.c

示例6: c_common_init_options

/* Common initialization before calling option handlers.  */
void
c_common_init_options (unsigned int decoded_options_count,
		       struct cl_decoded_option *decoded_options)
{
  unsigned int i;
  struct cpp_callbacks *cb;

  g_string_concat_db
    = new (ggc_alloc <string_concat_db> ()) string_concat_db ();

  parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89,
				ident_hash, line_table);
  cb = cpp_get_callbacks (parse_in);
  cb->diagnostic = c_cpp_diagnostic;

  cpp_opts = cpp_get_options (parse_in);
  cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
  cpp_opts->objc = c_dialect_objc ();

  /* Reset to avoid warnings on internal definitions.  We set it just
     before passing on command-line options to cpplib.  */
  cpp_opts->warn_dollars = 0;

  deferred_opts = XNEWVEC (struct deferred_opt, decoded_options_count);

  if (c_language == clk_c)
    {
      /* The default for C is gnu17.  */
      set_std_c17 (false /* ISO */);

      /* If preprocessing assembly language, accept any of the C-family
	 front end options since the driver may pass them through.  */
      for (i = 1; i < decoded_options_count; i++)
	if (decoded_options[i].opt_index == OPT_lang_asm)
	  {
	    accept_all_c_family_options = true;
	    break;
	  }
    }

  /* Set C++ standard to C++14 if not specified on the command line.  */
  if (c_dialect_cxx ())
    set_std_cxx14 (/*ISO*/false);

  global_dc->colorize_source_p = true;
}
开发者ID:rth7680,项目名称:gcc,代码行数:47,代码来源:c-opts.c

示例7: there

/* In addition to calling fold_convert for EXPR of type TYPE, also
   call c_fully_fold to remove any C_MAYBE_CONST_EXPRs that could be
   hiding there (PR47197).  */
tree
fully_fold_convert (tree type, tree expr)
{
  tree result = fold_convert (type, expr);
  bool maybe_const = true;

  if (!c_dialect_cxx ())
    result = c_fully_fold (result, false, &maybe_const);

  return result;
}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:14,代码来源:s390-c.c

示例8: pp_c_specifier_qualifier_list

void
pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
{
  const enum tree_code code = TREE_CODE (t);

  if (TREE_CODE (t) != POINTER_TYPE)
    pp_c_type_qualifier_list (pp, t);
  switch (code)
    {
    case REFERENCE_TYPE:
    case POINTER_TYPE:
	/* APPLE LOCAL blocks */
	case BLOCK_POINTER_TYPE:
      {
	/* Get the types-specifier of this type.  */
	tree pointee = strip_pointer_operator (TREE_TYPE (t));
	pp_c_specifier_qualifier_list (pp, pointee);
	if (TREE_CODE (pointee) == ARRAY_TYPE
	    || TREE_CODE (pointee) == FUNCTION_TYPE)
	  {
	    pp_c_whitespace (pp);
	    pp_c_left_paren (pp);
	  }
	else if (!c_dialect_cxx ())
	  pp_c_whitespace (pp);
	pp_ptr_operator (pp, t);
      }
      break;

    case FUNCTION_TYPE:
    case ARRAY_TYPE:
      pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
      break;

    case VECTOR_TYPE:
    case COMPLEX_TYPE:
      pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
      if (code == COMPLEX_TYPE)
	pp_c_identifier (pp, flag_isoc99 ? "_Complex" : "__complex__");
      else if (code == VECTOR_TYPE)
	pp_c_identifier (pp, "__vector__");
      break;

    default:
      pp_simple_type_specifier (pp, t);
      break;
    }
}
开发者ID:DmitrySkiba,项目名称:itoa-toolchain,代码行数:48,代码来源:c-pretty-print.c

示例9: define__GNUC__

/* Define __GNUC__, __GNUC_MINOR__ and __GNUC_PATCHLEVEL__.  */
static void
define__GNUC__ (void)
{
  int major, minor, patchlevel;

  if (sscanf (BASEVER, "%d.%d.%d", &major, &minor, &patchlevel) != 3)
    {
      sscanf (BASEVER, "%d.%d", &major, &minor);
      patchlevel = 0;
    }
  cpp_define_formatted (parse_in, "__GNUC__=%d", major);
  cpp_define_formatted (parse_in, "__GNUC_MINOR__=%d", minor);
  cpp_define_formatted (parse_in, "__GNUC_PATCHLEVEL__=%d", patchlevel);

  if (c_dialect_cxx ())
    cpp_define_formatted (parse_in, "__GNUG__=%d", major);
}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:18,代码来源:c-cppbuiltin.c

示例10: c_common_initialize_diagnostics

/* Common diagnostics initialization.  */
void
c_common_initialize_diagnostics (diagnostic_context *context)
{
  /* This is conditionalized only because that is the way the front
     ends used to do it.  Maybe this should be unconditional?  */
  if (c_dialect_cxx ())
    {
      /* By default wrap lines at 80 characters.  Is getenv
	 ("COLUMNS") preferable?  */
      diagnostic_line_cutoff (context) = 80;
      /* By default, emit location information once for every
	 diagnostic message.  */
      diagnostic_prefixing_rule (context) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
    }

  context->opt_permissive = OPT_fpermissive;
}
开发者ID:yesboyhongtai,项目名称:gcc,代码行数:18,代码来源:c-opts.c

示例11: gcc_plugin_finish_type

void gcc_plugin_finish_type(void *gcc_data, void *user_data)
{
    tree type = (tree) gcc_data;
    if (TREE_CODE(type) == ERROR_MARK) return;

    tree idnode = TYPE_NAME(type);

    // if the structure was declared with an explicit name then assign it that.
    if (idnode && TREE_CODE(idnode) == IDENTIFIER_NODE) {
        const char *name = IDENTIFIER_POINTER(idnode);
        XIL_CSUName(type, name);
    }

    // for C++ we check the type for a TYPE_DECL name within XIL_CSUName.
    // force this check now so that we don't get confused by any later typedefs.
    if (c_dialect_cxx())
        XIL_CSUName(type, NULL);
}
开发者ID:killbug2004,项目名称:implementations,代码行数:18,代码来源:xgill.c

示例12: define__GNUC__

/* Define __GNUC__, __GNUC_MINOR__ and __GNUC_PATCHLEVEL__.  */
static void
define__GNUC__ (void)
{
  /* The format of the version string, enforced below, is
     ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?  */
  const char *q, *v = version_string;

  while (*v && ! ISDIGIT (*v))
    v++;
  if (!*v || (v > version_string && v[-1] != '-'))
    abort ();

  q = v;
  while (ISDIGIT (*v))
    v++;
  builtin_define_with_value_n ("__GNUC__", q, v - q);
  if (c_dialect_cxx ())
    builtin_define_with_value_n ("__GNUG__", q, v - q);

  if (*v != '.' || !ISDIGIT (v[1]))
    abort ();
  q = ++v;
  while (ISDIGIT (*v))
    v++;
  builtin_define_with_value_n ("__GNUC_MINOR__", q, v - q);

  if (*v == '.')
    {
      if (!ISDIGIT (v[1]))
	abort ();
      q = ++v;
      while (ISDIGIT (*v))
	v++;
      builtin_define_with_value_n ("__GNUC_PATCHLEVEL__", q, v - q);
    }
  else
    builtin_define_with_value_n ("__GNUC_PATCHLEVEL__", "0", 1);

  if (*v && *v != ' ' && *v != '-')
    abort ();
}
开发者ID:BelyyVedmak,项目名称:gcc,代码行数:42,代码来源:c-cppbuiltin.c

示例13: 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

示例14: c_common_handle_option


//.........这里部分代码省略.........

    case OPT_MQ:
    case OPT_MT:
      deps_seen = true;
      defer_opt (code, arg);
      break;

    case OPT_P:
      flag_no_line_commands = 1;
      break;

    case OPT_fworking_directory:
      flag_working_directory = value;
      break;

    case OPT_U:
      defer_opt (code, arg);
      break;

    case OPT_Wall:
      /* APPLE LOCAL -Wmost */
    case OPT_Wmost:
      set_Wunused (value);
      set_Wformat (value);
      set_Wimplicit (value);
      warn_char_subscripts = value;
      warn_missing_braces = value;
      /* APPLE LOCAL begin -Wmost --dpatel */
      if (code != OPT_Wmost) 
	warn_parentheses = value;
      /* APPLE LOCAL end -Wmost --dpatel */
      warn_return_type = value;
      warn_sequence_point = value;	/* Was C only.  */
      if (c_dialect_cxx ())
	warn_sign_compare = value;
      warn_switch = value;
      set_warn_strict_aliasing (value);
      warn_strict_overflow = value;
      warn_address = value;

      /* Only warn about unknown pragmas that are not in system
	 headers.  */
      warn_unknown_pragmas = value;

      /* We save the value of warn_uninitialized, since if they put
	 -Wuninitialized on the command line, we need to generate a
	 warning about not using it without also specifying -O.  */
      if (warn_uninitialized != 1)
	warn_uninitialized = (value ? 2 : 0);

      if (!c_dialect_cxx ())
	/* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
	   can turn it off only if it's not explicit.  */
	warn_main = value * 2;
      else
	{
	  /* C++-specific warnings.  */
	  warn_reorder = value;
	  warn_nontemplate_friend = value;
	}

      cpp_opts->warn_trigraphs = value;
      cpp_opts->warn_comments = value;
      cpp_opts->warn_num_sign_change = value;
      cpp_opts->warn_multichar = value;	/* Was C++ only.  */
开发者ID:0mp,项目名称:freebsd,代码行数:66,代码来源:c-opts.c

示例15: c_common_handle_option


//.........这里部分代码省略.........
	  if (!value || (arg && strcasecmp (arg, "none") == 0))
	    cpp_opts->warn_normalize = normalized_none;
	  else if (!arg || strcasecmp (arg, "nfkc") == 0)
	    cpp_opts->warn_normalize = normalized_KC;
	  else if (strcasecmp (arg, "id") == 0)
	    cpp_opts->warn_normalize = normalized_identifier_C;
	  else if (strcasecmp (arg, "nfc") == 0)
	    cpp_opts->warn_normalize = normalized_C;
	  else
	    error ("argument %qs to %<-Wnormalized%> not recognized", arg);
	  break;
	}

    case OPT_Wtraditional:
      cpp_opts->cpp_warn_traditional = value;
      break;

    case OPT_Wtrigraphs:
      cpp_opts->warn_trigraphs = value;
      break;

    case OPT_Wundef:
      cpp_opts->warn_undef = value;
      break;

    case OPT_Wunknown_pragmas:
      /* Set to greater than 1, so that even unknown pragmas in
	 system headers will be warned about.  */
      /* ??? There is no way to handle this automatically for now.  */
      warn_unknown_pragmas = value * 2;
      break;

    case OPT_ansi:
      if (!c_dialect_cxx ())
	set_std_c89 (false, true);
      else
	set_std_cxx98 (true);
      break;

    case OPT_d:
      handle_OPT_d (arg);
      break;

    case OPT_fcanonical_system_headers:
      cpp_opts->canonical_system_headers = value;
      break;

    case OPT_fcond_mismatch:
      if (!c_dialect_cxx ())
	{
	  flag_cond_mismatch = value;
	  break;
	}
      warning (0, "switch %qs is no longer supported", option->opt_text);
      break;

    case OPT_fbuiltin_:
      if (value)
	result = false;
      else
	disable_builtin_function (arg);
      break;

    case OPT_fdirectives_only:
      cpp_opts->directives_only = value;
      break;
开发者ID:yesboyhongtai,项目名称:gcc,代码行数:67,代码来源:c-opts.c


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