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

📄 cccp.c

📁 gcc库的原代码,对编程有很大帮助.
💻 C
📖 第 1 页 / 共 5 页
字号:
  /* Non-0 means -v, so print the full set of include dirs.  */  int verbose = 0;  /* File name which deps are being written to.     This is 0 if deps are being written to stdout.  */  char *deps_file = 0;  /* Fopen file mode to open deps_file with.  */  char *deps_mode = "a";  /* Stream on which to print the dependency information.  */  FILE *deps_stream = 0;  /* Target-name to write with the dependency information.  */  char *deps_target = 0;#ifdef RLIMIT_STACK  /* Get rid of any avoidable limit on stack size.  */  {    struct rlimit rlim;    /* Set the stack limit huge so that alloca (particularly stringtab     * in dbxread.c) does not fail. */    getrlimit (RLIMIT_STACK, &rlim);    rlim.rlim_cur = rlim.rlim_max;    setrlimit (RLIMIT_STACK, &rlim);  }#endif /* RLIMIT_STACK defined */#ifdef SIGPIPE  signal (SIGPIPE, pipe_closed);#endif  cp = argv[0] + strlen (argv[0]);  while (cp != argv[0] && cp[-1] != '/'#ifdef DIR_SEPARATOR	 && cp[-1] != DIR_SEPARATOR#endif	 )    --cp;  progname = cp;#ifdef VMS  {    /* Remove directories from PROGNAME.  */    char *p;    char *s = progname;    if ((p = rindex (s, ':')) != 0) s = p + 1;	/* skip device */    if ((p = rindex (s, ']')) != 0) s = p + 1;	/* skip directory */    if ((p = rindex (s, '>')) != 0) s = p + 1;	/* alternate (int'n'l) dir */    s = progname = savestring (s);    if ((p = rindex (s, ';')) != 0) *p = '\0';	/* strip version number */    if ((p = rindex (s, '.')) != 0		/* strip type iff ".exe" */	&& (p[1] == 'e' || p[1] == 'E')	&& (p[2] == 'x' || p[2] == 'X')	&& (p[3] == 'e' || p[3] == 'E')	&& !p[4])      *p = '\0';  }#endif  in_fname = NULL;  out_fname = NULL;  /* Initialize is_idchar to allow $.  */  dollars_in_ident = 1;  initialize_char_syntax ();  dollars_in_ident = DOLLARS_IN_IDENTIFIERS > 0;  no_line_directives = 0;  no_trigraphs = 1;  dump_macros = dump_none;  no_output = 0;  cplusplus = 0;  cplusplus_comments = 1;  bzero ((char *) pend_files, argc * sizeof (char *));  bzero ((char *) pend_defs, argc * sizeof (char *));  bzero ((char *) pend_undefs, argc * sizeof (char *));  bzero ((char *) pend_assertions, argc * sizeof (char *));  bzero ((char *) pend_includes, argc * sizeof (char *));  /* Process switches and find input file name.  */  for (i = 1; i < argc; i++) {    if (argv[i][0] != '-') {      if (out_fname != NULL)	fatal ("Usage: %s [switches] input output", argv[0]);      else if (in_fname != NULL)	out_fname = argv[i];      else	in_fname = argv[i];    } else {      switch (argv[i][1]) {      case 'i':	if (!strcmp (argv[i], "-include")) {	  if (i + 1 == argc)	    fatal ("Filename missing after `-include' option");	  else	    pend_includes[i] = argv[i+1], i++;	}	if (!strcmp (argv[i], "-imacros")) {	  if (i + 1 == argc)	    fatal ("Filename missing after `-imacros' option");	  else	    pend_files[i] = argv[i+1], i++;	}	if (!strcmp (argv[i], "-iprefix")) {	  if (i + 1 == argc)	    fatal ("Filename missing after `-iprefix' option");	  else	    include_prefix = argv[++i];	}	if (!strcmp (argv[i], "-ifoutput")) {	  output_conditionals = 1;	}	if (!strcmp (argv[i], "-isystem")) {	  struct file_name_list *dirtmp;	  if (i + 1 == argc)	    fatal ("Filename missing after `-isystem' option");	  dirtmp = (struct file_name_list *)	    xmalloc (sizeof (struct file_name_list));	  dirtmp->next = 0;	  dirtmp->control_macro = 0;	  dirtmp->c_system_include_path = 1;	  dirtmp->fname = xmalloc (strlen (argv[i+1]) + 1);	  strcpy (dirtmp->fname, argv[++i]);	  dirtmp->got_name_map = 0;	  if (before_system == 0)	    before_system = dirtmp;	  else	    last_before_system->next = dirtmp;	  last_before_system = dirtmp; /* Tail follows the last one */	}	/* Add directory to end of path for includes,	   with the default prefix at the front of its name.  */	if (!strcmp (argv[i], "-iwithprefix")) {	  struct file_name_list *dirtmp;	  char *prefix;	  if (include_prefix != 0)	    prefix = include_prefix;	  else {	    prefix = savestring (GCC_INCLUDE_DIR);	    /* Remove the `include' from /usr/local/lib/gcc.../include.  */	    if (!strcmp (prefix + strlen (prefix) - 8, "/include"))	      prefix[strlen (prefix) - 7] = 0;	  }	  dirtmp = (struct file_name_list *)	    xmalloc (sizeof (struct file_name_list));	  dirtmp->next = 0;	/* New one goes on the end */	  dirtmp->control_macro = 0;	  dirtmp->c_system_include_path = 0;	  if (i + 1 == argc)	    fatal ("Directory name missing after `-iwithprefix' option");	  dirtmp->fname = xmalloc (strlen (argv[i+1]) + strlen (prefix) + 1);	  strcpy (dirtmp->fname, prefix);	  strcat (dirtmp->fname, argv[++i]);	  dirtmp->got_name_map = 0;	  if (after_include == 0)	    after_include = dirtmp;	  else	    last_after_include->next = dirtmp;	  last_after_include = dirtmp; /* Tail follows the last one */	}	/* Add directory to main path for includes,	   with the default prefix at the front of its name.  */	if (!strcmp (argv[i], "-iwithprefixbefore")) {	  struct file_name_list *dirtmp;	  char *prefix;	  if (include_prefix != 0)	    prefix = include_prefix;	  else {	    prefix = savestring (GCC_INCLUDE_DIR);	    /* Remove the `include' from /usr/local/lib/gcc.../include.  */	    if (!strcmp (prefix + strlen (prefix) - 8, "/include"))	      prefix[strlen (prefix) - 7] = 0;	  }	  dirtmp = (struct file_name_list *)	    xmalloc (sizeof (struct file_name_list));	  dirtmp->next = 0;	/* New one goes on the end */	  dirtmp->control_macro = 0;	  dirtmp->c_system_include_path = 0;	  if (i + 1 == argc)	    fatal ("Directory name missing after `-iwithprefixbefore' option");	  dirtmp->fname = xmalloc (strlen (argv[i+1]) + strlen (prefix) + 1);	  strcpy (dirtmp->fname, prefix);	  strcat (dirtmp->fname, argv[++i]);	  dirtmp->got_name_map = 0;	  append_include_chain (dirtmp, dirtmp);	}	/* Add directory to end of path for includes.  */	if (!strcmp (argv[i], "-idirafter")) {	  struct file_name_list *dirtmp;	  dirtmp = (struct file_name_list *)	    xmalloc (sizeof (struct file_name_list));	  dirtmp->next = 0;	/* New one goes on the end */	  dirtmp->control_macro = 0;	  dirtmp->c_system_include_path = 0;	  if (i + 1 == argc)	    fatal ("Directory name missing after `-idirafter' option");	  else	    dirtmp->fname = argv[++i];	  dirtmp->got_name_map = 0;	  if (after_include == 0)	    after_include = dirtmp;	  else	    last_after_include->next = dirtmp;	  last_after_include = dirtmp; /* Tail follows the last one */	}	break;      case 'o':	if (out_fname != NULL)	  fatal ("Output filename specified twice");	if (i + 1 == argc)	  fatal ("Filename missing after -o option");	out_fname = argv[++i];	if (!strcmp (out_fname, "-"))	  out_fname = "";	break;      case 'p':	if (!strcmp (argv[i], "-pedantic"))	  pedantic = 1;	else if (!strcmp (argv[i], "-pedantic-errors")) {	  pedantic = 1;	  pedantic_errors = 1;	} else if (!strcmp (argv[i], "-pcp")) {	  char *pcp_fname;	  if (i + 1 == argc)	    fatal ("Filename missing after -pcp option");	  pcp_fname = argv[++i];	  pcp_outfile = 	    ((pcp_fname[0] != '-' || pcp_fname[1] != '\0')	     ? fopen (pcp_fname, "w")	     : stdout);	  if (pcp_outfile == 0)	    pfatal_with_name (pcp_fname);	  no_precomp = 1;	}	break;      case 't':	if (!strcmp (argv[i], "-traditional")) {	  traditional = 1;	  cplusplus_comments = 0;	  if (dollars_in_ident > 0)	    dollars_in_ident = 1;	} else if (!strcmp (argv[i], "-trigraphs")) {	  no_trigraphs = 0;	}	break;      case 'l':	if (! strcmp (argv[i], "-lang-c"))	  cplusplus = 0, cplusplus_comments = 1, objc = 0;	if (! strcmp (argv[i], "-lang-c89"))	  cplusplus = 0, cplusplus_comments = 0, objc = 0;	if (! strcmp (argv[i], "-lang-c++"))	  cplusplus = 1, cplusplus_comments = 1, objc = 0;	if (! strcmp (argv[i], "-lang-objc"))	  objc = 1, cplusplus = 0, cplusplus_comments = 1;	if (! strcmp (argv[i], "-lang-objc++"))	  objc = 1, cplusplus = 1, cplusplus_comments = 1; 	if (! strcmp (argv[i], "-lang-asm")) 	  lang_asm = 1; 	if (! strcmp (argv[i], "-lint")) 	  for_lint = 1;	break;      case '+':	cplusplus = 1, cplusplus_comments = 1;	break;      case 'w':	inhibit_warnings = 1;	break;      case 'W':	if (!strcmp (argv[i], "-Wtrigraphs"))	  warn_trigraphs = 1;	else if (!strcmp (argv[i], "-Wno-trigraphs"))	  warn_trigraphs = 0;	else if (!strcmp (argv[i], "-Wcomment"))	  warn_comments = 1;	else if (!strcmp (argv[i], "-Wno-comment"))	  warn_comments = 0;	else if (!strcmp (argv[i], "-Wcomments"))	  warn_comments = 1;	else if (!strcmp (argv[i], "-Wno-comments"))	  warn_comments = 0;	else if (!strcmp (argv[i], "-Wtraditional"))	  warn_stringify = 1;	else if (!strcmp (argv[i], "-Wno-traditional"))	  warn_stringify = 0;	else if (!strcmp (argv[i], "-Wimport"))	  warn_import = 1;	else if (!strcmp (argv[i], "-Wno-import"))	  warn_import = 0;	else if (!strcmp (argv[i], "-Werror"))	  warnings_are_errors = 1;	else if (!strcmp (argv[i], "-Wno-error"))	  warnings_are_errors = 0;	else if (!strcmp (argv[i], "-Wall"))	  {	    warn_trigraphs = 1;	    warn_comments = 1;	  }	break;      case 'M':	/* The style of the choices here is a bit mixed.	   The chosen scheme is a hybrid of keeping all options in one string	   and specifying each option in a separate argument:	   -M|-MM|-MD file|-MMD file [-MG].  An alternative is:	   -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:	   -M[M][G][D file].  This is awkward to handle in specs, and is not	   as extensible.  */	/* ??? -MG must be specified in addition to one of -M or -MM.	   This can be relaxed in the future without breaking anything.	   The converse isn't true.  */	/* -MG isn't valid with -MD or -MMD.  This is checked for later.  */	if (!strcmp (argv[i], "-MG"))	  {	    print_deps_missing_files = 1;	    break;	  }	if (!strcmp (argv[i], "-M"))	  print_deps = 2;	else if (!strcmp (argv[i], "-MM"))	  print_deps = 1;	else if (!strcmp (argv[i], "-MD"))	  print_deps = 2;	else if (!strcmp (argv[i], "-MMD"))	  print_deps = 1;	/* For -MD and -MMD options, write deps on file named by next arg.  */	if (!strcmp (argv[i], "-MD")	    || !strcmp (argv[i], "-MMD")) {	  if (i + 1 == argc)	    fatal ("Filename missing after %s option", argv[i]);	  i++;	  deps_file = argv[i];	  deps_mode = "w";	} else {	  /* For -M and -MM, write deps on standard output	     and suppress the usual output.  */	  deps_stream = stdout;	  inhibit_output = 1;	}	  	break;      case 'd':	{	  char *p = argv[i] + 2;	  char c;	  while ((c = *p++)) {	    /* Arg to -d specifies what parts of macros to dump */	    switch (c) {	    case 'M':	      dump_macros = dump_only;	      no_output = 1;	      break;	    case 'N':	      dump_macros = dump_names;	      break;	    case 'D':	      dump_macros = dump_definitions;	      break;	    }	  }	}	break;      case 'g':	if (argv[i][2] == '3')	  debug_output = 1;	break;      case 'v':	fprintf (stderr, "GNU CPP version %s", version_string);#ifdef TARGET_VERSION	TARGET_VERSION;#endif	fprintf (stderr, "\n");	verbose = 1;	break;      case 'H':	print_include_names = 1;	break;      case 'D':	if (argv[i][2] != 0)	  pend_defs[i] = argv[i] + 2;	else if (i + 1 == argc)	  fatal ("Macro name missing after -D option");	else	  i++, pend_defs[i] = argv[i];	break;      case 'A':	{	  char *p;	  if (argv[i][2] != 0)	    p = argv[i] + 2;	  else if (i + 1 == argc)	    fatal ("Assertion missing after -A option");	  else	    p = argv[++i];	  if (!strcmp (p, "-")) {	    /* -A- eliminates all predefined macros and assertions.	       Let's include also any that were specified earlier	       on the command line.  That way we can get rid of any	       that were passed automatically in from GCC.  */

⌨️ 快捷键说明

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