Commit 749ced52 by Zack Weinberg

top level:

	* errors.h (warning, error, fatal, internal_error): Don't mark
	with ATTRIBUTE_PRINTF_n.
	* toplev.h (internal_error, fatal_io_error, warning, error,
	pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line,
	error_with_file_and_line, sorry, error_for_asm, warning_for_asm):
	Likewise.
cp:
	* Make-lang.in (CXX_OBJS): Take out cp/errfn.o.
	(cp/errfn.o): Delete rule.
	(cp/error.o): Depend on flags.h.
	* errfn.c: Delete file.
	* cp-tree.h: Declare warn_deprecated.  Remove definitions of
	TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS,
	and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning,
	cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and
	internal_error respectively.  Make cp_deprecated into a macro.
	Don't define cp_printer typedef or declare cp_printers.
	* error.c: Include flags.h.
	Delete: struct tree_formatting_info, print_function_argument_list,
	print_declaration, print_expression, print_function_declaration,
	print_function_parameter, print_type_id, print_cv_qualifier_seq,
	print_type_specifier_seq, print_simple_type_specifier,
	print_elaborated_type_specifier, print_rest_of_abstract_declarator,
	print_parameter_declaration_clause, print_exception_specification,
	print_nested_name_specifier, and definition of cp_printers.
	(locate_error): New function.
	(cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and
	rewritten in terms of locate_error and diagnostic.c.
	(cp_tree_printer): Rename cp_printer; wire up to *_to_string
	instead of deleted print_* routines.  Handle %C, %L, %O, %Q also.
	(init_error): Adjust to match.
po:
	* POTFILES.in: Remove cp/errfn.c.

From-SVN: r45765
parent 7a80cf9a
2001-09-23 Zack Weinberg <zack@codesourcery.com>
* errors.h (warning, error, fatal, internal_error): Don't mark
with ATTRIBUTE_PRINTF_n.
* toplev.h (internal_error, fatal_io_error, warning, error,
pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line,
error_with_file_and_line, sorry, error_for_asm, warning_for_asm):
Likewise.
Sun Sep 23 18:19:48 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Sun Sep 23 18:19:48 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* function.c (pop_function_context_from): var_refs_queue * function.c (pop_function_context_from): var_refs_queue
...@@ -573,7 +582,7 @@ Thu Sep 20 12:19:36 CEST 2001 Jan Hubicka <jh@suse.cz> ...@@ -573,7 +582,7 @@ Thu Sep 20 12:19:36 CEST 2001 Jan Hubicka <jh@suse.cz>
2001-09-18 Ulrich Weigand <uweigand@de.ibm.com>: 2001-09-18 Ulrich Weigand <uweigand@de.ibm.com>:
* config.gcc (s390-*-linux-*, s390x-*-linux*): Switch to * config.gcc (s390-*-linux-*, s390x-*-linux*): Switch to
new-style tm_file specification. Specify correct tm_p_file, new-style tm_file specification. Specify correct tm_p_file,
md_file, and out_file for s390x. md_file, and out_file for s390x.
...@@ -586,12 +595,12 @@ Thu Sep 20 12:19:36 CEST 2001 Jan Hubicka <jh@suse.cz> ...@@ -586,12 +595,12 @@ Thu Sep 20 12:19:36 CEST 2001 Jan Hubicka <jh@suse.cz>
Tue Sep 18 09:51:11 2001 Eric Christopher <ecechristo@redhat.com> Tue Sep 18 09:51:11 2001 Eric Christopher <ecechristo@redhat.com>
* config/mips/mips.c (mips_asm_file_start): Conditionalize Elf * config/mips/mips.c (mips_asm_file_start): Conditionalize Elf
code generation only for Gnu assembler. code generation only for Gnu assembler.
2001-09-18 Catherine Moore <clm@redhat.com> 2001-09-18 Catherine Moore <clm@redhat.com>
* config/stormy16 (LIB_SPEC): Remove -lnosys. * config/stormy16 (LIB_SPEC): Remove -lnosys.
2001-09-18 Richard Sandiford <rsandifo@redhat.com> 2001-09-18 Richard Sandiford <rsandifo@redhat.com>
......
2001-09-23 Zack Weinberg <zack@codesourcery.com>
* Make-lang.in (CXX_OBJS): Take out cp/errfn.o.
(cp/errfn.o): Delete rule.
(cp/error.o): Depend on flags.h.
* errfn.c: Delete file.
* cp-tree.h: Declare warn_deprecated. Remove definitions of
TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS,
and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and
internal_error respectively. Make cp_deprecated into a macro.
Don't define cp_printer typedef or declare cp_printers.
* error.c: Include flags.h.
Delete: struct tree_formatting_info, print_function_argument_list,
print_declaration, print_expression, print_function_declaration,
print_function_parameter, print_type_id, print_cv_qualifier_seq,
print_type_specifier_seq, print_simple_type_specifier,
print_elaborated_type_specifier, print_rest_of_abstract_declarator,
print_parameter_declaration_clause, print_exception_specification,
print_nested_name_specifier, and definition of cp_printers.
(locate_error): New function.
(cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and
rewritten in terms of locate_error and diagnostic.c.
(cp_tree_printer): Rename cp_printer; wire up to *_to_string
instead of deleted print_* routines. Handle %C, %L, %O, %Q also.
(init_error): Adjust to match.
Sat Sep 22 09:15:31 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Sat Sep 22 09:15:31 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* Make-lang.in (CXX_C_OBJS): Add attribs.o. * Make-lang.in (CXX_C_OBJS): Add attribs.o.
...@@ -58,8 +85,8 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com> ...@@ -58,8 +85,8 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
2001-09-15 Gabriel Dos Reis <gdr@merlin.codesourcery.com> 2001-09-15 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
* Make-lang.in (cp/error.o): Depend on real.h * Make-lang.in (cp/error.o): Depend on real.h
* error.c: #include "real.h" * error.c: #include "real.h"
2001-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2001-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
...@@ -125,10 +152,10 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com> ...@@ -125,10 +152,10 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
(dump_decl): Fix formatting. (dump_decl): Fix formatting.
2001-08-30 Kurt Garloff <garloff@suse.de> 2001-08-30 Kurt Garloff <garloff@suse.de>
* optimize.c (inlinable_function_p): Allow only smaller single * optimize.c (inlinable_function_p): Allow only smaller single
functions. Halve inline limit after reaching recursive limit. functions. Halve inline limit after reaching recursive limit.
2001-08-30 Joern Rennecke <amylaar@redhat.com> 2001-08-30 Joern Rennecke <amylaar@redhat.com>
Jason Merrill <jason_merrill@redhat.com> Jason Merrill <jason_merrill@redhat.com>
...@@ -335,7 +362,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com> ...@@ -335,7 +362,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
2001-07-30 Andreas Jaeger <aj@suse.de> 2001-07-30 Andreas Jaeger <aj@suse.de>
* decl2.c: Remove unused var global_temp_name_counter. * decl2.c: Remove unused var global_temp_name_counter.
2001-07-28 Richard Henderson <rth@redhat.com> 2001-07-28 Richard Henderson <rth@redhat.com>
...@@ -385,7 +412,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com> ...@@ -385,7 +412,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
declaring a function, and create last_function_parms correctly. declaring a function, and create last_function_parms correctly.
2001-07-25 Jason Merrill <jason_merrill@redhat.com> 2001-07-25 Jason Merrill <jason_merrill@redhat.com>
* call.c (joust): Only prefer a non-builtin candidate to a builtin * call.c (joust): Only prefer a non-builtin candidate to a builtin
one if they have the same signature. one if they have the same signature.
...@@ -573,7 +600,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com> ...@@ -573,7 +600,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
* NEWS: Document ABI changes from GCC 3.0. * NEWS: Document ABI changes from GCC 3.0.
2001-07-18 Xavier Delacour <xavier@fmaudio.net>, 2001-07-18 Xavier Delacour <xavier@fmaudio.net>,
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* NEWS (Changes in GCC 3.0): Fix typo. * NEWS (Changes in GCC 3.0): Fix typo.
...@@ -1093,7 +1120,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com> ...@@ -1093,7 +1120,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
2001-05-14 Nick Clifton <nickc@cambridge.redhat.com> 2001-05-14 Nick Clifton <nickc@cambridge.redhat.com>
* decl.c (duplicate_decls): Suppress warning about duplicate * decl.c (duplicate_decls): Suppress warning about duplicate
decls if the first decl is a friend. decls if the first decl is a friend.
2001-05-12 Zack Weinberg <zackw@stanford.edu> 2001-05-12 Zack Weinberg <zackw@stanford.edu>
...@@ -1218,7 +1245,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com> ...@@ -1218,7 +1245,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
2001-04-30 Richard Henderson <rth@redhat.com> 2001-04-30 Richard Henderson <rth@redhat.com>
* cvt.c: Downcase C_PROMOTING_INTEGER_TYPE_P invocations. * cvt.c: Downcase C_PROMOTING_INTEGER_TYPE_P invocations.
* decl.c: Likewise. * decl.c: Likewise.
2001-04-30 Mark Mitchell <mark@codesourcery.com> 2001-04-30 Mark Mitchell <mark@codesourcery.com>
......
...@@ -97,7 +97,7 @@ CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ ...@@ -97,7 +97,7 @@ CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
c-dump.o $(CXX_TARGET_OBJS) c-dump.o $(CXX_TARGET_OBJS)
# Language-specific object files. # Language-specific object files.
CXX_OBJS = cp/call.o cp/decl.o cp/errfn.o cp/expr.o cp/pt.o cp/typeck2.o \ CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \ cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \
cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
cp/search.o cp/semantics.o cp/tree.o cp/xref.o cp/repo.o cp/dump.o \ cp/search.o cp/semantics.o cp/tree.o cp/xref.o cp/repo.o cp/dump.o \
...@@ -271,8 +271,7 @@ cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ ...@@ -271,8 +271,7 @@ cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
cp/xref.o: cp/xref.c $(CXX_TREE_H) input.h toplev.h cp/xref.o: cp/xref.c $(CXX_TREE_H) input.h toplev.h
cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \ cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \
$(GGC_H) $(RTL_H) except.h $(GGC_H) $(RTL_H) except.h
cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h real.h cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h
cp/errfn.o: cp/errfn.c $(CXX_TREE_H) toplev.h
cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \ cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \
flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H)
......
...@@ -997,6 +997,10 @@ extern int warn_old_style_cast; ...@@ -997,6 +997,10 @@ extern int warn_old_style_cast;
extern int warn_reorder; extern int warn_reorder;
/* Non-zero means warn about deprecated features. */
extern int warn_deprecated;
/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */ /* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
extern int flag_signed_bitfields; extern int flag_signed_bitfields;
...@@ -3433,11 +3437,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; ...@@ -3433,11 +3437,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
/* These constants can used as bit flags in the process of tree formatting. /* These constants can used as bit flags in the process of tree formatting.
TFF_PLAIN_IDENTIFIER: unqualified part of a name. TFF_PLAIN_IDENTIFIER: unqualified part of a name.
TFF_NAMESPACE_SCOPE: the complete qualified-id form of a name. TFF_SCOPE: include the class and namespace scope of the name.
TFF_CLASS_SCOPE: if possible, include the class-name part of a
qualified-id. This flag may be implied in some circumstances by
TFF_NAMESPACE_SCOPE.
TFF_SCOPE: the combination of the two above.
TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name. TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name.
TFF_DECL_SPECIFIERS: print decl-specifiers. TFF_DECL_SPECIFIERS: print decl-specifiers.
TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
...@@ -3447,25 +3447,20 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; ...@@ -3447,25 +3447,20 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
TFF_EXCEPTION_SPECIFICATION: show function exception specification. TFF_EXCEPTION_SPECIFICATION: show function exception specification.
TFF_TEMPLATE_HEADER: show the template<...> header in a TFF_TEMPLATE_HEADER: show the template<...> header in a
template-declaration. template-declaration.
TFF_TEMPLATE_DEFAULT_ARGUMENTS: show template parameter default values.
TFF_TEMPLATE_NAME: show only template-name. TFF_TEMPLATE_NAME: show only template-name.
TFF_EXPR_IN_PARENS: Parenthesize expressions. */ TFF_EXPR_IN_PARENS: Parenthesize expressions. */
#define TFF_PLAIN_IDENTIFIER (0) #define TFF_PLAIN_IDENTIFIER (0)
#define TFF_NAMESPACE_SCOPE (1) #define TFF_SCOPE (1)
#define TFF_CLASS_SCOPE (1 << 1) #define TFF_CHASE_TYPEDEF (1 << 1)
#define TFF_CHASE_NAMESPACE_ALIAS (1 << 2) #define TFF_DECL_SPECIFIERS (1 << 2)
#define TFF_CHASE_TYPEDEF (1 << 3) #define TFF_CLASS_KEY_OR_ENUM (1 << 3)
#define TFF_DECL_SPECIFIERS (1 << 4) #define TFF_RETURN_TYPE (1 << 4)
#define TFF_CLASS_KEY_OR_ENUM (1 << 5) #define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5)
#define TFF_RETURN_TYPE (1 << 6) #define TFF_EXCEPTION_SPECIFICATION (1 << 6)
#define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 7) #define TFF_TEMPLATE_HEADER (1 << 7)
#define TFF_EXCEPTION_SPECIFICATION (1 << 8) #define TFF_TEMPLATE_NAME (1 << 8)
#define TFF_TEMPLATE_HEADER (1 << 9) #define TFF_EXPR_IN_PARENS (1 << 9)
#define TFF_TEMPLATE_DEFAULT_ARGUMENTS (1 << 10)
#define TFF_TEMPLATE_NAME (1 << 11)
#define TFF_EXPR_IN_PARENS (1 << 12)
#define TFF_SCOPE (TFF_NAMESPACE_SCOPE | TFF_CLASS_SCOPE)
/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
node. */ node. */
...@@ -3779,17 +3774,24 @@ extern tree set_guard PARAMS ((tree)); ...@@ -3779,17 +3774,24 @@ extern tree set_guard PARAMS ((tree));
/* in parse.y */ /* in parse.y */
extern void cp_parse_init PARAMS ((void)); extern void cp_parse_init PARAMS ((void));
/* in errfn.c */ /* Obsolete names, formerly found in errfn.c, which no longer exists.
/* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */ These are all variadic functions and therefore cannot be defined
extern void cp_error PARAMS ((const char *, ...)); as function-like macros. */
extern void cp_error_at PARAMS ((const char *, ...)); #define cp_error error
extern void cp_warning PARAMS ((const char *, ...)); #define cp_warning warning
extern void cp_warning_at PARAMS ((const char *, ...)); #define cp_pedwarn pedwarn
extern void cp_pedwarn PARAMS ((const char *, ...)); #define cp_compiler_error internal_error
extern void cp_pedwarn_at PARAMS ((const char *, ...));
extern void cp_compiler_error PARAMS ((const char *, ...)); extern void cp_error_at PARAMS ((const char *msgid, ...));
extern void cp_sprintf PARAMS ((const char *, ...)); extern void cp_warning_at PARAMS ((const char *msgid, ...));
extern void cp_deprecated PARAMS ((const char*)); extern void cp_pedwarn_at PARAMS ((const char *msgid, ...));
/* XXX Not i18n clean. */
#define cp_deprecated(str) \
do { if (warn_deprecated) \
cp_warning("%s is deprecated, please see the documentation for details", \
str); \
} while (0)
/* in error.c */ /* in error.c */
extern void init_error PARAMS ((void)); extern void init_error PARAMS ((void));
...@@ -3802,13 +3804,6 @@ extern const char *cp_file_of PARAMS ((tree)); ...@@ -3802,13 +3804,6 @@ extern const char *cp_file_of PARAMS ((tree));
extern int cp_line_of PARAMS ((tree)); extern int cp_line_of PARAMS ((tree));
extern const char *language_to_string PARAMS ((enum languages, int)); extern const char *language_to_string PARAMS ((enum languages, int));
extern void print_instantiation_context PARAMS ((void)); extern void print_instantiation_context PARAMS ((void));
/* cp_printer is the type of a function which converts an argument into
a string for digestion by printf. The cp_printer function should deal
with all memory management; the functions in errfn will not free
the char*s returned. See error.c for an example use of this code. */
typedef const char *cp_printer PARAMS ((tree, int));
extern cp_printer *cp_printers[256];
/* in except.c */ /* in except.c */
extern void init_exception_processing PARAMS ((void)); extern void init_exception_processing PARAMS ((void));
......
/* Provide a call-back mechanism for handling error output.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Contributed by Jason Merrill (jason@cygnus.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"
#include "system.h"
#include "tree.h"
#include "cp-tree.h"
#include "toplev.h"
/* Whether or not we should try to be quiet for errors and warnings; this is
used to avoid being too talkative about problems with tentative choices
when we're computing the conversion costs for a method call. */
int cp_silent = 0;
typedef void errorfn (); /* deliberately vague */
static void cp_thing PARAMS ((errorfn *, int, const char *, va_list));
#define STRDUP(f) (ap = (char *) alloca (strlen (f) +1), strcpy (ap, (f)), ap)
/* This function supports only `%s', `%d', `%%', and the C++ print
codes. */
static void
cp_thing (errfn, atarg1, format, ap)
errorfn *errfn;
int atarg1;
const char *format;
va_list ap;
{
static char *buf;
static long buflen;
int nargs = 0;
long len;
long offset;
const char *f;
tree atarg = 0;
len = strlen (format) + 1;
if (len > buflen)
{
buflen = len;
buf = xrealloc (buf, buflen);
}
offset = 0;
for (f = format; *f; ++f)
{
cp_printer * function;
int alternate;
int maybe_here;
/* ignore text */
if (*f != '%')
{
buf[offset++] = *f;
continue;
}
++f;
alternate = 0;
maybe_here = 0;
/* Check for '+' and '#' (in that order). */
if (*f == '+')
{
maybe_here = 1;
++f;
}
if (*f == '#')
{
alternate = 1;
++f;
}
/* no field width or precision */
function = cp_printers[(int)*f];
if (function || *f == 's')
{
const char *p;
int plen;
if (*f == 's')
{
p = va_arg (ap, char *);
nargs++;
}
else
{
tree t = va_arg (ap, tree);
nargs++;
/* This indicates that ATARG comes from a different
location than normal. */
if (maybe_here && atarg1)
atarg = t;
/* If atarg1 is set and this is the first argument, then
set ATARG appropriately. */
if (atarg1 && nargs == 1)
atarg = t;
p = (*function) (t, alternate);
}
plen = strlen (p);
len += plen;
if (len > buflen)
{
buflen = len;
buf = xrealloc (buf, len);
}
strcpy (buf + offset, p);
offset += plen;
}
else if (*f == '%')
{
/* A `%%' has occurred in the input string. Replace it with
a `%' in the formatted message buf. */
if (++len > buflen)
{
buflen = len;
buf = xrealloc (buf, len);
}
buf[offset++] = '%';
}
else
{
if (*f != 'd')
abort ();
len += HOST_BITS_PER_INT / 2;
if (len > buflen)
{
buflen = len;
buf = xrealloc (buf, len);
}
sprintf (buf + offset, "%d", va_arg (ap, int));
nargs++;
offset += strlen (buf + offset);
/* With an ANSI C library one could write
out += sprintf (...); */
}
}
buf[offset] = '\0';
/* If ATARG1 is set, but we haven't extracted any arguments, then
extract one tree argument for ATARG. */
if (nargs == 0 && atarg1)
atarg = va_arg (ap, tree);
if (atarg)
{
const char *file = cp_file_of (atarg);
int line = cp_line_of (atarg);
(*errfn) (file, line, "%s", buf);
}
else
(*errfn) ("%s", buf);
}
void
cp_error VPARAMS ((const char *format, ...))
{
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
if (! cp_silent)
cp_thing ((errorfn *) error, 0, format, ap);
VA_CLOSE (ap);
}
void
cp_warning VPARAMS ((const char *format, ...))
{
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
if (! cp_silent)
cp_thing ((errorfn *) warning, 0, format, ap);
VA_CLOSE (ap);
}
void
cp_pedwarn VPARAMS ((const char *format, ...))
{
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
if (! cp_silent)
cp_thing ((errorfn *) pedwarn, 0, format, ap);
VA_CLOSE (ap);
}
void
cp_compiler_error VPARAMS ((const char *format, ...))
{
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
if (! cp_silent)
cp_thing ((errorfn *) compiler_error, 0, format, ap);
VA_CLOSE (ap);
}
void
cp_deprecated (msg)
const char *msg;
{
extern int warn_deprecated;
if (!warn_deprecated)
return;
cp_warning ("%s is deprecated, please see the documentation for details", msg);
}
void
cp_sprintf VPARAMS ((const char *format, ...))
{
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
cp_thing ((errorfn *) sprintf, 0, format, ap);
VA_CLOSE (ap);
}
void
cp_error_at VPARAMS ((const char *format, ...))
{
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
if (! cp_silent)
cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap);
VA_CLOSE (ap);
}
void
cp_warning_at VPARAMS ((const char *format, ...))
{
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
if (! cp_silent)
cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap);
VA_CLOSE (ap);
}
void
cp_pedwarn_at VPARAMS ((const char *format, ...))
{
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
if (! cp_silent)
cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap);
VA_CLOSE (ap);
}
...@@ -26,23 +26,11 @@ Boston, MA 02111-1307, USA. */ ...@@ -26,23 +26,11 @@ Boston, MA 02111-1307, USA. */
#include "real.h" #include "real.h"
#include "obstack.h" #include "obstack.h"
#include "toplev.h" #include "toplev.h"
#include "flags.h"
#include "diagnostic.h" #include "diagnostic.h"
enum pad { none, before, after }; enum pad { none, before, after };
/* This data structure bundles altogether, all the information necessary
for pretty-printing a C++ source-level entity represented by a tree. */
typedef struct
{
tree decl;
int flags;
enum pad pad;
} tree_formatting_info, *tfi_t;
#define tree_being_formatted(TFI) (TFI)->decl
#define tree_formatting_flags(TFI) (TFI)->flags
#define put_whitespace(TFI) (TFI)->pad
#define sorry_for_unsupported_tree(T) \ #define sorry_for_unsupported_tree(T) \
sorry ("`%s' not supported by %s", tree_code_name[(int) TREE_CODE (T)], \ sorry ("`%s' not supported by %s", tree_code_name[(int) TREE_CODE (T)], \
__FUNCTION__) __FUNCTION__)
...@@ -130,65 +118,10 @@ static void cp_diagnostic_finalizer PARAMS ((output_buffer *, ...@@ -130,65 +118,10 @@ static void cp_diagnostic_finalizer PARAMS ((output_buffer *,
static void cp_print_error_function PARAMS ((output_buffer *, static void cp_print_error_function PARAMS ((output_buffer *,
diagnostic_context *)); diagnostic_context *));
static int cp_tree_printer PARAMS ((output_buffer *)); static int cp_printer PARAMS ((output_buffer *));
static void print_function_argument_list PARAMS ((output_buffer *, tfi_t));
static void print_declaration PARAMS ((output_buffer *, tfi_t));
static void print_expression PARAMS ((output_buffer *, tfi_t));
static void print_integer PARAMS ((output_buffer *, HOST_WIDE_INT));
static void print_function_declaration PARAMS ((output_buffer *, tfi_t));
static void print_function_parameter PARAMS ((output_buffer *, int));
static void print_type_id PARAMS ((output_buffer *, tfi_t));
static void print_cv_qualifier_seq PARAMS ((output_buffer *, tfi_t));
static void print_type_specifier_seq PARAMS ((output_buffer *, tfi_t));
static void print_simple_type_specifier PARAMS ((output_buffer *, tfi_t));
static void print_elaborated_type_specifier PARAMS ((output_buffer *, tfi_t));
static void print_rest_of_abstract_declarator PARAMS ((output_buffer *,
tfi_t));
static void print_parameter_declaration_clause PARAMS ((output_buffer *,
tfi_t));
static void print_exception_specification PARAMS ((output_buffer *, tfi_t));
static void print_nested_name_specifier PARAMS ((output_buffer *, tfi_t));
static void print_template_id PARAMS ((output_buffer *, tfi_t));
static tree typedef_original_name PARAMS ((tree));
static void print_non_consecutive_character PARAMS ((output_buffer *, int)); static void print_non_consecutive_character PARAMS ((output_buffer *, int));
static void print_integer PARAMS ((output_buffer *, HOST_WIDE_INT));
#define A args_to_string static tree locate_error PARAMS ((const char *, va_list));
#define C code_to_string
#define D decl_to_string
#define E expr_to_string
#define F fndecl_to_string
#define L language_to_string
#define O op_to_string
#define P parm_to_string
#define Q assop_to_string
#define T type_to_string
#define V cv_to_string
#define o (cp_printer *) 0
cp_printer * cp_printers[256] =
{
/*0 1 2 3 4 5 6 7 8 9 A B C D E F */
o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x00 */
o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x10 */
o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x20 */
o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x30 */
o, A, o, C, D, E, F, o, o, o, o, o, L, o, o, O, /* 0x40 */
P, Q, o, o, T, o, V, o, o, o, o, o, o, o, o, o, /* 0x50 */
o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x60 */
o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x70 */
};
#undef A
#undef C
#undef D
#undef E
#undef F
#undef L
#undef O
#undef P
#undef Q
#undef T
#undef V
#undef o
void void
init_error () init_error ()
...@@ -196,8 +129,8 @@ init_error () ...@@ -196,8 +129,8 @@ init_error ()
print_error_function = lang_print_error_function; print_error_function = lang_print_error_function;
diagnostic_starter (global_dc) = cp_diagnostic_starter; diagnostic_starter (global_dc) = cp_diagnostic_starter;
diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer; diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
diagnostic_format_decoder (global_dc) = cp_tree_printer; diagnostic_format_decoder (global_dc) = cp_printer;
init_output_buffer (scratch_buffer, /* prefix */NULL, /* line-width */0); init_output_buffer (scratch_buffer, /* prefix */NULL, /* line-width */0);
} }
...@@ -2634,121 +2567,59 @@ print_instantiation_context () ...@@ -2634,121 +2567,59 @@ print_instantiation_context ()
/* Called from output_format -- during diagnostic message processing -- /* Called from output_format -- during diagnostic message processing --
to handle C++ specific format specifier with the following meanings: to handle C++ specific format specifier with the following meanings:
%A function argument-list. %A function argument-list.
%C tree code.
%D declaration. %D declaration.
%E expression. %E expression.
%F function declaration. %F function declaration.
%L language as used in extern "lang".
%O binary operator.
%P function parameter whose position is indicated by an integer. %P function parameter whose position is indicated by an integer.
%Q assignment operator.
%T type. %T type.
%V cv-qualifier. */ %V cv-qualifier. */
static int static int
cp_tree_printer (buffer) cp_printer (buffer)
output_buffer *buffer; output_buffer *buffer;
{ {
int be_verbose = 0; int verbose = 0;
tree_formatting_info tfi; const char *result;
#define next_tree va_arg (output_buffer_format_args (buffer), tree)
memset (&tfi, 0, sizeof (tree_formatting_info)); #define next_tcode va_arg (output_buffer_format_args (buffer), enum tree_code)
#define next_lang va_arg (output_buffer_format_args (buffer), enum languages)
#define next_int va_arg (output_buffer_format_args (buffer), int)
if (*output_buffer_text_cursor (buffer) == '+') if (*output_buffer_text_cursor (buffer) == '+')
++output_buffer_text_cursor (buffer); ++output_buffer_text_cursor (buffer);
if (*output_buffer_text_cursor (buffer) == '#') if (*output_buffer_text_cursor (buffer) == '#')
{ {
be_verbose = 1; verbose = 1;
++output_buffer_text_cursor (buffer); ++output_buffer_text_cursor (buffer);
} }
switch (*output_buffer_text_cursor (buffer)) switch (*output_buffer_text_cursor (buffer))
{ {
case 'A': case 'A': result = args_to_string (next_tree, verbose); break;
tree_being_formatted (&tfi) = case 'C': result = code_to_string (next_tcode, verbose); break;
va_arg (output_buffer_format_args (buffer), tree); case 'D': result = decl_to_string (next_tree, verbose); break;
if (be_verbose) case 'E': result = expr_to_string (next_tree, verbose); break;
tree_formatting_flags (&tfi) = TFF_SCOPE case 'F': result = fndecl_to_string (next_tree, verbose); break;
| TFF_FUNCTION_DEFAULT_ARGUMENTS; case 'L': result = language_to_string (next_lang, verbose); break;
print_function_argument_list (buffer, &tfi); case 'O': result = op_to_string (next_tcode, verbose); break;
break; case 'P': result = parm_to_string (next_int, verbose); break;
case 'Q': result = assop_to_string (next_tcode, verbose); break;
case 'D': case 'T': result = type_to_string (next_tree, verbose); break;
tree_being_formatted (&tfi) = case 'V': result = cv_to_string (next_tree, verbose); break;
va_arg (output_buffer_format_args (buffer), tree);
if (be_verbose)
tree_formatting_flags (&tfi) = TFF_SCOPE | TFF_DECL_SPECIFIERS
| TFF_CLASS_KEY_OR_ENUM | TFF_RETURN_TYPE
| TFF_FUNCTION_DEFAULT_ARGUMENTS | TFF_TEMPLATE_DEFAULT_ARGUMENTS
| TFF_EXCEPTION_SPECIFICATION | TFF_CHASE_NAMESPACE_ALIAS;
print_declaration (buffer, &tfi);
break;
case 'E':
tree_being_formatted (&tfi) =
va_arg (output_buffer_format_args (buffer), tree);
if (be_verbose)
tree_formatting_flags (&tfi) = TFF_SCOPE;
print_expression (buffer, &tfi);
break;
case 'F':
tree_being_formatted (&tfi) =
va_arg (output_buffer_format_args (buffer), tree);
if (be_verbose)
tree_formatting_flags (&tfi) = TFF_SCOPE | TFF_DECL_SPECIFIERS
| TFF_RETURN_TYPE | TFF_FUNCTION_DEFAULT_ARGUMENTS
| TFF_EXCEPTION_SPECIFICATION;
print_function_declaration (buffer, &tfi);
break;
case 'P':
print_function_parameter
(buffer, va_arg (output_buffer_format_args (buffer), int));
break;
case 'T':
tree_being_formatted (&tfi) =
va_arg (output_buffer_format_args (buffer), tree);
if (be_verbose)
tree_formatting_flags (&tfi) = TFF_SCOPE | TFF_CLASS_KEY_OR_ENUM
| TFF_RETURN_TYPE | TFF_EXCEPTION_SPECIFICATION;
print_type_id (buffer, &tfi);
break;
case 'V':
tree_being_formatted (&tfi) =
va_arg (output_buffer_format_args (buffer), tree);
print_cv_qualifier_seq (buffer, &tfi);
break;
default: default:
return 0; return 0;
} }
output_add_string (buffer, result);
return 1; return 1;
} #undef next_tree
#undef next_tcode
/* Print a function argument-list represented by tree_being_formatted (TFI) #undef next_lang
onto BUFFER. */ #undef next_int
static void
print_function_argument_list (buffer, tfi)
output_buffer *buffer __attribute__ ((__unused__));
tfi_t tfi __attribute__ ((__unused__));
{
}
/* Print a declaration represented by tree_being_formatted (TFI)
onto buffer. */
static void
print_declaration (buffer, tfi)
output_buffer *buffer __attribute__ ((__unused__));
tfi_t tfi __attribute__ ((__unused__));
{
}
/* Print an expression represented by tree_being_formatted (TFI)
onto BUFFER. */
static void
print_expression (buffer, tfi)
output_buffer *buffer __attribute__ ((__unused__));
tfi_t tfi __attribute__ ((__unused__));
{
} }
static void static void
...@@ -2760,617 +2631,140 @@ print_integer (buffer, i) ...@@ -2760,617 +2631,140 @@ print_integer (buffer, i)
output_add_string (buffer, digit_buffer); output_add_string (buffer, digit_buffer);
} }
/* Print a function declaration represented by tree_being_formatted (TFI)
onto BUFFER. */
static void
print_function_declaration (buffer, tfi)
output_buffer *buffer __attribute__ ((__unused__));
tfi_t tfi __attribute__ ((__unused__));
{
}
/* Print the N'th function parameter onto BUFFER. A negative value of N
means the implicit "this" parameter of a member function. */
static void static void
print_function_parameter (buffer, n) print_non_consecutive_character (buffer, c)
output_buffer *buffer;
int n;
{
if (n < 0)
print_identifier (buffer, "this");
else
output_decimal (buffer, n + 1);
}
/* Print a type represented by tree_being_formatted (TFI) onto BUFFER. */
static void
print_type_id (buffer, tfi)
output_buffer *buffer; output_buffer *buffer;
tfi_t tfi; int c;
{ {
tree t = tree_being_formatted (tfi); const char *p = output_last_position (buffer);
int flags = tree_formatting_flags (tfi);
if (t == NULL_TREE)
return;
if (flags & TFF_CHASE_TYPEDEF)
tree_being_formatted (tfi) =
typedef_original_name (tree_being_formatted (tfi));
/* A type-id is of the form:
type-id:
type-specifier-seq abstract-declarator(opt) */
print_type_specifier_seq (buffer, tfi);
if (TYPE_PTRMEMFUNC_P (t))
goto ptr_mem_fun;
/* For types with abstract-declarator, print_type_specifier_seq prints
the start of the abstract-declarator. Fiinish the job. */
switch (TREE_CODE (t))
{
case ARRAY_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
case METHOD_TYPE:
case FUNCTION_TYPE:
ptr_mem_fun:
print_rest_of_abstract_declarator (buffer, tfi);
default:
break;
}
tree_being_formatted (tfi) = t; if (p != NULL && *p == c)
output_add_space (buffer);
output_add_character (buffer, c);
} }
/* Print the type-specifier-seq part of a type-id. If appropriate, print /* These are temporary wrapper functions which handle the historic
also the prefix of the abstract-declarator. */ behavior of cp_*_at. */
static void
print_type_specifier_seq (buffer, tfi)
output_buffer *buffer;
tfi_t tfi;
{
int flags = tree_formatting_flags (tfi);
tree t = tree_being_formatted (tfi);
enum tree_code code = TREE_CODE (t);
/* A type-speficier-seq is:
type-specifier type-specifier-seq(opt)
where
type-specifier:
simple-type-specifier
class-specifier
enum-specifier
elaborated-type-specifier
cv-qualifier
We do not, however, pretty-print class-specifier nor enum-specifier. */
switch (code)
{
case UNKNOWN_TYPE:
case IDENTIFIER_NODE:
case VOID_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
case COMPLEX_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case UNION_TYPE:
case TYPE_DECL:
case TEMPLATE_DECL:
case TEMPLATE_TYPE_PARM:
case TYPEOF_TYPE:
case TEMPLATE_TEMPLATE_PARM:
case TYPENAME_TYPE:
class_type:
print_cv_qualifier_seq (buffer, tfi);
if ((flags & TFF_DECL_SPECIFIERS)
&& (code == TYPENAME_TYPE || IS_AGGR_TYPE (t)))
print_elaborated_type_specifier (buffer, tfi);
else
print_simple_type_specifier (buffer, tfi);
break;
/* Because the abstract-declarator can modify the type-specifier-seq
in a highly non linear manner, we pretty-print its prefix here.
The suffix part is handled by print_rest_of_abstract_declarator. */
/* A RECORD_TYPE is also used to represent a pointer to member
function. */
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_P (t))
{
/* Print the return type. */
tree_being_formatted (tfi) =
TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (t));
print_type_id (buffer, tfi);
print_whitespace (buffer, tfi);
/* Then the beginning of the abstract-declarator part. */
tree_being_formatted (tfi) =
TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (t));
print_left_paren (buffer);
print_nested_name_specifier (buffer, tfi);
}
else
goto class_type;
break;
case POINTER_TYPE:
if (TYPE_PTRMEM_P (t))
goto ptr_data_member;
else
goto non_ptr_data_member;
break;
case ARRAY_TYPE:
case REFERENCE_TYPE:
case FUNCTION_TYPE:
case METHOD_TYPE:
non_ptr_data_member:
tree_being_formatted (tfi) = TREE_TYPE (t);
print_type_specifier_seq (buffer, tfi);
if (code == POINTER_TYPE || code == REFERENCE_TYPE)
{
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
print_left_paren (buffer);
}
else if (code == FUNCTION_TYPE || code == METHOD_TYPE)
{
print_whitespace (buffer, tfi);
print_left_paren (buffer);
if (code == METHOD_TYPE)
{
tree_being_formatted (tfi) = TYPE_METHOD_BASETYPE (t);
print_nested_name_specifier (buffer, tfi);
tree_being_formatted (tfi) = t;
}
}
tree_being_formatted (tfi) = t;
break;
ptr_data_member:
case OFFSET_TYPE:
/* Firstly, the type of the member. */
tree_being_formatted (tfi) = TREE_TYPE (t);
print_type_id (buffer, tfi);
print_whitespace (buffer, tfi);
/* Then, the containing class. */
tree_being_formatted (tfi) = TYPE_OFFSET_BASETYPE (t);
print_nested_name_specifier (buffer, tfi);
tree_being_formatted (tfi) = t;
break;
default:
sorry_for_unsupported_tree (t);
/* fall throught */
case ERROR_MARK: static tree
print_identifier (buffer, "{type-specifier-seq error}"); locate_error (msgid, ap)
break; const char *msgid;
} va_list ap;
tree_being_formatted (tfi) = t;
}
/* Print the simpe-type-specifier component of a type-specifier. */
static void
print_simple_type_specifier (buffer, tfi)
output_buffer *buffer;
tfi_t tfi;
{ {
int flags = tree_formatting_flags (tfi); tree here = 0, t;
tree t = tree_being_formatted (tfi); int plus = 0;
enum tree_code code = TREE_CODE (t); const char *f;
switch (code) for (f = msgid; *f; f++)
{ {
case UNKNOWN_TYPE: plus = 0;
print_identifier (buffer, "{unknown type}"); if (*f == '%')
break; {
f++;
case IDENTIFIER_NODE: if (*f == '+')
print_tree_identifier (buffer, t); f++, plus = 1;
break; if (*f == '#')
f++;
case COMPLEX_TYPE:
print_identifier (buffer, "__complex__ ");
tree_being_formatted (tfi) = TREE_TYPE (t);
print_type_id (buffer, tfi);
break;
case TYPENAME_TYPE:
tree_being_formatted (tfi) = TYPE_CONTEXT (t);
print_nested_name_specifier (buffer, tfi);
tree_being_formatted (tfi) = TYPENAME_TYPE_FULLNAME (t);
tree_formatting_flags (tfi) |= ~TFF_CHASE_TYPEDEF;
print_type_id (buffer, tfi);
break;
case TYPEOF_TYPE:
print_identifier (buffer, "__typeof__");
tree_being_formatted (tfi) = TYPE_FIELDS (t);
print_left_paren (buffer);
print_expression (buffer, tfi);
print_right_paren (buffer);
break;
case INTEGER_TYPE:
if (TREE_UNSIGNED (t))
{
if (TYPE_MAIN_VARIANT (t) == integer_type_node)
/* We don't want pedantry like `unsigned int'. */;
else if (!TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)))
{
print_identifier (buffer, "unsigned");
print_whitespace (buffer, tfi);
}
}
else if (TYPE_MAIN_VARIANT (t) == char_type_node)
{
print_identifier (buffer, "signed");
print_whitespace (buffer, tfi);
}
case REAL_TYPE:
case BOOLEAN_TYPE:
case VOID_TYPE:
{
tree s = (flags & TFF_CHASE_TYPEDEF) ? TYPE_MAIN_VARIANT (t) : t;
if (TYPE_NAME (s) && TYPE_IDENTIFIER (s))
print_tree_identifier (buffer, TYPE_IDENTIFIER (s));
else
/* Types like intQI_type_node and friends have no names.
These don't come up in user error messages, but it's nice
to be able to print them from the debugger. */
print_identifier (buffer, "{anonymous}");
}
break;
case TEMPLATE_TEMPLATE_PARM:
if (TYPE_IDENTIFIER (t))
print_tree_identifier (buffer, TYPE_IDENTIFIER (t));
else
print_identifier (buffer, "{anonymous template template parameter}");
break;
case TYPE_DECL:
if (flags & TFF_CHASE_TYPEDEF)
print_type_id (buffer, tfi);
else
print_tree_identifier (buffer, DECL_NAME (t));
break;
case BOUND_TEMPLATE_TEMPLATE_PARM:
case TEMPLATE_DECL:
print_template_id (buffer, tfi);
break;
case TEMPLATE_TYPE_PARM: switch (*f)
if (TYPE_IDENTIFIER (t)) {
print_tree_identifier (buffer, TYPE_IDENTIFIER (t)); /* Just ignore these possibilities. */
else case '%': break;
print_identifier (buffer, "{anonymous template type parameter}"); case 'd': (void) va_arg (ap, int); break;
break; case 's': (void) va_arg (ap, char *); break;
case 'L': (void) va_arg (ap, enum languages); break;
case 'C':
case 'O':
case 'Q': (void) va_arg (ap, enum tree_code); break;
/* These take a tree, which may be where the error is
located. */
case 'A':
case 'D':
case 'E':
case 'F':
case 'P':
case 'T':
case 'V':
t = va_arg (ap, tree);
if (!here || plus)
here = t;
break;
default: default:
break; errorcount = 0; /* damn ICE suppression */
internal_error ("unexpected letter `%c' in locate_error\n", *f);
}
}
} }
tree_being_formatted (tfi) = t; if (here == 0)
tree_formatting_flags (tfi) = flags; here = va_arg (ap, tree);
}
/* Print the elaborated-type-specifier form of a type-specifier. */
static void
print_elaborated_type_specifier (buffer, tfi)
output_buffer *buffer;
tfi_t tfi;
{
int flags = tree_formatting_flags (tfi);
tree t = tree_being_formatted (tfi);
switch (TREE_CODE (t))
{
case TYPENAME_TYPE:
print_identifier (buffer, "typename");
print_whitespace (buffer, tfi);
tree_formatting_flags (tfi) |= ~TFF_DECL_SPECIFIERS;
print_simple_type_specifier (buffer, tfi);
break;
case UNION_TYPE:
case RECORD_TYPE:
{
tree name = NULL_TREE;
if (flags & TFF_CHASE_TYPEDEF)
tree_being_formatted (tfi) = typedef_original_name (t);
print_identifier
(buffer, class_key_or_enum (tree_being_formatted (tfi)));
print_whitespace (buffer, tfi);
name = TYPE_NAME (tree_being_formatted (tfi)); return here;
if (name)
{
if (flags & TFF_SCOPE)
{
tree_being_formatted (tfi) = CP_DECL_CONTEXT (name);
print_nested_name_specifier (buffer, tfi);
}
print_tree_identifier (buffer, DECL_NAME (name));
}
else
print_identifier (buffer, "{anonymous}");
}
break;
default:
sorry_for_unsupported_tree (t);
break;
}
tree_being_formatted (tfi) = t;
tree_formatting_flags (tfi) = flags;
} }
/* Finish the job of printing the abstract-declarator part of a
type-id. */
static void
print_rest_of_abstract_declarator (buffer, tfi)
output_buffer *buffer;
tfi_t tfi;
{
tree t = tree_being_formatted (tfi);
enum tree_code code = TREE_CODE (t);
/* An abstract-declarator has the form:
abstract-declarator:
ptr-operator abstract-declarator(opt)
direct-abstract-declarator
direct-abstract-declarator:
direct-abstract-declarator(opt)
( parameter-declaration-clause ) cv-qualifier-seq(opt)
exception-specification(opt)
direct-abstract-declarator(opt) [ constant-expression(opt) ]
( direct-abstract-declarator ) */
switch (code)
{
case ARRAY_TYPE:
print_left_bracket (buffer);
if (TYPE_DOMAIN (t))
{
tree s = TYPE_DOMAIN (t);
if (host_integerp (TYPE_MAX_VALUE (s), 0))
output_decimal (buffer, tree_low_cst (TYPE_MAX_VALUE (s), 0) + 1);
else if (TREE_CODE (TYPE_MAX_VALUE (s)) == MINUS_EXPR)
{
tree_being_formatted (tfi) =
TREE_OPERAND (TYPE_MAX_VALUE (s), 0);
print_expression (buffer, tfi);
tree_being_formatted (tfi) = t;
}
else
{
tree_being_formatted (tfi) = fold
(cp_build_binary_op (PLUS_EXPR, TYPE_MAX_VALUE (s),
integer_one_node));
print_expression (buffer, tfi);
tree_being_formatted (tfi) = t;
}
}
print_right_bracket (buffer);
put_whitespace (tfi) = none;
tree_being_formatted (tfi) = TREE_TYPE (t);
print_rest_of_abstract_declarator (buffer, tfi);
tree_being_formatted (tfi) = t;
break;
case POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
if (code == POINTER_TYPE || code == REFERENCE_TYPE)
{
output_add_character (buffer, "&*"[code == POINTER_TYPE]);
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
print_right_paren (buffer);
}
put_whitespace (tfi) = before;
print_cv_qualifier_seq (buffer, tfi);
tree_being_formatted (tfi) = TREE_TYPE (t);
print_rest_of_abstract_declarator (buffer, tfi);
tree_being_formatted (tfi) = t;
break;
case FUNCTION_TYPE: void
case METHOD_TYPE: cp_error_at VPARAMS ((const char *msgid, ...))
print_right_paren (buffer);
print_whitespace (buffer, tfi);
/* Skip the `this' implicit parameter if present. */
tree_being_formatted (tfi) = TYPE_ARG_TYPES (t);
if (code == METHOD_TYPE)
tree_being_formatted (tfi) = TREE_CHAIN (tree_being_formatted (tfi));
/* Print the parameter-list. */
print_left_paren (buffer);
print_parameter_declaration_clause (buffer, tfi);
print_right_paren (buffer);
print_whitespace (buffer, tfi);
if (code == METHOD_TYPE)
{
tree_being_formatted (tfi) =
TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t)));
print_cv_qualifier_seq (buffer, tfi);
}
/* Finish the abstract-declarator. */
tree_being_formatted (tfi) = TREE_TYPE (t);
print_rest_of_abstract_declarator (buffer, tfi);
/* Print the exception-specification for documentaion purpose. */
tree_being_formatted (tfi) = TYPE_RAISES_EXCEPTIONS (t);
print_exception_specification (buffer, tfi);
tree_being_formatted (tfi) = t;
break;
/* These types don't have abstract-declarator. */
case UNKNOWN_TYPE:
case IDENTIFIER_NODE:
case VOID_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
case COMPLEX_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case UNION_TYPE:
case TYPE_DECL:
case TEMPLATE_DECL:
case TEMPLATE_TYPE_PARM:
case TYPEOF_TYPE:
case TEMPLATE_TEMPLATE_PARM:
case TYPENAME_TYPE:
break;
default:
sorry_for_unsupported_tree (t);
/* fall throught. */
case ERROR_MARK:
break;
}
}
/* Print the cv-quafilers of tree_being_formatted (TFI) onto BUFFER. */
static void
print_cv_qualifier_seq (buffer, tfi)
output_buffer *buffer;
tree_formatting_info *tfi;
{ {
int cv = TYPE_QUALS (tree_being_formatted (tfi)); tree here;
int pad_after = after == put_whitespace (tfi); diagnostic_context dc;
static const int mask[]
= {TYPE_QUAL_CONST, TYPE_QUAL_VOLATILE, TYPE_QUAL_RESTRICT};
static const char *const qualifier[]
= { "const", "volatile", "__restrict__" };
if (cv != 0)
{
int i;
for (i = 0; i != 3; ++i)
if (mask[i] & cv)
{
if (put_whitespace (tfi) == before)
output_add_space (buffer);
print_identifier (buffer, qualifier[i]);
put_whitespace (tfi) = before;
}
if (pad_after) VA_OPEN (ap, msgid);
{ VA_FIXEDARG (ap, const char *, msgid);
output_add_space (buffer); here = locate_error (msgid, ap);
put_whitespace (tfi) = none; VA_CLOSE (ap);
}
}
}
static void VA_OPEN (ap, msgid);
print_parameter_declaration_clause (buffer, tfi) VA_FIXEDARG (ap, const char *, msgid);
output_buffer *buffer __attribute__ ((__unused__));
tfi_t tfi __attribute__ ((__unused__));
{
}
static void set_diagnostic_context (&dc, msgid, &ap,
print_exception_specification (buffer, tfi) cp_file_of (here),
output_buffer *buffer __attribute__ ((__unused__)); cp_line_of (here), /* warning = */ 0);
tfi_t tfi __attribute__ ((__unused__)); report_diagnostic (&dc);
{ VA_CLOSE (ap);
} }
static void void
print_nested_name_specifier (buffer, tfi) cp_warning_at VPARAMS ((const char *msgid, ...))
output_buffer *buffer;
tfi_t tfi;
{ {
int flags = tree_formatting_flags (tfi); tree here;
tree t = tree_being_formatted (tfi); diagnostic_context dc;
/* A nested-name-specifier is:
class-or-namespace-name :: nested-name-specifier(opt)
class-or-namespace-name :: template nested-name-specifier
The latter form being the correct syntax for a name designating
a template member, where the preceding class-or-namespace-name part
is name-dependent. For the time being, we do not do such a
sophisticated pretty-printing.
class-or-namespace-name:
class-name
namespace-name */
if (t == NULL_TREE || t == global_namespace)
return;
if (CLASS_TYPE_P (t) && !(flags & TFF_CLASS_SCOPE)) VA_OPEN (ap, msgid);
return; VA_FIXEDARG (ap, const char *, msgid);
here = locate_error (msgid, ap);
if (TREE_CODE (t) == NAMESPACE_DECL && !(flags & TFF_NAMESPACE_SCOPE)) VA_CLOSE (ap);
return;
tree_being_formatted (tfi) = DECL_CONTEXT (t); VA_OPEN (ap, msgid);
print_nested_name_specifier (buffer, tfi); VA_FIXEDARG (ap, const char *, msgid);
print_scope_operator (buffer);
if (TREE_CODE (t) == NAMESPACE_DECL)
print_tree_identifier (buffer, DECL_NAME (t));
else if (CLASS_TYPE_P (t))
{
if (!DECL_USE_TEMPLATE (t))
print_tree_identifier (buffer, TYPE_IDENTIFIER (t));
else
{
tree_being_formatted (tfi) = t;
print_template_id (buffer, tfi);
}
}
tree_being_formatted (tfi) = t; set_diagnostic_context (&dc, msgid, &ap,
cp_file_of (here),
cp_line_of (here), /* warning = */ 1);
report_diagnostic (&dc);
VA_CLOSE (ap);
} }
static void void
print_template_id (buffer, tfi) cp_pedwarn_at VPARAMS ((const char *msgid, ...))
output_buffer *buffer;
tfi_t tfi __attribute__ ((__unused__));
{ {
print_template_argument_list_start (buffer); tree here;
/* ... */ diagnostic_context dc;
print_template_argument_list_end (buffer);
}
static tree VA_OPEN (ap, msgid);
typedef_original_name (t) VA_FIXEDARG (ap, const char *, msgid);
tree t; here = locate_error (msgid, ap);
{ VA_CLOSE (ap);
return DECL_ORIGINAL_TYPE (t) ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t);
}
static void VA_OPEN (ap, msgid);
print_non_consecutive_character (buffer, c) VA_FIXEDARG (ap, const char *, msgid);
output_buffer *buffer;
int c;
{
const char *p = output_last_position (buffer);
if (p != NULL && *p == c) set_diagnostic_context (&dc, msgid, &ap,
output_add_space (buffer); cp_file_of (here),
output_add_character (buffer, c); cp_line_of (here),
/* warning = */ !flag_pedantic_errors);
report_diagnostic (&dc);
VA_CLOSE (ap);
} }
...@@ -20,17 +20,19 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -20,17 +20,19 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* warning, error, and fatal. These definitions are suitable for use /* warning, error, and fatal. These definitions are suitable for use
in the generator programs; eventually we would like to use them in in the generator programs; eventually we would like to use them in
cc1 too, but that's a longer term project. */ cc1 too, but that's a longer term project.
N.B. We cannot presently use ATTRIBUTE_PRINTF with these functions,
because they can be extended with additional format specifiers which
GCC does not know about. */
#ifndef GCC_ERRORS_H #ifndef GCC_ERRORS_H
#define GCC_ERRORS_H #define GCC_ERRORS_H
extern void warning PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1; extern void warning PARAMS ((const char *, ...));
extern void error PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1; extern void error PARAMS ((const char *, ...));
extern void fatal PARAMS ((const char *, ...)) extern void fatal PARAMS ((const char *, ...)) ATTRIBUTE_NORETURN;
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; extern void internal_error PARAMS ((const char *, ...)) ATTRIBUTE_NORETURN;
extern void internal_error PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
extern const char *trim_filename PARAMS ((const char *)); extern const char *trim_filename PARAMS ((const char *));
extern void fancy_abort PARAMS ((const char *, int, const char *)) extern void fancy_abort PARAMS ((const char *, int, const char *))
ATTRIBUTE_NORETURN; ATTRIBUTE_NORETURN;
......
2001-09-23 Zack Weinberg <zack@codesourcery.com>
* POTFILES.in: Remove cp/errfn.c.
2001-08-01 Nick Clifton <nickc@cambridge.redhat.com> 2001-08-01 Nick Clifton <nickc@cambridge.redhat.com>
* POTFILES.in: Remove chorus.h files from i386, rs6000 and sparc * POTFILES.in: Remove chorus.h files from i386, rs6000 and sparc
...@@ -5,7 +9,7 @@ ...@@ -5,7 +9,7 @@
Mon Jul 9 13:27:15 2001 Jeffrey A Law (law@cygnus.com) Mon Jul 9 13:27:15 2001 Jeffrey A Law (law@cygnus.com)
* POTFILES.in: Add ssa-ccp.c * POTFILES.in: Add ssa-ccp.c
Thu Jun 28 16:11:30 2001 Jeffrey A Law (law@cygnus.com) Thu Jun 28 16:11:30 2001 Jeffrey A Law (law@cygnus.com)
...@@ -32,8 +36,8 @@ Tue Jun 19 08:03:43 2001 Jeffrey A Law (law@cygnus.com) ...@@ -32,8 +36,8 @@ Tue Jun 19 08:03:43 2001 Jeffrey A Law (law@cygnus.com)
2001-06-11 Zack Weinberg <zackw@stanford.edu> 2001-06-11 Zack Weinberg <zackw@stanford.edu>
* Makefile.in.in: Take --defines switch off of xgettext * Makefile.in.in: Take --defines switch off of xgettext
command line. command line.
* POTFILES.in: Massive update, removing all dead files and * POTFILES.in: Massive update, removing all dead files and
adding approximately 300 files which had been left out. adding approximately 300 files which had been left out.
Clarify comments on what should and should not appear here. Clarify comments on what should and should not appear here.
...@@ -120,7 +124,7 @@ Thu Nov 30 01:28:08 2000 Jeffrey A Law (law@cygnus.com) ...@@ -120,7 +124,7 @@ Thu Nov 30 01:28:08 2000 Jeffrey A Law (law@cygnus.com)
* POTFILES.in: Remove the files from the nuked * POTFILES.in: Remove the files from the nuked
dead ports. dead ports.
* ChangeLog: Correct David's entry. * ChangeLog: Correct David's entry.
2000-09-28 David O'Brien <obrien@FreeBSD.org> 2000-09-28 David O'Brien <obrien@FreeBSD.org>
...@@ -131,7 +135,7 @@ Thu Nov 30 01:28:08 2000 Jeffrey A Law (law@cygnus.com) ...@@ -131,7 +135,7 @@ Thu Nov 30 01:28:08 2000 Jeffrey A Law (law@cygnus.com)
2000-09-26 Philipp Thomas <pthomas@suse.de> 2000-09-26 Philipp Thomas <pthomas@suse.de>
* Makefile.in.in: Remove stamp-check-pot from list * Makefile.in.in: Remove stamp-check-pot from list
of default targets as checks are only possible in a of default targets as checks are only possible in a
complete source tree and all languages configured. complete source tree and all languages configured.
2000-09-13 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> 2000-09-13 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
......
...@@ -665,7 +665,6 @@ cp/decl.c ...@@ -665,7 +665,6 @@ cp/decl.c
cp/decl.h cp/decl.h
cp/decl2.c cp/decl2.c
cp/dump.c cp/dump.c
cp/errfn.c
cp/error.c cp/error.c
cp/except.c cp/except.c
cp/expr.c cp/expr.c
......
...@@ -39,10 +39,8 @@ extern void strip_off_ending PARAMS ((char *, int)); ...@@ -39,10 +39,8 @@ extern void strip_off_ending PARAMS ((char *, int));
extern void print_time PARAMS ((const char *, long)); extern void print_time PARAMS ((const char *, long));
extern const char *trim_filename PARAMS ((const char *)); extern const char *trim_filename PARAMS ((const char *));
extern void internal_error PARAMS ((const char *, ...)) extern void internal_error PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1
ATTRIBUTE_NORETURN; ATTRIBUTE_NORETURN;
extern void fatal_io_error PARAMS ((const char *, ...)) extern void fatal_io_error PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1
ATTRIBUTE_NORETURN; ATTRIBUTE_NORETURN;
extern void _fatal_insn_not_found PARAMS ((struct rtx_def *, extern void _fatal_insn_not_found PARAMS ((struct rtx_def *,
const char *, int, const char *, int,
...@@ -59,26 +57,21 @@ extern void _fatal_insn PARAMS ((const char *, ...@@ -59,26 +57,21 @@ extern void _fatal_insn PARAMS ((const char *,
#define fatal_insn_not_found(insn) \ #define fatal_insn_not_found(insn) \
_fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__) _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
extern void warning PARAMS ((const char *, ...)) /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
ATTRIBUTE_PRINTF_1; each language front end can extend them with its own set of format
extern void error PARAMS ((const char *, ...)) specifiers. */
ATTRIBUTE_PRINTF_1; extern void warning PARAMS ((const char *, ...));
extern void error PARAMS ((const char *, ...));
extern void fatal_error PARAMS ((const char *, ...)) extern void fatal_error PARAMS ((const char *, ...))
ATTRIBUTE_NORETURN ATTRIBUTE_NORETURN;
ATTRIBUTE_PRINTF_1; extern void pedwarn PARAMS ((const char *, ...));
extern void pedwarn PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
extern void pedwarn_with_file_and_line PARAMS ((const char *, int, extern void pedwarn_with_file_and_line PARAMS ((const char *, int,
const char *, ...)) const char *, ...));
ATTRIBUTE_PRINTF_3;
extern void warning_with_file_and_line PARAMS ((const char *, int, extern void warning_with_file_and_line PARAMS ((const char *, int,
const char *, ...)) const char *, ...));
ATTRIBUTE_PRINTF_3;
extern void error_with_file_and_line PARAMS ((const char *, int, extern void error_with_file_and_line PARAMS ((const char *, int,
const char *, ...)) const char *, ...));
ATTRIBUTE_PRINTF_3; extern void sorry PARAMS ((const char *, ...));
extern void sorry PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
extern void report_error_function PARAMS ((const char *)); extern void report_error_function PARAMS ((const char *));
extern void rest_of_decl_compilation PARAMS ((union tree_node *, extern void rest_of_decl_compilation PARAMS ((union tree_node *,
...@@ -86,7 +79,6 @@ extern void rest_of_decl_compilation PARAMS ((union tree_node *, ...@@ -86,7 +79,6 @@ extern void rest_of_decl_compilation PARAMS ((union tree_node *,
extern void rest_of_type_compilation PARAMS ((union tree_node *, int)); extern void rest_of_type_compilation PARAMS ((union tree_node *, int));
extern void rest_of_compilation PARAMS ((union tree_node *)); extern void rest_of_compilation PARAMS ((union tree_node *));
/* The *_with_decl functions aren't suitable for ATTRIBUTE_PRINTF. */
extern void pedwarn_with_decl PARAMS ((union tree_node *, extern void pedwarn_with_decl PARAMS ((union tree_node *,
const char *, ...)); const char *, ...));
extern void warning_with_decl PARAMS ((union tree_node *, extern void warning_with_decl PARAMS ((union tree_node *,
...@@ -97,11 +89,9 @@ extern void error_with_decl PARAMS ((union tree_node *, ...@@ -97,11 +89,9 @@ extern void error_with_decl PARAMS ((union tree_node *,
extern void announce_function PARAMS ((union tree_node *)); extern void announce_function PARAMS ((union tree_node *));
extern void error_for_asm PARAMS ((struct rtx_def *, extern void error_for_asm PARAMS ((struct rtx_def *,
const char *, ...)) const char *, ...));
ATTRIBUTE_PRINTF_2;
extern void warning_for_asm PARAMS ((struct rtx_def *, extern void warning_for_asm PARAMS ((struct rtx_def *,
const char *, ...)) const char *, ...));
ATTRIBUTE_PRINTF_2;
extern int do_float_handler PARAMS ((void (*) (PTR), PTR)); extern int do_float_handler PARAMS ((void (*) (PTR), PTR));
#ifdef BUFSIZ #ifdef BUFSIZ
...@@ -113,6 +103,8 @@ extern void botch PARAMS ((const char *)) ...@@ -113,6 +103,8 @@ extern void botch PARAMS ((const char *))
ATTRIBUTE_NORETURN; ATTRIBUTE_NORETURN;
#ifdef BUFSIZ #ifdef BUFSIZ
/* N.B. Unlike all the others, fnotice is just gettext+fprintf, and
therefore it can have ATTRIBUTE_PRINTF. */
extern void fnotice PARAMS ((FILE *, const char *, ...)) extern void fnotice PARAMS ((FILE *, const char *, ...))
ATTRIBUTE_PRINTF_2; ATTRIBUTE_PRINTF_2;
#endif #endif
......
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