本文整理汇总了C++中c_dialect_cxx函数的典型用法代码示例。如果您正苦于以下问题:C++ c_dialect_cxx函数的具体用法?C++ c_dialect_cxx怎么用?C++ c_dialect_cxx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了c_dialect_cxx函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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__GNUC__ ();
/* For stddef.h. They require macros defined in c-common.c. */
c_stddef_cpp_builtins ();
if (c_dialect_cxx ())
{
if (SUPPORTS_ONE_ONLY)
cpp_define (pfile, "__GXX_WEAK__=1");
else
cpp_define (pfile, "__GXX_WEAK__=0");
if (warn_deprecated)
cpp_define (pfile, "__DEPRECATED");
}
/* 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 an historical accident, this version had the value
"102". */
builtin_define_with_int_value ("__GXX_ABI_VERSION", 102);
else
/* Newer versions have values 1002, 1003, .... */
builtin_define_with_int_value ("__GXX_ABI_VERSION",
1000 + flag_abi_version);
/* libgcc needs to know this. */
if (USING_SJLJ_EXCEPTIONS)
cpp_define (pfile, "__USING_SJLJ_EXCEPTIONS__");
/* limits.h needs to know these. */
builtin_define_type_max ("__SCHAR_MAX__", signed_char_type_node, 0);
builtin_define_type_max ("__SHRT_MAX__", short_integer_type_node, 0);
builtin_define_type_max ("__INT_MAX__", integer_type_node, 0);
builtin_define_type_max ("__LONG_MAX__", long_integer_type_node, 1);
builtin_define_type_max ("__LONG_LONG_MAX__", long_long_integer_type_node, 2);
builtin_define_type_max ("__WCHAR_MAX__", wchar_type_node, 0);
builtin_define_type_precision ("__CHAR_BIT__", char_type_node);
/* float.h needs to know these. */
builtin_define_with_int_value ("__FLT_EVAL_METHOD__",
TARGET_FLT_EVAL_METHOD);
builtin_define_float_constants ("FLT", "F", float_type_node);
builtin_define_float_constants ("DBL", "", double_type_node);
builtin_define_float_constants ("LDBL", "L", long_double_type_node);
/* For use in assembly language. */
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
/* Misc. */
builtin_define_with_value ("__VERSION__", version_string, 1);
/* Definitions for LP64 model. */
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__");
}
/* Other target-independent built-ins determined by command-line
options. */
if (optimize_size)
cpp_define (pfile, "__OPTIMIZE_SIZE__");
if (optimize)
cpp_define (pfile, "__OPTIMIZE__");
if (fast_math_flags_set_p ())
cpp_define (pfile, "__FAST_MATH__");
if (flag_really_no_inline)
cpp_define (pfile, "__NO_INLINE__");
if (flag_signaling_nans)
cpp_define (pfile, "__SUPPORT_SNAN__");
if (flag_finite_math_only)
//.........这里部分代码省略.........
开发者ID:BelyyVedmak,项目名称:gcc,代码行数:101,代码来源:c-cppbuiltin.c
示例17: 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++;
gcc_assert (*v && (v <= version_string || v[-1] == '-'));
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);
gcc_assert (*v == '.' && ISDIGIT (v[1]));
q = ++v;
while (ISDIGIT (*v))
v++;
builtin_define_with_value_n ("__GNUC_MINOR__", q, v - q);
if (*v == '.')
{
gcc_assert (ISDIGIT (v[1]));
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);
gcc_assert (!*v || *v == ' ' || *v == '-');
/* LLVM LOCAL no version number */
#ifdef CONFIG_DARWIN_H
#ifndef LLVM_VERSION_INFO
/* APPLE LOCAL begin Apple version */
{
/* This chunk of code defines __APPLE_CC__ from the version
string. It expects to see a substring of the version string of
the form "build NNNN)", where each N is a digit, and the first
N is nonzero (there can be 4 or 5 digits). It will abort() if
these conditions are not met, since that usually means that
someone's broken the version string. */
const char *vt;
vt = strstr (version_string, "build ");
if (vt == NULL)
abort ();
vt += strlen ("build ");
if (! ISDIGIT (*vt))
abort ();
for (q = vt; *q != 0 && ISDIGIT (*q); q++)
;
if (q == vt || *q != ')')
abort ();
if ((q - vt != 4 && q - vt != 5) || *vt == '0')
abort ();
builtin_define_with_value_n ("__APPLE_CC__", vt, q - vt);
}
/* APPLE LOCAL end Apple version */
/* LLVM LOCAL begin version number */
#else
/* This chunk of code defines __APPLE_CC__ from the version
string. It expects to see a substring of the version string of
the form "build NNNN)", where each N is a digit, and the first
N is nonzero (there can be 4 or 5 digits). It will abort() if
these conditions are not met, since that usually means that
someone's broken the version string. */
/* LLVM builds multiple different ways. For example, for official releases,
the version number is something like "1.8". We don't want to disable
__APPLE_CC__ entirely, as this breaks system headers. If the build number
is not a 4-digit code, just define __APPLE_CC__ to 1 instead of abort()ing
as per above comment.
*/
{
const char *vt;
vt = strstr (version_string, "build ");
if (vt == NULL) {
builtin_define_with_value_n ("__APPLE_CC__", "1", 1);
return;
}
vt += strlen ("build ");
if (! ISDIGIT (*vt)) {
builtin_define_with_value_n ("__APPLE_CC__", "1", 1);
return;
}
for (q = vt; *q != 0 && ISDIGIT (*q); q++)
;
//.........这里部分代码省略.........
开发者ID:aosm,项目名称:llvmgcc42,代码行数:101,代码来源:c-cppbuiltin.c
示例18: gcc_plugin_finish_decl
void gcc_plugin_finish_decl(void *gcc_data, void *user_data)
{
tree decl = (tree) gcc_data;
tree type = TREE_TYPE(decl);
// push this onto the pending parameters if necessary.
if (TREE_CODE(decl) == PARM_DECL) {
// we should only see parameter declarations for C.
gcc_assert(!c_dialect_cxx());
struct XIL_ParamDecl *last = xil_pending_param_decls;
while (last && last->next) last = last->next;
struct XIL_ParamDecl *param_decl = xcalloc(1, sizeof(struct XIL_ParamDecl));
param_decl->decl = decl;
if (last) last->next = param_decl;
else xil_pending_param_decls = param_decl;
return;
}
// check for typedefs on structures, and assign the structure a name
// if one is found.
if (TREE_CODE(decl) == TYPE_DECL &&
(TREE_CODE(type) == RECORD_TYPE || TREE_CODE(type) == UNION_TYPE)) {
if (XIL_IsAnonymous(type)) {
const char *name = IDENTIFIER_POINTER(DECL_NAME(decl));
XIL_CSUName(type, name);
}
}
// check for a global variable.
bool is_global = false;
if (TREE_CODE(decl) == VAR_DECL) {
if (DECL_CONTEXT(decl) == NULL)
is_global = true;
if (TREE_STATIC(decl))
is_global = true;
}
bool is_function = (TREE_CODE(decl) == FUNCTION_DECL);
if (!is_global && !is_function)
return;
// only processing the output function for annotations.
if (xil_has_annotation)
return;
XIL_Var var = XIL_TranslateVar(decl);
const char *name = XIL_GetVarName(var);
// future parameter declarations will be for a different function.
xil_pending_param_decls = NULL;
if (!is_global)
return;
// check if this is a global variable we want to skip. these are introduced
// for type information globals.
static const char *bad_prefix_list[] = {
"const __class_type_info_pseudo",
"const __si_class_type_info_pseudo",
"const __vmi_class_type_info_pseudo",
"const char _ZTS",
NULL
};
int ind;
for (ind = 0; bad_prefix_list[ind]; ind++) {
const char *bad_prefix = bad_prefix_list[ind];
if (!strncmp(name, bad_prefix, strlen(bad_prefix)))
return;
}
// if the decl is contained in a template class then skip it. we can only
// handle instantiated declarations, and will only see the uninstantiated
// declarations here. TODO: is there a way to get these?
if (DECL_LANG_SPECIFIC(decl) != NULL &&
DECL_TEMPLATE_INFO(decl) != NULL)
return;
tree context = DECL_CONTEXT(decl);
while (context && TREE_CODE(context) == FUNCTION_DECL) {
if (DECL_LANG_SPECIFIC(context) != NULL &&
DECL_TEMPLATE_INFO(context) != NULL)
return;
context = DECL_CONTEXT(context);
}
// this is a function or global, process any annotation attributes.
tree attr = DECL_ATTRIBUTES(decl);
while (attr) {
XIL_ProcessAnnotationAttr(decl, attr, NULL, NULL);
attr = TREE_CHAIN(attr);
}
// also look for annotations read in from file.
for (ind = 0; ind < XIL_GetAnnotationCount(name, !is_function, false); ind++) {
const char *where;
const char *point_text, *annot_text;
//.........这里部分代码省略.........
开发者ID:killbug2004,项目名称:implementations,代码行数:101,代码来源:xgill.c
示例19: 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__GNUC__ ();
/* For stddef.h. They require macros defined in c-common.c. */
c_stddef_cpp_builtins ();
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 == cxx0x)
cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__");
}
/* 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". */
builtin_define_with_int_value ("__GXX_ABI_VERSION", 102);
else
/* Newer versions have values 1002, 1003, .... */
builtin_define_with_int_value ("__GXX_ABI_VERSION",
1000 + flag_abi_version);
/* libgcc needs to know this. */
if (USING_SJLJ_EXCEPTIONS)
cpp_define (pfile, "__USING_SJLJ_EXCEPTIONS__");
/* limits.h needs to know these. */
builtin_define_type_max ("__SCHAR_MAX__", signed_char_type_node, 0);
builtin_define_type_max ("__SHRT_MAX__", short_integer_type_node, 0);
builtin_define_type_max ("__INT_MAX__", integer_type_node, 0);
builtin_define_type_max ("__LONG_MAX__", long_integer_type_node, 1);
builtin_define_type_max ("__LONG_LONG_MAX__", long_long_integer_type_node, 2);
builtin_define_type_max ("__WCHAR_MAX__", wchar_type_node, 0);
builtin_define_type_precision ("__CHAR_BIT__", char_type_node);
/* stdint.h (eventually) and the testsuite need to know these. */
builtin_define_stdint_macros ();
/* float.h needs to know these. */
builtin_define_with_int_value ("__FLT_EVAL_METHOD__",
TARGET_FLT_EVAL_METHOD);
/* And decfloat.h needs this. */
builtin_define_with_int_value ("__DEC_EVAL_METHOD__",
TARGET_DEC_EVAL_METHOD);
builtin_define_float_constants ("FLT", "F", "%s", float_type_node);
/* Cast the double precision constants when single precision constants are
specified. The correct result is computed by the compiler when using
macros that include a cast. This has the side-effect of making the value
unusable in const expressions. */
if (flag_single_precision_constant)
builtin_define_float_constants ("DBL", "L", "((double)%s)", double_type_node);
else
builtin_define_float_constants ("DBL", "", "%s", double_type_node);
builtin_define_float_constants ("LDBL", "L", "%s", long_double_type_node);
/* For decfloat.h. */
builtin_define_decimal_float_constants ("DEC32", "DF", dfloat32_type_node);
builtin_define_decimal_float_constants ("DEC64", "DD", dfloat64_type_node);
builtin_define_decimal_float_constants ("DEC128", "DL", dfloat128_type_node);
/* For fixed-point fibt, ibit, max, min, and epsilon. */
if (targetm.fixed_point_supported_p ())
{
builtin_define_fixed_point_constants ("SFRACT", "HR",
short_fract_type_node);
builtin_define_fixed_point_constants ("USFRACT", "UHR",
unsigned_short_fract_type_node);
//.........这里部分代码省略.........
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:101,代码来源:c-cppbuiltin.c
示例20: cpp_iec_559_value
/* Return the value for __GCC_IEC_559. */
static int
cpp_iec_559_value (void)
{
/* The default is support for IEEE 754-2008. */
int ret = 2;
/* float and double must be binary32 and binary64. If they are but
with reversed NaN convention, at most IEEE 754-1985 is
supported. */
const struct real_format *ffmt
= REAL_MODE_FORMAT (TYPE_MODE (float_type_node));
const struct real_format *dfmt
= REAL_MODE_FORMAT (TYPE_MODE (double_type_node));
if (!ffmt->qnan_msb_set || !dfmt->qnan_msb_set)
ret = 1;
if (ffmt->b != 2
|| ffmt->p != 24
|| ffmt->pnan != 24
|| ffmt->emin != -125
|| ffmt->emax != 128
|| ffmt->signbit_rw != 31
|| ffmt->round_towards_zero
|| !ffmt->has_sign_dependent_rounding
|| !ffmt->has_nans
|| !ffmt->has_inf
|| !ffmt->has_denorm
|| !ffmt->has_signed_zero
|| dfmt->b != 2
|| dfmt->p != 53
|| dfmt->pnan != 53
|| dfmt->emin != -1021
|| dfmt->emax != 1024
|| dfmt->signbit_rw != 63
|| dfmt->round_towards_zero
|| !dfmt->has_sign_dependent_rounding
|| !dfmt->has_nans
|| !dfmt->has_inf
|| !dfmt->has_denorm
|| !dfmt->has_signed_zero)
ret = 0;
/* In strict C standards conformance mode, consider unpredictable
excess precision to mean lack of IEEE 754 support. The same
applies to unpredictable contraction. For C++, and outside
strict conformance mode, do not consider these options to mean
lack of IEEE 754 support. */
if (flag_iso
&& !c_dialect_cxx ()
&& TARGET_FLT_EVAL_METHOD != 0
&& flag_excess_precision_cmdline != EXCESS_PRECISION_STANDARD)
ret = 0;
if (flag_iso
&& !c_dialect_cxx ()
&& flag_fp_contract_mode == FP_CONTRACT_FAST)
ret = 0;
/* Various options are contrary to IEEE 754 semantics. */
if (flag_unsafe_math_optimizations
|| flag_associative_math
|| flag_reciprocal_math
|| flag_finite_math_only
|| !flag_signed_zeros
|| flag_single_precision_constant)
ret = 0;
/* If the target does not support IEEE 754 exceptions and rounding
modes, consider IEEE 754 support to be absent. */
if (!targetm.float_exceptions_rounding_supported_p ())
ret = 0;
return ret;
}
开发者ID:ds2dev,项目名称:gcc,代码行数:73,代码来源:c-cppbuiltin.c
注:本文中的c_dialect_cxx函数示例由纯净天空整理自Github/MSDocs等源码及文档管理 |
请发表评论