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

📄 toplev.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 5 页
字号:
    }  if (input_file_stack && input_file_stack->next != 0      && input_file_stack_tick != last_error_tick)    {      fprintf (stderr, "In file included");      for (p = input_file_stack->next; p; p = p->next)	{	  fprintf (stderr, " from %s:%d", p->name, p->line);	  if (p->next)	    fprintf (stderr, ",");	}      fprintf (stderr, ":\n");      last_error_tick = input_file_stack_tick;    }}/* Report an error at the current line number.   S is a string and V and V2 are args for `printf'.  We use HOST_WIDE_INT   as the type for these args assuming it is wide enough to hold a   pointer.  This isn't terribly portable, but is the best we can do   without vprintf universally available.  */voiderror (s, v, v2)     char *s;     HOST_WIDE_INT v;		/* Also used as pointer */     HOST_WIDE_INT v2;		/* Also used as pointer */{  error_with_file_and_line (input_filename, lineno, s, v, v2);}/* Report an error at line LINE of file FILE.   S and V are a string and an arg for `printf'.  */voiderror_with_file_and_line (file, line, s, v, v2)     char *file;     int line;     char *s;     HOST_WIDE_INT v;     HOST_WIDE_INT v2;{  count_error (0);  report_error_function (file);  if (file)    fprintf (stderr, "%s:%d: ", file, line);  else    fprintf (stderr, "%s: ", progname);  fprintf (stderr, s, v, v2);  fprintf (stderr, "\n");}/* Report an error at the declaration DECL.   S and V are a string and an arg which uses %s to substitute   the declaration name.  */voiderror_with_decl (decl, s, v)     tree decl;     char *s;     HOST_WIDE_INT v;{  char *junk;  count_error (0);  report_error_function (DECL_SOURCE_FILE (decl));  fprintf (stderr, "%s:%d: ",	   DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));  if (DECL_NAME (decl))    fprintf (stderr, s, (*decl_printable_name) (decl, &junk), v);  else    fprintf (stderr, s, "((anonymous))", v);  fprintf (stderr, "\n");}/* Report an error at the line number of the insn INSN.   S and V are a string and an arg for `printf'.   This is used only when INSN is an `asm' with operands,   and each ASM_OPERANDS records its own source file and line.  */voiderror_for_asm (insn, s, v, v2)     rtx insn;     char *s;     HOST_WIDE_INT v;		/* Also used as pointer */     HOST_WIDE_INT v2;		/* Also used as pointer */{  char *filename;  int line;  rtx body = PATTERN (insn);  rtx asmop;  /* Find the (or one of the) ASM_OPERANDS in the insn.  */  if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)    asmop = SET_SRC (body);  else if (GET_CODE (body) == ASM_OPERANDS)    asmop = body;  else if (GET_CODE (body) == PARALLEL	   && GET_CODE (XVECEXP (body, 0, 0)) == SET)    asmop = SET_SRC (XVECEXP (body, 0, 0));  else if (GET_CODE (body) == PARALLEL	   && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)    asmop = XVECEXP (body, 0, 0);  filename = ASM_OPERANDS_SOURCE_FILE (asmop);  line = ASM_OPERANDS_SOURCE_LINE (asmop);  error_with_file_and_line (filename, line, s, v, v2);}/* Report a warning at line LINE.   S and V are a string and an arg for `printf'.  */voidwarning_with_file_and_line (file, line, s, v, v2, v3)     char *file;     int line;     char *s;     HOST_WIDE_INT v, v2, v3;{  if (count_error (1) == 0)    return;  report_error_function (file);  if (file)    fprintf (stderr, "%s:%d: ", file, line);  else    fprintf (stderr, "%s: ", progname);  fprintf (stderr, "warning: ");  fprintf (stderr, s, v, v2, v3);  fprintf (stderr, "\n");}/* Report a warning at the current line number.   S and V are a string and an arg for `printf'.  */voidwarning (s, v, v2, v3)     char *s;     HOST_WIDE_INT v, v2, v3;	/* Also used as pointer */{  warning_with_file_and_line (input_filename, lineno, s, v, v2, v3);}/* Report a warning at the declaration DECL.   S is string which uses %s to substitute the declaration name.   V is a second parameter that S can refer to.  */voidwarning_with_decl (decl, s, v)     tree decl;     char *s;     HOST_WIDE_INT v;{  char *junk;  if (count_error (1) == 0)    return;  report_error_function (DECL_SOURCE_FILE (decl));  fprintf (stderr, "%s:%d: ",	   DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));  fprintf (stderr, "warning: ");  if (DECL_NAME (decl))    fprintf (stderr, s, (*decl_printable_name) (decl, &junk), v);  else    fprintf (stderr, s, "((anonymous))", v);  fprintf (stderr, "\n");}/* Report a warning at the line number of the insn INSN.   S and V are a string and an arg for `printf'.   This is used only when INSN is an `asm' with operands,   and each ASM_OPERANDS records its own source file and line.  */voidwarning_for_asm (insn, s, v, v2)     rtx insn;     char *s;     HOST_WIDE_INT v;		/* Also used as pointer */     HOST_WIDE_INT v2;		/* Also used as pointer */{  char *filename;  int line;  rtx body = PATTERN (insn);  rtx asmop;  /* Find the (or one of the) ASM_OPERANDS in the insn.  */  if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)    asmop = SET_SRC (body);  else if (GET_CODE (body) == ASM_OPERANDS)    asmop = body;  else if (GET_CODE (body) == PARALLEL	   && GET_CODE (XVECEXP (body, 0, 0)) == SET)    asmop = SET_SRC (XVECEXP (body, 0, 0));  else if (GET_CODE (body) == PARALLEL	   && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)    asmop = XVECEXP (body, 0, 0);  filename = ASM_OPERANDS_SOURCE_FILE (asmop);  line = ASM_OPERANDS_SOURCE_LINE (asmop);  warning_with_file_and_line (filename, line, s, v, v2);}/* These functions issue either warnings or errors depending on   -pedantic-errors.  */voidpedwarn (s, v, v2)     char *s;     HOST_WIDE_INT v;		/* Also used as pointer */     HOST_WIDE_INT v2;{  if (flag_pedantic_errors)    error (s, v, v2);  else    warning (s, v, v2);}voidpedwarn_with_decl (decl, s, v)     tree decl;     char *s;     HOST_WIDE_INT v;{  if (flag_pedantic_errors)    error_with_decl (decl, s, v);  else    warning_with_decl (decl, s, v);}voidpedwarn_with_file_and_line (file, line, s, v, v2)     char *file;     int line;     char *s;     HOST_WIDE_INT v;     HOST_WIDE_INT v2;{  if (flag_pedantic_errors)    error_with_file_and_line (file, line, s, v, v2);  else    warning_with_file_and_line (file, line, s, v, v2);}/* Apologize for not implementing some feature.   S, V, and V2 are a string and args for `printf'.  */voidsorry (s, v, v2)     char *s;     HOST_WIDE_INT v, v2;{  sorrycount++;  if (input_filename)    fprintf (stderr, "%s:%d: ", input_filename, lineno);  else    fprintf (stderr, "%s: ", progname);  fprintf (stderr, "sorry, not implemented: ");  fprintf (stderr, s, v, v2);  fprintf (stderr, "\n");}/* Apologize for not implementing some feature, then quit.   S, V, and V2 are a string and args for `printf'.  */voidreally_sorry (s, v, v2)     char *s;     HOST_WIDE_INT v, v2;{  if (input_filename)    fprintf (stderr, "%s:%d: ", input_filename, lineno);  else    fprintf (stderr, "c++: ");  fprintf (stderr, "sorry, not implemented: ");  fprintf (stderr, s, v, v2);  fatal (" (fatal)\n");}/* More 'friendly' abort that prints the line and file.   config.h can #define abort fancy_abort if you like that sort of thing.   I don't think this is actually a good idea.   Other sorts of crashes will look a certain way.   It is a good thing if crashes from calling abort look the same way.     -- RMS  */voidfancy_abort (){  fatal ("internal gcc abort");}/* This calls abort and is used to avoid problems when abort if a macro.   It is used when we need to pass the address of abort.  */voiddo_abort (){  abort ();}/* When `malloc.c' is compiled with `rcheck' defined,   it calls this function to report clobberage.  */voidbotch (s){  abort ();}/* Same as `malloc' but report error if no memory available.  */char *xmalloc (size)     unsigned size;{  register char *value = (char *) malloc (size);  if (value == 0)    fatal ("virtual memory exhausted");  return value;}/* Same as `realloc' but report error if no memory available.  */char *xrealloc (ptr, size)     char *ptr;     int size;{  char *result = (char *) realloc (ptr, size);  if (!result)    fatal ("virtual memory exhausted");  return result;}/* Return the logarithm of X, base 2, considering X unsigned,   if X is a power of 2.  Otherwise, returns -1.   This should be used via the `exact_log2' macro.  */intexact_log2_wide (x)     register unsigned HOST_WIDE_INT x;{  register int log = 0;  /* Test for 0 or a power of 2.  */  if (x == 0 || x != (x & -x))    return -1;  while ((x >>= 1) != 0)    log++;  return log;}/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.   If X is 0, return -1.   This should be used via the floor_log2 macro.  */intfloor_log2_wide (x)     register unsigned HOST_WIDE_INT x;{  register int log = -1;  while (x != 0)    log++,    x >>= 1;  return log;}int float_handled;jmp_buf float_handler;/* Specify where to longjmp to when a floating arithmetic error happens.   If HANDLER is 0, it means don't handle the errors any more.  */voidset_float_handler (handler)     jmp_buf handler;{  float_handled = (handler != 0);  if (handler)    bcopy (handler, float_handler, sizeof (float_handler));}/* Specify, in HANDLER, where to longjmp to when a floating arithmetic   error happens, pushing the previous specification into OLD_HANDLER.   Return an indication of whether there was a previous handler in effect.  */intpush_float_handler (handler, old_handler)     jmp_buf handler, old_handler;{  int was_handled = float_handled;  float_handled = 1;  if (was_handled)    bcopy (float_handler, old_handler, sizeof (float_handler));  bcopy (handler, float_handler, sizeof (float_handler));  return was_handled;}/* Restore the previous specification of whether and where to longjmp to   when a floating arithmetic error happens.  */voidpop_float_handler (handled, handler)     int handled;     jmp_buf handler;{  float_handled = handled;  if (handled)    bcopy (handler, float_handler, sizeof (float_handler));}/* Signals actually come here.  */static voidfloat_signal (signo)     /* If this is missing, some compilers complain.  */     int signo;{  if (float_handled == 0)    abort ();#if defined (USG) || defined (hpux)  signal (SIGFPE, float_signal);  /* re-enable the signal catcher */#endif  float_handled = 0;  signal (SIGFPE, float_signal);  longjmp (float_handler, 1);}/* Handler for SIGPIPE.  */static voidpipe_closed (signo)     /* If this is missing, some compilers complain.  */     int signo;{  fatal ("output pipe has been closed");}/* Strip off a legitimate source ending from the input string NAME of   length LEN. */voidstrip_off_ending (name, len)     char *name;     int len;{  if (len > 2 && ! strcmp (".c", name + len - 2))    name[len - 2] = 0;  else if (len > 2 && ! strcmp (".m", name + len - 2))    name[len - 2] = 0;  else if (len > 2 && ! strcmp (".i", name + len - 2))    name[len - 2] = 0;  else if (len > 3 && ! strcmp (".ii", name + len - 3))    name[len - 3] = 0;  else if (len > 3 && ! strcmp (".co", name + len - 3))    name[len - 3] = 0;  else if (len > 3 && ! strcmp (".cc", name + len - 3))    name[len - 3] = 0;  else if (len > 2 && ! strcmp (".C", name + len - 2))    name[len - 2] = 0;  else if (len > 4 && ! strcmp (".cxx", name + len - 4))    name[len - 4] = 0;  else if (len > 2 && ! strcmp (".f", name + len - 2))    name[len - 2] = 0;  else if (len > 4 && ! strcmp (".ada", name + len - 4))    name[len - 4] = 0;

⌨️ 快捷键说明

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