Commit c895acf2 by Gabriel Dos Reis Committed by Gabriel Dos Reis

Makefile.in (OBJS): Add rtl-error.o

	* Makefile.in (OBJS): Add rtl-error.o
	(rtl-error.o): New rule.
	(diagnostic.o): Adjust dependency.
	diagnostic.c (file_and_line_for_asm, diagnostic_for_asm,
	error_for_asm, _fatal_insn, _fatal_insn_not_found,
	warning_for_asm): Move to...
	rtl-error.c: ...here.  New file.

From-SVN: r44894
parent ddee9e8d
2001-08-14 Gabriel Dos Reis <gdr@codesourcery.com>
* Makefile.in (OBJS): Add rtl-error.o
(rtl-error.o): New rule.
(diagnostic.o): Adjust dependency.
diagnostic.c (file_and_line_for_asm, diagnostic_for_asm,
error_for_asm, _fatal_insn, _fatal_insn_not_found,
warning_for_asm): Move to...
rtl-error.c: ...here. New file.
2001-08-14 Richard Henderson <rth@redhat.com>
* dwarf2out.c (dwarf2out_frame_finish): Never emit .eh_frame
......
......@@ -743,10 +743,10 @@ OBJS = \
local-alloc.o loop.o mbchar.o optabs.o params.o predict.o print-rtl.o \
print-tree.o profile.o real.o recog.o reg-stack.o regclass.o regmove.o \
regrename.o reload.o reload1.o reorg.o resource.o rtl.o rtlanal.o \
sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o \
sibcall.o simplify-rtx.o splay-tree.o ssa.o ssa-ccp.o ssa-dce.o \
stmt.o stor-layout.o stringpool.o timevar.o toplev.o tree.o unroll.o \
varasm.o varray.o version.o xcoffout.o \
rtl-error.o sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o \
sdbout.o sibcall.o simplify-rtx.o splay-tree.o ssa.o ssa-ccp.o \
ssa-dce.o stmt.o stor-layout.o stringpool.o timevar.o toplev.o tree.o \
unroll.o varasm.o varray.o version.o xcoffout.o \
$(GGC) $(out_object_file) $(EXTRA_OBJS)
BACKEND = main.o libbackend.a
......@@ -1347,9 +1347,9 @@ stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \
function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H)
fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h toplev.h \
$(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H)
diagnostic.o : diagnostic.c diagnostic.h diagnostic.def \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) $(TM_P_H) flags.h \
$(GGC_H) input.h $(INSN_ATTR_H) insn-config.h toplev.h intl.h
diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \
input.h toplev.h intl.h
toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) function.h \
flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h diagnostic.h \
debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h \
......@@ -1361,6 +1361,9 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) function.h \
-c $(srcdir)/toplev.c
main.o : main.c toplev.h
rtl-error.o: rtl-error.c system.h $(RTL_H) $(INSN_ATTR_H) insn-config.h \
input.h toplev.h intl.h diagnostic.h
rtl.o : rtl.c $(GCONFIG_H) $(SYSTEM_H) $(RTL_H) real.h $(GGC_H) errors.h
$(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
......
......@@ -27,14 +27,10 @@ Boston, MA 02111-1307, USA. */
#undef FLOAT /* This is for hpux. They should change hpux. */
#undef FFS /* Some systems define this in param.h. */
#include "system.h"
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
#include "flags.h"
#include "input.h"
#include "insn-attr.h"
#include "insn-config.h"
#include "toplev.h"
#include "intl.h"
#include "diagnostic.h"
......@@ -73,8 +69,6 @@ static char *build_message_string PARAMS ((const char *, ...))
static void output_do_printf PARAMS ((output_buffer *, const char *))
ATTRIBUTE_PRINTF (2, 0);
static void format_with_decl PARAMS ((output_buffer *, tree));
static void file_and_line_for_asm PARAMS ((rtx, const char **, int *));
static void diagnostic_for_asm PARAMS ((rtx, const char *, va_list *, int));
static void diagnostic_for_decl PARAMS ((tree, const char *, va_list *, int));
static void set_real_maximum_length PARAMS ((output_buffer *));
......@@ -904,61 +898,6 @@ format_with_decl (buffer, decl)
}
}
/* Figure file and line of the given INSN. */
static void
file_and_line_for_asm (insn, pfile, pline)
rtx insn;
const 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 a diagnostic MESSAGE (an errror or 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 void
diagnostic_for_asm (insn, msg, args_ptr, warn)
rtx insn;
const char *msg;
va_list *args_ptr;
int warn;
{
diagnostic_context dc;
set_diagnostic_context (&dc, msg, args_ptr, NULL, 0, warn);
file_and_line_for_asm (insn, &diagnostic_file_location (&dc),
&diagnostic_line_location (&dc));
report_diagnostic (&dc);
}
/* Report a diagnostic MESSAGE at the declaration DECL.
MSG is a format string which uses %s to substitute the declaration
......@@ -1295,25 +1234,6 @@ error_with_decl VPARAMS ((tree decl, const char *msgid, ...))
va_end (ap);
}
void
error_for_asm VPARAMS ((rtx insn, const char *msgid, ...))
{
#ifndef ANSI_PROTOTYPES
rtx insn;
const char *msgid;
#endif
va_list ap;
VA_START (ap, msgid);
#ifndef ANSI_PROTOTYPES
insn = va_arg (ap, rtx);
msgid = va_arg (ap, const char *);
#endif
diagnostic_for_asm (insn, msgid, &ap, /* warn = */ 0);
va_end (ap);
}
/* Report an error message. The arguments are like that of printf. */
......@@ -1417,38 +1337,6 @@ See %s for instructions.\n", GCCBUGURL);
}
void
_fatal_insn (msgid, insn, file, line, function)
const char *msgid;
rtx insn;
const char *file;
int line;
const char *function;
{
error ("%s", _(msgid));
/* The above incremented error_count, but isn't an error that we want to
count, so reset it here. */
errorcount--;
debug_rtx (insn);
fancy_abort (file, line, function);
}
void
_fatal_insn_not_found (insn, file, line, function)
rtx insn;
const char *file;
int line;
const char *function;
{
if (INSN_CODE (insn) < 0)
_fatal_insn ("Unrecognizable insn:", insn, file, line, function);
else
_fatal_insn ("Insn does not satisfy its constraints:",
insn, file, line, function);
}
void
warning_with_file_and_line VPARAMS ((const char *file, int line,
const char *msgid, ...))
{
......@@ -1494,26 +1382,6 @@ warning_with_decl VPARAMS ((tree decl, const char *msgid, ...))
}
void
warning_for_asm VPARAMS ((rtx insn, const char *msgid, ...))
{
#ifndef ANSI_PROTOTYPES
rtx insn;
const char *msgid;
#endif
va_list ap;
VA_START (ap, msgid);
#ifndef ANSI_PROTOTYPES
insn = va_arg (ap, rtx);
msgid = va_arg (ap, const char *);
#endif
diagnostic_for_asm (insn, msgid, &ap, /* warn = */ 1);
va_end (ap);
}
void
warning VPARAMS ((const char *msgid, ...))
{
#ifndef ANSI_PROTOTYPES
......
/* RTL specific diagnostic subroutines for the GNU C compiler
Copyright (C) 2001 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#undef FLOAT /* This is for hpux. They should change hpux. */
#undef FFS /* Some systems define this in param.h. */
#include "system.h"
#include "rtl.h"
#include "insn-attr.h"
#include "insn-config.h"
#include "input.h"
#include "toplev.h"
#include "intl.h"
#include "diagnostic.h"
static void file_and_line_for_asm PARAMS ((rtx, const char **, int *));
static void diagnostic_for_asm PARAMS ((rtx, const char *, va_list *, int));
/* Figure file and line of the given INSN. */
static void
file_and_line_for_asm (insn, pfile, pline)
rtx insn;
const 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 a diagnostic MESSAGE (an errror or 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 void
diagnostic_for_asm (insn, msg, args_ptr, warn)
rtx insn;
const char *msg;
va_list *args_ptr;
int warn;
{
diagnostic_context dc;
set_diagnostic_context (&dc, msg, args_ptr, NULL, 0, warn);
file_and_line_for_asm (insn, &diagnostic_file_location (&dc),
&diagnostic_line_location (&dc));
report_diagnostic (&dc);
}
void
error_for_asm VPARAMS ((rtx insn, const char *msgid, ...))
{
#ifndef ANSI_PROTOTYPES
rtx insn;
const char *msgid;
#endif
va_list ap;
VA_START (ap, msgid);
#ifndef ANSI_PROTOTYPES
insn = va_arg (ap, rtx);
msgid = va_arg (ap, const char *);
#endif
diagnostic_for_asm (insn, msgid, &ap, /* warn = */ 0);
va_end (ap);
}
void
warning_for_asm VPARAMS ((rtx insn, const char *msgid, ...))
{
#ifndef ANSI_PROTOTYPES
rtx insn;
const char *msgid;
#endif
va_list ap;
VA_START (ap, msgid);
#ifndef ANSI_PROTOTYPES
insn = va_arg (ap, rtx);
msgid = va_arg (ap, const char *);
#endif
diagnostic_for_asm (insn, msgid, &ap, /* warn = */ 1);
va_end (ap);
}
void
_fatal_insn (msgid, insn, file, line, function)
const char *msgid;
rtx insn;
const char *file;
int line;
const char *function;
{
error ("%s", _(msgid));
/* The above incremented error_count, but isn't an error that we want to
count, so reset it here. */
errorcount--;
debug_rtx (insn);
fancy_abort (file, line, function);
}
void
_fatal_insn_not_found (insn, file, line, function)
rtx insn;
const char *file;
int line;
const char *function;
{
if (INSN_CODE (insn) < 0)
_fatal_insn ("Unrecognizable insn:", insn, file, line, function);
else
_fatal_insn ("Insn does not satisfy its constraints:",
insn, file, line, function);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment