⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 decl2.c

📁 gcc库的原代码,对编程有很大帮助.
💻 C
📖 第 1 页 / 共 5 页
字号:
	write_virtuals = 2;      else error ("invalid +e option");      if (old_write_virtuals != 0	  && write_virtuals != old_write_virtuals)	error ("conflicting +e options given");    }  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, j;      p += 2;      /* Try special -f options.  */      if (!strcmp (p, "save-memoized"))	{	  flag_memoize_lookups = 1;	  flag_save_memoized_contexts = 1;	  found = 1;	}      if (!strcmp (p, "no-save-memoized"))	{	  flag_memoize_lookups = 0;	  flag_save_memoized_contexts = 0;	  found = 1;	}      else if (! strncmp (p, "cadillac", 8))	{	  flag_cadillac = atoi (p+9);	  found = 1;	}      else if (! strncmp (p, "no-cadillac", 11))	{	  flag_cadillac = 0;	  found = 1;	}      else if (! strcmp (p, "gc"))	{	  flag_gc = 1;	  /* This must come along for the ride.  */	  flag_rtti = 1;	  found = 1;	}      else if (! strcmp (p, "no-gc"))	{	  flag_gc = 0;	  /* This must come along for the ride.  */	  flag_rtti = 0;	  found = 1;	}      else if (! strcmp (p, "alt-external-templates"))	{	  flag_external_templates = 1;	  flag_alt_external_templates = 1;	  found = 1;	}      else if (! strcmp (p, "no-alt-external-templates"))	{	  flag_alt_external_templates = 0;	  found = 1;	}      else if (!strcmp (p, "ansi-overloading"))	{	  warning ("-fansi-overloading is no longer meaningful");	  found = 1;	}      else if (!strcmp (p, "repo"))	{	  flag_use_repository = 1;	  flag_implicit_templates = 0;	  found = 1;	}      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, "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, "traditional"))	warn_traditional = 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, "strict-prototypes"))	warn_strict_prototypes = 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, "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, "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"))	{	  extra_warnings = setting;	  warn_return_type = setting;	  warn_unused = setting;	  warn_implicit = setting;	  warn_ctor_dtor_privacy = setting;	  warn_switch = setting;	  warn_format = setting;	  warn_parentheses = setting;	  warn_missing_braces = setting;	  warn_extern_inline = setting;	  warn_nonvdtor = 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);	  warn_template_debugging = setting;	  warn_reorder = setting;	}      else if (!strcmp (p, "overloaded-virtual"))	warn_overloaded_virtual = setting;      else return 0;    }  else if (!strcmp (p, "-ansi"))    dollars_in_ident = 0, 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 0;  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);  do    {      extern tree ridpointers[];      if (TREE_VALUE (quals) == ridpointers[(int)RID_CONST])	{	  if (TYPE_READONLY (ctype))	    error ("duplicate `%s' %s",		   IDENTIFIER_POINTER (TREE_VALUE (quals)),		   (TREE_CODE (function) == FUNCTION_DECL		    ? "for member function" : "in type declaration"));	  ctype = build_type_variant (ctype, 1, TYPE_VOLATILE (ctype));	  build_pointer_type (ctype);	}      else if (TREE_VALUE (quals) == ridpointers[(int)RID_VOLATILE])	{	  if (TYPE_VOLATILE (ctype))	    error ("duplicate `%s' %s",		   IDENTIFIER_POINTER (TREE_VALUE (quals)),		   (TREE_CODE (function) == FUNCTION_DECL		    ? "for member function" : "in type declaration"));	  ctype = build_type_variant (ctype, TYPE_READONLY (ctype), 1);	  build_pointer_type (ctype);	}      else	my_friendly_abort (20);      quals = TREE_CHAIN (quals);    }  while (quals);  fntype = build_cplus_method_type (ctype, TREE_TYPE (fntype),				    (TREE_CODE (fntype) == METHOD_TYPE				     ? TREE_CHAIN (TYPE_ARG_TYPES (fntype))				     : TYPE_ARG_TYPES (fntype)));  if (raises)    fntype = build_exception_variant (fntype, raises);  TREE_TYPE (function) = fntype;  return ctype;}#if 0				/* Not used. *//* This routine replaces cryptic DECL_NAMEs with readable DECL_NAMEs.   It leaves DECL_ASSEMBLER_NAMEs with the correct value.  *//* This does not yet work with user defined conversion operators   It should.  */static voidsubstitute_nice_name (decl)     tree decl;{  if (DECL_NAME (decl) && TREE_CODE (DECL_NAME (decl)) == IDENTIFIER_NODE)    {      char *n = decl_as_string (DECL_NAME (decl), 1);      if (n[strlen (n) - 1] == ' ')	n[strlen (n) - 1] = 0;      DECL_NAME (decl) = get_identifier (n);    }}#endif/* Warn when -fexternal-templates is used and #pragma   interface/implementation is not used all the times it should be,   inform the user.  */voidwarn_if_unknown_interface (decl)     tree decl;{  static int already_warned = 0;  if (already_warned++)    return;  if (flag_alt_external_templates)    {      struct tinst_level *til = tinst_for_decl ();      int sl = lineno;      char *sf = input_filename;      if (til)	{	  lineno = til->line;	  input_filename = til->file;	}      cp_warning ("template `%#D' instantiated in file without #pragma interface",		  decl);      lineno = sl;      input_filename = sf;    }  else    cp_warning_at ("template `%#D' defined in file without #pragma interface",		   decl);}/* A subroutine of the parser, to handle a component list.  */treegrok_x_components (specs, components)     tree specs, components;{  register tree t, x, tcode;  /* We just got some friends.  They have been recorded elsewhere.  */  if (components == void_type_node)    return NULL_TREE;  if (components == NULL_TREE)    {      t = groktypename (build_decl_list (specs, NULL_TREE));      if (t == NULL_TREE)	{	  error ("error in component specification");	  return NULL_TREE;	}      switch (TREE_CODE (t))	{	case VAR_DECL:	  /* Static anonymous unions come out as VAR_DECLs.  */	  if (TREE_CODE (TREE_TYPE (t)) == UNION_TYPE	      && ANON_AGGRNAME_P (TYPE_IDENTIFIER (TREE_TYPE (t))))	    return t;	  /* We return SPECS here, because in the parser it was ending	     up with not doing anything to $$, which is what SPECS	     represents.  */	  return specs;	  break;	case RECORD_TYPE:	  /* This code may be needed for UNION_TYPEs as	     well.  */	  tcode = record_type_node;	  if (CLASSTYPE_DECLARED_CLASS(t))	    tcode = class_type_node;	  else if (IS_SIGNATURE(t))	    tcode = signature_type_node;	  	  t = xref_tag (tcode, TYPE_IDENTIFIER (t), NULL_TREE, 0);	  if (TYPE_CONTEXT(t))	    CLASSTYPE_NO_GLOBALIZE(t) = 1;	  return NULL_TREE;	  break;	case UNION_TYPE:	case ENUMERAL_TYPE:	  if (TREE_CODE(t) == UNION_TYPE)	    tcode = union_type_node;	  else	    tcode = enum_type_node;	  t = xref_tag (tcode, TYPE_IDENTIFIER (t), NULL_TREE, 0);	  if (TREE_CODE(t) == UNION_TYPE && TYPE_CONTEXT(t))	    CLASSTYPE_NO_GLOBALIZE(t) = 1;	  if (TREE_CODE (t) == UNION_TYPE	      && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))	    {	      struct pending_inline **p;	      x = build_lang_field_decl (FIELD_DECL, NULL_TREE, t);	      /* Wipe out memory of synthesized methods */	      TYPE_HAS_CONSTRUCTOR (t) = 0;	      TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0;	      TYPE_HAS_INIT_REF (t) = 0;	      TYPE_HAS_CONST_INIT_REF (t) = 0;	      TYPE_HAS_ASSIGN_REF (t) = 0;	      TYPE_HAS_ASSIGNMENT (t) = 0;	      TYPE_HAS_CONST_ASSIGN_REF (t) = 0;	      p = &pending_inlines;	      for (; *p; *p = (*p)->next)		if (DECL_CONTEXT ((*p)->fndecl) != t)		  break;	    }	  else if (TREE_CODE (t) == ENUMERAL_TYPE)	    x = grok_enum_decls (t, NULL_TREE);	  else	    x = NULL_TREE;	  return x;	  break;	default:	  if (t != void_type_node)	    error ("empty component declaration");	  return NULL_TREE;	}    }  else    {      t = TREE_TYPE (components);      if (TREE_CODE (t) == ENUMERAL_TYPE && TREE_NONLOCAL_FLAG (t))	return grok_enum_decls (t, components);      else	return components;    }}/* Classes overload their constituent function names automatically.   When a function name is declared in a record structure,   its name is changed to it overloaded name.  Since names for   constructors and destructors can conflict, we place a leading   '$' for destructors.   CNAME is the name of the class we are grokking for.   FUNCTION is a FUNCTION_DECL.  It was created by `grokdeclarator'.   FLAGS contains bits saying what's special about today's   arguments.  1 == DESTRUCTOR.  2 == OPERATOR.   If FUNCTION is a destructor, then we must add the `auto-delete' field   as a second parameter.  There is some hair associated with the fact   that we must "declare" this variable in the manner consistent with the   way the rest of the arguments were declared.   QUALS are the qualifiers for the this pointer.  */voidgrokclassfn (ctype, cname, function, flags, quals)     tree ctype, cname, function;     enum overload_flags flags;     tree quals;{  tree fn_name = DECL_NAME (function);  tree arg_types;  tree parm;  tree qualtype;  tree fntype = TREE_TYPE (function);  tree raises = TYPE_RAISES_EXCEPTIONS (fntype);  if (fn_name == NULL_TREE)    {      error ("name missing for member function");      fn_name = get_identifier ("<anonymous>");      DECL_NAME (function) = fn_name;    }  if (quals)    qualtype = grok_method_quals (ctype, function, quals);  else    qualtype = ctype;  arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -