📄 decl2.c
字号:
/* Nonzero if we want to check the return value of new and avoid calling constructors if it is a null pointer. */int flag_check_new;/* Nonzero if we want the new ANSI rules for pushing a new scope for `for' initialization variables. 0: Old rules, set by -fno-for-scope. 2: New ANSI rules, set by -ffor-scope. 1: Try to implement new ANSI rules, but with backup compatibility (and warnings). This is the default, for now. */int flag_new_for_scope = 1;/* Nonzero if we want to emit defined symbols with common-like linkage as weak symbols where possible, in order to conform to C++ semantics. Otherwise, emit them as local symbols. */int flag_weak = 1;/* Nonzero to enable experimental ABI changes. */int flag_new_abi;/* Nonzero to not ignore namespace std. */int flag_honor_std;/* Maximum template instantiation depth. Must be at least 17 for ANSI compliance. */int max_tinst_depth = 17;/* The name-mangling scheme to use. Must be 1 or greater to support template functions with identical types, but different template arguments. */int name_mangling_version = 2;/* Nonzero means that guiding declarations are allowed. */int flag_guiding_decls;/* Nonzero if squashed mangling is to be performed. This uses the B and K codes to reference previously seen class types and class qualifiers. */int flag_do_squangling;/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */int flag_vtable_gc;/* Nonzero means make the default pedwarns warnings instead of errors. The value of this flag is ignored if -pedantic is specified. */int flag_permissive;/* Table of language-dependent -f options. STRING is the option name. VARIABLE is the address of the variable. ON_VALUE is the value to store in VARIABLE if `-fSTRING' is seen as an option. (If `-fno-STRING' is seen as an option, the opposite value is stored.) */static struct { const char *string; int *variable; int on_value;}lang_f_options[] ={ /* C/C++ options. */ {"signed-char", &flag_signed_char, 1}, {"unsigned-char", &flag_signed_char, 0}, {"signed-bitfields", &flag_signed_bitfields, 1}, {"unsigned-bitfields", &flag_signed_bitfields, 0}, {"short-enums", &flag_short_enums, 1}, {"short-double", &flag_short_double, 1}, {"cond-mismatch", &flag_cond_mismatch, 1}, {"asm", &flag_no_asm, 0}, {"builtin", &flag_no_builtin, 0}, /* C++-only options. */ {"access-control", &flag_access_control, 1}, {"check-new", &flag_check_new, 1}, {"conserve-space", &flag_conserve_space, 1}, {"const-strings", &flag_const_strings, 1}, {"default-inline", &flag_default_inline, 1}, {"dollars-in-identifiers", &dollars_in_ident, 1}, {"elide-constructors", &flag_elide_constructors, 1}, {"external-templates", &flag_external_templates, 1}, {"for-scope", &flag_new_for_scope, 2}, {"gnu-keywords", &flag_no_gnu_keywords, 0}, {"handle-exceptions", &flag_exceptions, 1}, {"handle-signatures", &flag_handle_signatures, 1}, {"honor-std", &flag_honor_std, 1}, {"huge-objects", &flag_huge_objects, 1}, {"implement-inlines", &flag_implement_inlines, 1}, {"implicit-inline-templates", &flag_implicit_inline_templates, 1}, {"implicit-templates", &flag_implicit_templates, 1}, {"labels-ok", &flag_labels_ok, 1}, {"nonansi-builtins", &flag_no_nonansi_builtin, 0}, {"operator-names", &flag_operator_names, 1}, {"optional-diags", &flag_optional_diags, 1}, {"permissive", &flag_permissive, 1}, {"repo", &flag_use_repository, 1}, {"rtti", &flag_rtti, 1}, {"squangle", &flag_do_squangling, 1}, {"stats", &flag_detailed_statistics, 1}, {"strict-prototype", &flag_strict_prototype, 1}, {"this-is-variable", &flag_this_is_variable, 1}, {"vtable-gc", &flag_vtable_gc, 1}, {"vtable-thunks", &flag_vtable_thunks, 1}, {"weak", &flag_weak, 1}, {"xref", &flag_gnu_xref, 1}};/* Decode the string P as a language-specific option. Return the number of strings consumed for a valid option. Otherwise return 0. */int lang_decode_option (argc, argv) int argc#if !USE_CPPLIB ATTRIBUTE_UNUSED#endif ; char **argv;{ int strings_processed; char *p = argv[0];#if USE_CPPLIB strings_processed = cpp_handle_option (&parse_in, argc, argv);#else strings_processed = 0;#endif /* ! USE_CPPLIB */ if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) /* ignore */; else if (p[0] == '-' && p[1] == 'f') { /* Some kind of -f option. P's value is the option sans `-f'. Search for it in the table of options. */ int found = 0; size_t j; p += 2; /* Try special -f options. */ if (!strcmp (p, "handle-exceptions") || !strcmp (p, "no-handle-exceptions")) warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)"); if (!strcmp (p, "memoize-lookups") || !strcmp (p, "no-memoize-lookups") || !strcmp (p, "save-memoized") || !strcmp (p, "no-save-memoized") || !strcmp (p, "no-all-virtual") || !strcmp (p, "no-enum-int-equiv") || !strcmp (p, "nonnull-objects") || !strcmp (p, "ansi-overloading")) { /* ignore */ found = 1; } else if (!strcmp (p, "all-virtual") || !strcmp (p, "enum-int-equiv") || !strcmp (p, "no-nonnull-objects") || !strcmp (p, "no-ansi-overloading")) { warning ("-f%s is no longer supported", p); found = 1; } else if (! strcmp (p, "alt-external-templates")) { flag_external_templates = 1; flag_alt_external_templates = 1; found = 1; cp_deprecated ("-falt-external-templates"); } else if (! strcmp (p, "no-alt-external-templates")) { flag_alt_external_templates = 0; found = 1; } else if (!strcmp (p, "repo")) { flag_use_repository = 1; flag_implicit_templates = 0; found = 1; } else if (!strcmp (p, "guiding-decls")) { flag_guiding_decls = 1; name_mangling_version = 0; found = 1; } else if (!strcmp (p, "no-guiding-decls")) { flag_guiding_decls = 0; found = 1; } else if (!strcmp (p, "this-is-variable")) { flag_this_is_variable = 1; found = 1; cp_deprecated ("-fthis-is-variable"); } else if (!strcmp (p, "external-templates")) { flag_external_templates = 1; found = 1; cp_deprecated ("-fexternal-templates"); } else if (!strncmp (p, "vtable-thunks", 13)) { if (p[13] == '=') { flag_vtable_thunks = read_integral_parameter (p+14, p, 1); } else { /* If the machine file has a default setting, use that for -fvtable-thunks. Otherwise, set it to version 2. */#if DEFAULT_VTABLE_THUNKS flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;#else flag_vtable_thunks = 1;#endif } if (flag_vtable_thunks == 2) /* v2 is a compatibility mode between v1 and v3. */ flag_vtable_thunks_compat = 1; else if(flag_vtable_thunks == 3) flag_vtable_thunks_compat = 0; found = 1; } else if (!strcmp (p, "handle-signatures")) { flag_handle_signatures = 1; found = 1; cp_deprecated ("-fhandle-signatures"); } else if (!strcmp (p, "new-abi")) { flag_new_abi = 1; flag_do_squangling = 1; flag_honor_std = 1; flag_vtable_thunks = 2; } else if (!strcmp (p, "no-new-abi")) { flag_new_abi = 0; flag_do_squangling = 0; flag_honor_std = 0; } else if (!strncmp (p, "template-depth-", 15)) { max_tinst_depth = read_integral_parameter (p + 15, p - 2, max_tinst_depth); } else if (!strncmp (p, "name-mangling-version-", 22)) { name_mangling_version = read_integral_parameter (p + 22, p - 2, name_mangling_version); } else for (j = 0; !found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]); j++) { if (!strcmp (p, lang_f_options[j].string)) { *lang_f_options[j].variable = lang_f_options[j].on_value; /* A goto here would be cleaner, but breaks the vax pcc. */ found = 1; } if (p[0] == 'n' && p[1] == 'o' && p[2] == '-' && ! strcmp (p+3, lang_f_options[j].string)) { *lang_f_options[j].variable = ! lang_f_options[j].on_value; found = 1; } } return found; } else if (p[0] == '-' && p[1] == 'W') { int setting = 1; /* The -W options control the warning behavior of the compiler. */ p += 2; if (p[0] == 'n' && p[1] == 'o' && p[2] == '-') setting = 0, p += 3; if (!strcmp (p, "implicit")) warn_implicit = setting; else if (!strcmp (p, "long-long")) warn_long_long = setting; else if (!strcmp (p, "return-type")) warn_return_type = setting; else if (!strcmp (p, "ctor-dtor-privacy")) warn_ctor_dtor_privacy = setting; else if (!strcmp (p, "write-strings")) warn_write_strings = setting; else if (!strcmp (p, "cast-qual")) warn_cast_qual = setting; else if (!strcmp (p, "char-subscripts")) warn_char_subscripts = setting; else if (!strcmp (p, "pointer-arith")) warn_pointer_arith = setting; else if (!strcmp (p, "missing-prototypes")) warn_missing_prototypes = setting; else if (!strcmp (p, "redundant-decls")) warn_redundant_decls = setting; else if (!strcmp (p, "missing-braces")) warn_missing_braces = setting; else if (!strcmp (p, "sign-compare")) warn_sign_compare = setting; else if (!strcmp (p, "format")) warn_format = setting; else if (!strcmp (p, "conversion")) warn_conversion = setting; else if (!strcmp (p, "parentheses")) warn_parentheses = setting; else if (!strcmp (p, "non-virtual-dtor")) warn_nonvdtor = setting; else if (!strcmp (p, "extern-inline")) warn_extern_inline = setting; else if (!strcmp (p, "reorder")) warn_reorder = setting; else if (!strcmp (p, "synth")) warn_synth = setting; else if (!strcmp (p, "pmf-conversions")) warn_pmf2ptr = setting; else if (!strcmp (p, "effc++")) warn_ecpp = setting; else if (!strcmp (p, "sign-promo")) warn_sign_promo = setting; else if (!strcmp (p, "old-style-cast")) warn_old_style_cast = setting; else if (!strcmp (p, "overloaded-virtual")) warn_overloaded_virtual = setting; else if (!strcmp (p, "multichar")) warn_multichar = setting; else if (!strcmp (p, "unknown-pragmas")) /* Set to greater than 1, so that even unknown pragmas in system headers will be warned about. */ warn_unknown_pragmas = setting * 2; else if (!strcmp (p, "non-template-friend")) warn_nontemplate_friend = setting; else if (!strcmp (p, "deprecated")) warn_deprecated = setting; else if (!strcmp (p, "comment")) ; /* cpp handles this one. */ else if (!strcmp (p, "comments")) ; /* cpp handles this one. */ else if (!strcmp (p, "trigraphs")) ; /* cpp handles this one. */ else if (!strcmp (p, "import")) ; /* cpp handles this one. */ else if (!strcmp (p, "all")) { warn_return_type = setting; warn_unused = setting; warn_implicit = setting; warn_switch = setting; warn_format = setting; warn_parentheses = setting; warn_missing_braces = setting; warn_sign_compare = setting; warn_multichar = setting; /* 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 = (setting ? 2 : 0); /* Only warn about unknown pragmas that are not in system headers. */ warn_unknown_pragmas = 1; /* C++-specific warnings. */ warn_ctor_dtor_privacy = setting; warn_nonvdtor = setting; warn_reorder = setting; warn_nontemplate_friend = setting; } else return strings_processed; } else if (!strcmp (p, "-ansi")) flag_no_nonansi_builtin = 1, flag_ansi = 1, flag_no_gnu_keywords = 1, flag_operator_names = 1;#ifdef SPEW_DEBUG /* Undocumented, only ever used when you're invoking cc1plus by hand, since it's probably safe to assume no sane person would ever want to use this under normal circumstances. */ else if (!strcmp (p, "-spew-debug")) spew_debug = 1;#endif else return strings_processed; return 1;}/* Incorporate `const' and `volatile' qualifiers for member functions. FUNCTION is a TYPE_DECL or a FUNCTION_DECL. QUALS is a list of qualifiers. */treegrok_method_quals (ctype, function, quals) tree ctype, function, quals;{ tree fntype = TREE_TYPE (function); tree raises = TYPE_RAISES_EXCEPTIONS (fntype); int type_quals = TYPE_UNQUALIFIED; int dup_quals = TYPE_UNQUALIFIED; do { int tq = cp_type_qual_from_rid (TREE_VALUE (quals)); if (type_quals & tq) dup_quals |= tq; else type_quals |= tq; quals = TREE_CHAIN (quals); } while (quals); if (dup_quals != TYPE_UNQUALIFIED) cp_error ("duplicate type qualifiers in %s declaration", TREE_CODE (function) == FUNCTION_DECL
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -