📄 toplev.c
字号:
need_error_newline = 0; } (*print_error_function) (file); if (input_file_stack && input_file_stack->next != 0 && input_file_stack_tick != last_error_tick && file == input_filename) { 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, ",\n "); } fprintf (stderr, ":\n"); last_error_tick = input_file_stack_tick; }}/* Print a message. */static voidvmessage (prefix, s, ap) char *prefix; char *s; va_list ap;{ if (prefix) fprintf (stderr, "%s: ", prefix);#ifdef HAVE_VPRINTF vfprintf (stderr, s, ap);#else { HOST_WIDE_INT v1 = va_arg(ap, HOST_WIDE_INT); HOST_WIDE_INT v2 = va_arg(ap, HOST_WIDE_INT); HOST_WIDE_INT v3 = va_arg(ap, HOST_WIDE_INT); HOST_WIDE_INT v4 = va_arg(ap, HOST_WIDE_INT); fprintf (stderr, s, v1, v2, v3, v4); }#endif}/* Print a message relevant to line LINE of file FILE. */static voidv_message_with_file_and_line (file, line, prefix, s, ap) char *file; int line; char *prefix; char *s; va_list ap;{ if (file) fprintf (stderr, "%s:%d: ", file, line); else fprintf (stderr, "%s: ", progname); vmessage (prefix, s, ap); fputc ('\n', stderr);}/* Print a message relevant to the given DECL. */static voidv_message_with_decl (decl, prefix, s, ap) tree decl; char *prefix; char *s; va_list ap;{ char *n, *p, *junk; fprintf (stderr, "%s:%d: ", DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); if (prefix) fprintf (stderr, "%s: ", prefix); /* Do magic to get around lack of varargs support for insertion of arguments into existing list. We know that the decl is first; we ass_u_me that it will be printed with "%s". */ for (p = s; *p; ++p) { if (*p == '%') { if (*(p + 1) == '%') ++p; else break; } } if (p > s) /* Print the left-hand substring. */ { char fmt[sizeof "%.255s"]; long width = p - s; if (width > 255L) width = 255L; /* arbitrary */ sprintf (fmt, "%%.%lds", width); fprintf (stderr, fmt, s); } if (*p == '%') /* Print the name. */ { char *n = (DECL_NAME (decl) ? (*decl_printable_name) (decl, &junk) : "((anonymous))"); fputs (n, stderr); while (*p) { ++p; if (isalpha (*(p - 1) & 0xFF)) break; } } if (*p) /* Print the rest of the message. */ vmessage ((char *)NULL, p, ap); fputc ('\n', stderr);}/* Figure file and line of the given INSN. */static voidfile_and_line_for_asm (insn, pfile, pline) rtx insn; char **pfile; int *pline;{ 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); else asmop = NULL; if (asmop) { *pfile = ASM_OPERANDS_SOURCE_FILE (asmop); *pline = ASM_OPERANDS_SOURCE_LINE (asmop); } else { *pfile = input_filename; *pline = lineno; }}/* Report an error at line LINE of file FILE. */static voidv_error_with_file_and_line (file, line, s, ap) char *file; int line; char *s; va_list ap;{ count_error (0); report_error_function (file); v_message_with_file_and_line (file, line, (char *)NULL, s, ap);}voiderror_with_file_and_line VPROTO((char *file, int line, char *s, ...)){#ifndef __STDC__ char *file; int line; char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ file = va_arg (ap, char *); line = va_arg (ap, int); s = va_arg (ap, char *);#endif v_error_with_file_and_line (file, line, s, ap); va_end (ap);}/* Report an error at the declaration DECL. S is a format string which uses %s to substitute the declaration name; subsequent substitutions are a la printf. */static voidv_error_with_decl (decl, s, ap) tree decl; char *s; va_list ap;{ count_error (0); report_error_function (DECL_SOURCE_FILE (decl)); v_message_with_decl (decl, (char *)NULL, s, ap);}voiderror_with_decl VPROTO((tree decl, char *s, ...)){#ifndef __STDC__ tree decl; char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ decl = va_arg (ap, tree); s = va_arg (ap, char *);#endif v_error_with_decl (decl, s, ap); va_end (ap);}/* Report an error at the line number of the insn INSN. This is used only when INSN is an `asm' with operands, and each ASM_OPERANDS records its own source file and line. */static voidv_error_for_asm (insn, s, ap) rtx insn; char *s; va_list ap;{ char *file; int line; count_error (0); file_and_line_for_asm (insn, &file, &line); report_error_function (file); v_message_with_file_and_line (file, line, (char *)NULL, s, ap);}voiderror_for_asm VPROTO((rtx insn, char *s, ...)){#ifndef __STDC__ rtx insn; char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ insn = va_arg (ap, rtx); s = va_arg (ap, char *);#endif v_error_for_asm (insn, s, ap); va_end (ap);}/* Report an error at the current line number. */static voidverror (s, ap) char *s; va_list ap;{ v_error_with_file_and_line (input_filename, lineno, s, ap);}voiderror VPROTO((char *s, ...)){#ifndef __STDC__ char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ s = va_arg (ap, char *);#endif verror (s, ap); va_end (ap);}/* Report a fatal error at the current line number. */static voidvfatal (s, ap) char *s; va_list ap;{ verror (s, ap); exit (FATAL_EXIT_CODE);}voidfatal VPROTO((char *s, ...)){#ifndef __STDC__ char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ s = va_arg (ap, char *);#endif vfatal (s, ap); va_end (ap);}/* Report a warning at line LINE of file FILE. */static voidv_warning_with_file_and_line (file, line, s, ap) char *file; int line; char *s; va_list ap;{ if (count_error (1)) { report_error_function (file); v_message_with_file_and_line (file, line, "warning", s, ap); }}voidwarning_with_file_and_line VPROTO((char *file, int line, char *s, ...)){#ifndef __STDC__ char *file; int line; char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ file = va_arg (ap, char *); line = va_arg (ap, int); s = va_arg (ap, char *);#endif v_warning_with_file_and_line (file, line, s, ap); va_end (ap);}/* Report a warning at the declaration DECL. S is a format string which uses %s to substitute the declaration name; subsequent substitutions are a la printf. */static voidv_warning_with_decl (decl, s, ap) tree decl; char *s; va_list ap;{ if (count_error (1)) { report_error_function (DECL_SOURCE_FILE (decl)); v_message_with_decl (decl, "warning", s, ap); }}voidwarning_with_decl VPROTO((tree decl, char *s, ...)){#ifndef __STDC__ tree decl; char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ decl = va_arg (ap, tree); s = va_arg (ap, char *);#endif v_warning_with_decl (decl, s, ap); va_end (ap);}/* Report a warning at the line number of the insn INSN. This is used only when INSN is an `asm' with operands, and each ASM_OPERANDS records its own source file and line. */static voidv_warning_for_asm (insn, s, ap) rtx insn; char *s; va_list ap;{ if (count_error (1)) { char *file; int line; file_and_line_for_asm (insn, &file, &line); report_error_function (file); v_message_with_file_and_line (file, line, "warning", s, ap); }}voidwarning_for_asm VPROTO((rtx insn, char *s, ...)){#ifndef __STDC__ rtx insn; char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ insn = va_arg (ap, rtx); s = va_arg (ap, char *);#endif v_warning_for_asm (insn, s, ap); va_end (ap);}/* Report a warning at the current line number. */static voidvwarning (s, ap) char *s; va_list ap;{ v_warning_with_file_and_line (input_filename, lineno, s, ap);}voidwarning VPROTO((char *s, ...)){#ifndef __STDC__ char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ s = va_arg (ap, char *);#endif vwarning (s, ap); va_end (ap);}/* These functions issue either warnings or errors depending on -pedantic-errors. */static voidvpedwarn (s, ap) char *s; va_list ap;{ if (flag_pedantic_errors) verror (s, ap); else vwarning (s, ap);}voidpedwarn VPROTO((char *s, ...)){#ifndef __STDC__ char *s;#endif va_list ap; VA_START (ap, s);#ifndef __STDC__ s = va_arg (ap, char *);#endif vpedwarn (s, ap); va_end (ap);}static voidv_pedwarn_with_decl (decl, s, ap) tree decl; char *s; va_list ap;{ /* We don't want -pedantic-errors to cause the compilation to fail from "errors" in system header files. Sometimes fixincludes can't fix what's broken (eg: unsigned char bitfields - fixing it may change the alignment which will cause programs to mysteriously fail because the C library or kernel uses the original layout). There's no point in issuing a warning either, it's just unnecessary noise. */ if (! DECL_IN_SYSTEM_HEADER (decl)) { if (flag_pedantic_errors) v_error_with_decl (decl, s, ap); else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -