1 /* RTL specific diagnostic subroutines for the GNU C compiler
2 Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3 Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #undef FLOAT /* This is for hpux. They should change hpux. */
24 #undef FFS /* Some systems define this in param.h. */
26 #include "coretypes.h"
29 #include "insn-attr.h"
30 #include "insn-config.h"
34 #include "diagnostic.h"
36 static void file_and_line_for_asm PARAMS ((rtx, const char **, int *));
37 static void diagnostic_for_asm PARAMS ((rtx, const char *, va_list *,
40 /* Figure file and line of the given INSN. */
42 file_and_line_for_asm (insn, pfile, pline)
47 rtx body = PATTERN (insn);
50 /* Find the (or one of the) ASM_OPERANDS in the insn. */
51 if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
52 asmop = SET_SRC (body);
53 else if (GET_CODE (body) == ASM_OPERANDS)
55 else if (GET_CODE (body) == PARALLEL
56 && GET_CODE (XVECEXP (body, 0, 0)) == SET)
57 asmop = SET_SRC (XVECEXP (body, 0, 0));
58 else if (GET_CODE (body) == PARALLEL
59 && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
60 asmop = XVECEXP (body, 0, 0);
66 *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
67 *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
71 *pfile = input_filename;
76 /* Report a diagnostic MESSAGE (an errror or a WARNING) at the line number
77 of the insn INSN. This is used only when INSN is an `asm' with operands,
78 and each ASM_OPERANDS records its own source file and line. */
80 diagnostic_for_asm (insn, msg, args_ptr, kind)
86 diagnostic_info diagnostic;
88 diagnostic_set_info (&diagnostic, msg, args_ptr, NULL, 0, kind);
89 file_and_line_for_asm (insn, &diagnostic.location.file,
90 &diagnostic.location.line);
91 report_diagnostic (&diagnostic);
95 error_for_asm (rtx insn, const char *msgid, ...)
100 diagnostic_for_asm (insn, msgid, &ap, DK_ERROR);
105 warning_for_asm (rtx insn, const char *msgid, ...)
109 va_start (ap, msgid);
110 diagnostic_for_asm (insn, msgid, &ap, DK_WARNING);
115 _fatal_insn (msgid, insn, file, line, function)
120 const char *function;
122 error ("%s", _(msgid));
124 /* The above incremented error_count, but isn't an error that we want to
125 count, so reset it here. */
129 fancy_abort (file, line, function);
133 _fatal_insn_not_found (insn, file, line, function)
137 const char *function;
139 if (INSN_CODE (insn) < 0)
140 _fatal_insn ("unrecognizable insn:", insn, file, line, function);
142 _fatal_insn ("insn does not satisfy its constraints:",
143 insn, file, line, function);