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

📄 gcc.c

📁 gcc关键代码
💻 C
📖 第 1 页 / 共 5 页
字号:
#ifdef TARGET_OPTION_TRANSLATE_TABLEstatic const struct {  const char *const option_found;  const char *const replacements;} target_option_translations[] ={  TARGET_OPTION_TRANSLATE_TABLE,  { 0, 0 }};#endif/* Translate the options described by *ARGCP and *ARGVP.   Make a new vector and store it back in *ARGVP,   and store its length in *ARGVC.  */static voidtranslate_options (int *argcp, const char *const **argvp){  int i;  int argc = *argcp;  const char *const *argv = *argvp;  int newvsize = (argc + 2) * 2 * sizeof (const char *);  const char **newv = xmalloc (newvsize);  int newindex = 0;  i = 0;  newv[newindex++] = argv[i++];  while (i < argc)    {#ifdef TARGET_OPTION_TRANSLATE_TABLE      int tott_idx;      for (tott_idx = 0;	   target_option_translations[tott_idx].option_found;	   tott_idx++)	{	  if (strcmp (target_option_translations[tott_idx].option_found,		      argv[i]) == 0)	    {	      int spaces = 1;	      const char *sp;	      char *np;	      for (sp = target_option_translations[tott_idx].replacements;		   *sp; sp++)		{		  if (*sp == ' ')		    spaces ++;		}	      newvsize += spaces * sizeof (const char *);	      newv =  xrealloc (newv, newvsize);	      sp = target_option_translations[tott_idx].replacements;	      np = xstrdup (sp);	      while (1)		{		  while (*np == ' ')		    np++;		  if (*np == 0)		    break;		  newv[newindex++] = np;		  while (*np != ' ' && *np)		    np++;		  if (*np == 0)		    break;		  *np++ = 0;		}	      i ++;	      break;	    }	}      if (target_option_translations[tott_idx].option_found)	continue;#endif      /* Translate -- options.  */      if (argv[i][0] == '-' && argv[i][1] == '-')	{	  size_t j;	  /* Find a mapping that applies to this option.  */	  for (j = 0; j < ARRAY_SIZE (option_map); j++)	    {	      size_t optlen = strlen (option_map[j].name);	      size_t arglen = strlen (argv[i]);	      size_t complen = arglen > optlen ? optlen : arglen;	      const char *arginfo = option_map[j].arg_info;	      if (arginfo == 0)		arginfo = "";	      if (!strncmp (argv[i], option_map[j].name, complen))		{		  const char *arg = 0;		  if (arglen < optlen)		    {		      size_t k;		      for (k = j + 1; k < ARRAY_SIZE (option_map); k++)			if (strlen (option_map[k].name) >= arglen			    && !strncmp (argv[i], option_map[k].name, arglen))			  {			    error ("ambiguous abbreviation %s", argv[i]);			    break;			  }		      if (k != ARRAY_SIZE (option_map))			break;		    }		  if (arglen > optlen)		    {		      /* If the option has an argument, accept that.  */		      if (argv[i][optlen] == '=')			arg = argv[i] + optlen + 1;		      /* If this mapping requires extra text at end of name,			 accept that as "argument".  */		      else if (strchr (arginfo, '*') != 0)			arg = argv[i] + optlen;		      /* Otherwise, extra text at end means mismatch.			 Try other mappings.  */		      else			continue;		    }		  else if (strchr (arginfo, '*') != 0)		    {		      error ("incomplete '%s' option", option_map[j].name);		      break;		    }		  /* Handle arguments.  */		  if (strchr (arginfo, 'a') != 0)		    {		      if (arg == 0)			{			  if (i + 1 == argc)			    {			      error ("missing argument to '%s' option",				     option_map[j].name);			      break;			    }			  arg = argv[++i];			}		    }		  else if (strchr (arginfo, '*') != 0)		    ;		  else if (strchr (arginfo, 'o') == 0)		    {		      if (arg != 0)			error ("extraneous argument to '%s' option",			       option_map[j].name);		      arg = 0;		    }		  /* Store the translation as one argv elt or as two.  */		  if (arg != 0 && strchr (arginfo, 'j') != 0)		    newv[newindex++] = concat (option_map[j].equivalent, arg,					       NULL);		  else if (arg != 0)		    {		      newv[newindex++] = option_map[j].equivalent;		      newv[newindex++] = arg;		    }		  else		    newv[newindex++] = option_map[j].equivalent;		  break;		}	    }	  i++;	}      /* Handle old-fashioned options--just copy them through,	 with their arguments.  */      else if (argv[i][0] == '-')	{	  const char *p = argv[i] + 1;	  int c = *p;	  int nskip = 1;	  if (SWITCH_TAKES_ARG (c) > (p[1] != 0))	    nskip += SWITCH_TAKES_ARG (c) - (p[1] != 0);	  else if (WORD_SWITCH_TAKES_ARG (p))	    nskip += WORD_SWITCH_TAKES_ARG (p);	  else if ((c == 'B' || c == 'b' || c == 'x')		   && p[1] == 0)	    nskip += 1;	  else if (! strcmp (p, "Xlinker"))	    nskip += 1;	  else if (! strcmp (p, "Xpreprocessor"))	    nskip += 1;	  else if (! strcmp (p, "Xassembler"))	    nskip += 1;	  /* Watch out for an option at the end of the command line that	     is missing arguments, and avoid skipping past the end of the	     command line.  */	  if (nskip + i > argc)	    nskip = argc - i;	  while (nskip > 0)	    {	      newv[newindex++] = argv[i++];	      nskip--;	    }	}      else	/* Ordinary operands, or +e options.  */	newv[newindex++] = argv[i++];    }  newv[newindex] = 0;  *argvp = newv;  *argcp = newindex;}static char *skip_whitespace (char *p){  while (1)    {      /* A fully-blank line is a delimiter in the SPEC file and shouldn't	 be considered whitespace.  */      if (p[0] == '\n' && p[1] == '\n' && p[2] == '\n')	return p + 1;      else if (*p == '\n' || *p == ' ' || *p == '\t')	p++;      else if (*p == '#')	{	  while (*p != '\n')	    p++;	  p++;	}      else	break;    }  return p;}/* Structures to keep track of prefixes to try when looking for files.  */struct prefix_list{  const char *prefix;	      /* String to prepend to the path.  */  struct prefix_list *next;   /* Next in linked list.  */  int require_machine_suffix; /* Don't use without machine_suffix.  */  /* 2 means try both machine_suffix and just_machine_suffix.  */  int priority;		      /* Sort key - priority within list.  */  int os_multilib;	      /* 1 if OS multilib scheme should be used,				 0 for GCC multilib scheme.  */};struct path_prefix{  struct prefix_list *plist;  /* List of prefixes to try */  int max_len;                /* Max length of a prefix in PLIST */  const char *name;           /* Name of this list (used in config stuff) */};/* List of prefixes to try when looking for executables.  */static struct path_prefix exec_prefixes = { 0, 0, "exec" };/* List of prefixes to try when looking for startup (crt0) files.  */static struct path_prefix startfile_prefixes = { 0, 0, "startfile" };/* List of prefixes to try when looking for include files.  */static struct path_prefix include_prefixes = { 0, 0, "include" };/* Suffix to attach to directories searched for commands.   This looks like `MACHINE/VERSION/'.  */static const char *machine_suffix = 0;/* Suffix to attach to directories searched for commands.   This is just `MACHINE/'.  */static const char *just_machine_suffix = 0;/* Adjusted value of GCC_EXEC_PREFIX envvar.  */static const char *gcc_exec_prefix;/* Adjusted value of standard_libexec_prefix.  */static const char *gcc_libexec_prefix;/* Default prefixes to attach to command names.  */#ifndef STANDARD_STARTFILE_PREFIX_1#define STANDARD_STARTFILE_PREFIX_1 "/lib/"#endif#ifndef STANDARD_STARTFILE_PREFIX_2#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"#endif#ifdef CROSS_COMPILE  /* Don't use these prefixes for a cross compiler.  */#undef MD_EXEC_PREFIX#undef MD_STARTFILE_PREFIX#undef MD_STARTFILE_PREFIX_1#endif/* If no prefixes defined, use the null string, which will disable them.  */#ifndef MD_EXEC_PREFIX#define MD_EXEC_PREFIX ""#endif#ifndef MD_STARTFILE_PREFIX#define MD_STARTFILE_PREFIX ""#endif#ifndef MD_STARTFILE_PREFIX_1#define MD_STARTFILE_PREFIX_1 ""#endifstatic const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";static const char *md_exec_prefix = MD_EXEC_PREFIX;static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;static const char *const standard_startfile_prefix_1  = STANDARD_STARTFILE_PREFIX_1;static const char *const standard_startfile_prefix_2  = STANDARD_STARTFILE_PREFIX_2;static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;static const char *tooldir_prefix;static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;static const char *standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;/* Subdirectory to use for locating libraries.  Set by   set_multilib_dir based on the compilation options.  */static const char *multilib_dir;/* Subdirectory to use for locating libraries in OS conventions.  Set by   set_multilib_dir based on the compilation options.  */static const char *multilib_os_dir;/* Structure to keep track of the specs that have been defined so far.   These are accessed using %(specname) or %[specname] in a compiler   or link spec.  */struct spec_list{				/* The following 2 fields must be first */				/* to allow EXTRA_SPECS to be initialized */  const char *name;		/* name of the spec.  */  const char *ptr;		/* available ptr if no static pointer */				/* The following fields are not initialized */				/* by EXTRA_SPECS */  const char **ptr_spec;	/* pointer to the spec itself.  */  struct spec_list *next;	/* Next spec in linked list.  */  int name_len;			/* length of the name */  int alloc_p;			/* whether string was allocated */};#define INIT_STATIC_SPEC(NAME,PTR) \{ NAME, NULL, PTR, (struct spec_list *) 0, sizeof (NAME) - 1, 0 }/* List of statically defined specs.  */static struct spec_list static_specs[] ={  INIT_STATIC_SPEC ("asm",			&asm_spec),

⌨️ 快捷键说明

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