Commit 8251199e by Jason Merrill

revert error reporting patch

From-SVN: r22310
parent 5db17173
1998-09-07 Mark Mitchell <mark@markmitchell.com>
and Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cp-tree.h (cp_error): Prototype.
(cp_error_at): Likewise.
(cp_warning): Likewise.
(cp_warning_at): Likewise.
(cp_pedwarn): Likewise.
(cp_pedwarn_at): Likewise.
(cp_compiler_error): Likewise.
(cp_sprintf): Likewise.
(cp_enable_warning): Likewise.
* errfn.c: Remove hack to avoid error-function prototypes when
including cp-tree.h.
1998-09-06 Mark Mitchell <mark@markmitchell.com>
* cp-error.def: New file.
* Make-lang.in (cc1plus): Add dependency on it.
* Makefile.in (CXX_TREE_H): Likewise.
* cp-tree.h (error_code): New type.
Include cp-error.def to get error codes. Make it possible to
include cp-tree.h in errfn.c.
(enable_warning): New function.
(flag_diag_codes): New variable.
* errfn.c: Include cp-tree.h.
(cp_err_msg): New type. Include cp-error.def to define it.
(err_msgs): New variable.
(is_warning_enabled): New function.
(cp_thing): Take an error_code, not a format string. Output the
diagnostic code if flag_diag_codes.
(cp_error, cp_compiler_error, cp_sprintf, cp_error_at): Take
error_codes, not format strings.
(cp_warning, cp_pedwarn, cp_warning_at, cp_pedwarn_at): Likewise.
Call is_warning_enabled.
* decl2.c (flag_diag_codes): New variable.
(lang_decode_option): Handle -fdiag-codes and -Wnumber.
* lang-options.h: Add -fdiag-codes, -fno-diag-codes, and
-W-number-, and -Wno-number.
* class.c: Update all calls to error-functions.
* cvt.c: Likewise.
* decl.c: Likewise.
* decl2.c: Likewise.
* except.c: Likewise.
* expr.c: Likewise.
* friend.c: Likewise.
* lex.c: Likewise.
* parse.y: Likewise.
* pt.c: Likewise.
* repo.c: Likewise.
* rtti.c: Likewise.
* search.c: Likewise.
* semantics.c: Likewise.
* sig.c: Likewise.
* tree.c: Likewise.
* typeck.c: Likewise.
* typeck2.c: Likewise.
* xref.c: Likewise.
Sun Sep 6 00:00:51 1998 Jeffrey A Law (law@cygnus.com)
* Makefile.in (INCLUDES): Update after recent toplevel gcc
......
......@@ -125,7 +125,7 @@ CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
$(srcdir)/cp/repo.c $(srcdir)/cp/semantics.c
cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o \
$(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def $(srcdir)/cp/cp-error.def
$(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def
cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
#
# Build hooks:
......
......@@ -208,7 +208,7 @@ RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def cp-error.def
CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def
PARSE_H = $(srcdir)/parse.h
PARSE_C = $(srcdir)/parse.c
EXPR_H = $(srcdir)/../expr.h ../insn-codes.h
......
......@@ -493,16 +493,6 @@ enum cplus_tree_code {
};
#undef DEFTREECODE
/* Error codes. */
typedef enum error_code {
#undef DEFERROR
#undef DEFERRORNUM
#define DEFERROR(code, string) code,
#define DEFERRORNUM(code, string, num) DEFERROR(code, string)
#include "cp-error.def"
ec_last_error_code
} error_code;
enum languages { lang_c, lang_cplusplus, lang_java };
/* Macros to make error reporting functions' lives easier. */
......@@ -2250,9 +2240,6 @@ extern int flag_new_abi;
extern int flag_honor_std;
/* Nonzero means show diagnostic codes when printing error messages. */
extern int flag_diag_codes;
/* Nonzero if we're done parsing and into end-of-file activities. */
extern int at_eof;
......@@ -2640,15 +2627,14 @@ extern tree handle_class_head PROTO((tree, tree, tree));
extern tree lookup_arg_dependent PROTO((tree, tree, tree));
/* in errfn.c */
extern void cp_error PVPROTO((error_code, ...));
extern void cp_error_at PVPROTO((error_code, ...));
extern void cp_warning PVPROTO((error_code, ...));
extern void cp_warning_at PVPROTO((error_code, ...));
extern void cp_pedwarn PVPROTO((error_code, ...));
extern void cp_pedwarn_at PVPROTO((error_code, ...));
extern void cp_compiler_error PVPROTO((error_code, ...));
extern void cp_sprintf PVPROTO((error_code, ...));
extern void cp_enable_warning PROTO((int, int));
extern void cp_error ();
extern void cp_error_at ();
extern void cp_warning ();
extern void cp_warning_at ();
extern void cp_pedwarn ();
extern void cp_pedwarn_at ();
extern void cp_compiler_error ();
extern void cp_sprintf ();
/* in error.c */
extern void init_error PROTO((void));
......
......@@ -80,7 +80,7 @@ cp_convert_to_pointer (type, expr)
intype = complete_type (intype);
if (TYPE_SIZE (intype) == NULL_TREE)
{
cp_error (ec_cant_convert_from_incomplete_type_to,
cp_error ("can't convert from incomplete type `%T' to `%T'",
intype, type);
return error_mark_node;
}
......@@ -89,7 +89,7 @@ cp_convert_to_pointer (type, expr)
if (rval)
{
if (rval == error_mark_node)
cp_error (ec_conversion_of_from_to_is_ambiguous,
cp_error ("conversion of `%E' from `%T' to `%T' is ambiguous",
expr, intype, type);
return rval;
}
......@@ -134,7 +134,7 @@ cp_convert_to_pointer (type, expr)
{
if (TREE_CODE (TREE_TYPE (TREE_TYPE (expr))) == METHOD_TYPE)
if (pedantic || warn_pmf2ptr)
cp_pedwarn (ec_converting_from_to, TREE_TYPE (expr),
cp_pedwarn ("converting from `%T' to `%T'", TREE_TYPE (expr),
type);
return build1 (NOP_EXPR, type, expr);
}
......@@ -223,7 +223,7 @@ cp_convert_to_pointer (type, expr)
|| (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE))
{
cp_error (ec_cannot_convert_from_type_to_type,
cp_error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
return error_mark_node;
}
......@@ -262,7 +262,7 @@ cp_convert_to_pointer (type, expr)
return convert_to_pointer (type, expr);
}
cp_error (ec_cannot_convert_from_type_to_type,
cp_error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
return error_mark_node;
}
......@@ -311,7 +311,7 @@ convert_to_pointer_force (type, expr)
if (distance == -2)
{
ambig:
cp_error (ec_type_is_ambiguous_baseclass_of_s,
cp_error ("type `%T' is ambiguous baseclass of `%s'",
TREE_TYPE (type),
TYPE_NAME_STRING (TREE_TYPE (intype)));
return error_mark_node;
......@@ -454,19 +454,19 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
{
if (decl)
/* Ensure semantics of [dcl.init.ref] */
cp_pedwarn (ec_initialization_of_nonconst_reference_from_rvalue,
cp_pedwarn ("initialization of non-const reference `%#T' from rvalue `%T'",
reftype, intype);
else
cp_pedwarn (ec_conversion_to_nonconst_from_rvalue,
cp_pedwarn ("conversion to non-const `%T' from rvalue `%T'",
reftype, intype);
}
else if (! (convtype & CONV_CONST))
{
if (! TYPE_READONLY (ttl) && TYPE_READONLY (ttr))
cp_pedwarn (ec_conversion_from_to_discards_const,
cp_pedwarn ("conversion from `%T' to `%T' discards const",
ttr, reftype);
else if (! TYPE_VOLATILE (ttl) && TYPE_VOLATILE (ttr))
cp_pedwarn (ec_conversion_from_to_discards_volatile,
cp_pedwarn ("conversion from `%T' to `%T' discards volatile",
ttr, reftype);
}
}
......@@ -485,7 +485,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
meant. */
if (TREE_CODE (intype) == POINTER_TYPE
&& (comptypes (TREE_TYPE (intype), type, -1)))
cp_warning (ec_casting_to_does_not_dereference_pointer,
cp_warning ("casting `%T' to `%T' does not dereference pointer",
intype, reftype);
rval = build_unary_op (ADDR_EXPR, expr, 0);
......@@ -504,7 +504,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
rval = build_up_reference (reftype, rval, flags, 1);
if (rval && ! TYPE_READONLY (TREE_TYPE (reftype)))
cp_pedwarn (ec_initializing_nonconst_with_will_use_a_temporary,
cp_pedwarn ("initializing non-const `%T' with `%T' will use a temporary",
reftype, intype);
}
......@@ -517,7 +517,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
my_friendly_assert (TREE_CODE (intype) != OFFSET_TYPE, 189);
if (flags & LOOKUP_COMPLAIN)
cp_error (ec_cannot_convert_type_to_type, intype, reftype);
cp_error ("cannot convert type `%T' to type `%T'", intype, reftype);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
......@@ -592,11 +592,11 @@ convert_pointer_to_real (binfo, expr)
but if it is, give them an error message that they can read. */
if (distance < 0)
{
cp_error (ec_cannot_convert_a_pointer_of_type_to_a_pointer_of_type,
cp_error ("cannot convert a pointer of type `%T' to a pointer of type `%T'",
intype, type);
if (distance == -2)
cp_error (ec_because_is_an_ambiguous_base_class, type);
cp_error ("because `%T' is an ambiguous base class", type);
return error_mark_node;
}
......@@ -704,7 +704,7 @@ ocp_convert (type, expr, convtype, flags)
&& ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC))
|| (TREE_CODE (intype) == POINTER_TYPE)))
{
cp_pedwarn (ec_conversion_from_to, intype, type);
cp_pedwarn ("conversion from `%#T' to `%#T'", intype, type);
if (flag_pedantic_errors)
return error_mark_node;
......@@ -716,7 +716,7 @@ ocp_convert (type, expr, convtype, flags)
if (rval)
return rval;
if (flags & LOOKUP_COMPLAIN)
cp_error (ec_used_where_a_was_expected, intype, type);
cp_error ("`%#T' used where a `%T' was expected", intype, type);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
return error_mark_node;
......@@ -726,7 +726,7 @@ ocp_convert (type, expr, convtype, flags)
/* Common Ada/Pascal programmer's mistake. We always warn
about this since it is so bad. */
if (TREE_CODE (expr) == FUNCTION_DECL)
cp_warning (ec_the_address_of_will_always_be_true, expr);
cp_warning ("the address of `%D', will always be `true'", expr);
return truthvalue_conversion (e);
}
return fold (convert_to_integer (type, e));
......@@ -744,7 +744,7 @@ ocp_convert (type, expr, convtype, flags)
return rval;
else
if (flags & LOOKUP_COMPLAIN)
cp_error (ec_used_where_a_floating_point_value_was_expected,
cp_error ("`%#T' used where a floating point value was expected",
TREE_TYPE (e));
}
if (code == REAL_TYPE)
......@@ -818,7 +818,7 @@ ocp_convert (type, expr, convtype, flags)
return e;
if (flags & LOOKUP_COMPLAIN)
cp_error (ec_conversion_from_to_nonscalar_type_requested,
cp_error ("conversion from `%T' to non-scalar type `%T' requested",
TREE_TYPE (expr), type);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
......@@ -948,7 +948,7 @@ build_expr_type_conversion (desires, expr, complain)
if (expr == null_node
&& (desires & WANT_INT)
&& !(desires & WANT_NULL))
cp_warning (ec_converting_null_to_nonpointer_type);
cp_warning ("converting NULL to non-pointer type");
if (TREE_CODE (basetype) == OFFSET_TYPE)
expr = resolve_offset_ref (expr);
......@@ -1021,9 +1021,9 @@ build_expr_type_conversion (desires, expr, complain)
{
if (complain)
{
cp_error (ec_ambiguous_default_type_conversion_from,
cp_error ("ambiguous default type conversion from `%T'",
basetype);
cp_error (ec_candidate_conversions_include_and,
cp_error (" candidate conversions include `%D' and `%D'",
winner, cand);
}
return error_mark_node;
......
......@@ -23,7 +23,6 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "toplev.h"
#include "cp-tree.h"
/* 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
......@@ -38,36 +37,10 @@ extern cp_printer * cp_printers[256];
when we're computing the conversion costs for a method call. */
int cp_silent = 0;
/* The error messages themselves. */
typedef struct cp_err_msg {
/* The format of the error message. */
char* format;
/* The code which we should check when deciding whether or not to
issue this message. Used to indicate that some errors are "the
same" even though they have different formats. */
error_code equiv_code;
/* A count of how many more times this warning has been enabled than
disabled. (Ignored for errors.) */
int enabled;
} cp_err_msg;
static cp_err_msg err_msgs[] = {
#undef DEFERROR
#undef DEFERRORNUM
#define DEFERROR(code, format) DEFERRORNUM(code, format, code)
#define DEFERRORNUM(code, format, equiv_code) \
{ format, equiv_code, 1 },
#include "cp-error.def"
{ 0, 0, 0 }
};
typedef void errorfn (); /* deliberately vague */
extern char* cp_file_of PROTO((tree));
extern int cp_line_of PROTO((tree));
static int is_warning_enabled PROTO((error_code));
#define STRDUP(f) (ap = (char *) alloca (strlen (f) +1), strcpy (ap, (f)), ap)
......@@ -76,13 +49,13 @@ static int is_warning_enabled PROTO((error_code));
#ifdef __STDC__
static void
cp_thing (errorfn *errfn, int atarg1, error_code ec, va_list ap)
cp_thing (errorfn *errfn, int atarg1, const char *format, va_list ap)
#else
static void
cp_thing (errfn, atarg1, ec, ap)
cp_thing (errfn, atarg1, format, ap)
errorfn *errfn;
int atarg1;
error_code ec;
const char *format;
va_list ap;
#endif
{
......@@ -93,29 +66,14 @@ cp_thing (errfn, atarg1, ec, ap)
long offset;
const char *f;
tree atarg = 0;
char* format;
my_friendly_assert ((int) ec >= 0 && (int) ec < ec_last_error_code,
0);
format = err_msgs[(int) ec].format;
my_friendly_assert (format != 0, 0);
len = strlen (format) + 1 /* '\0' */ + 16 /* code number */;
len = strlen (format) + 1;
if (len > buflen)
{
buflen = len;
buf = xrealloc (buf, buflen);
}
if (flag_diag_codes)
{
sprintf (buf, "[%d] ", (int) ec);
for (offset = 0; buf[offset]; ++offset)
;
}
else
offset = 0;
offset = 0;
for (f = format; *f; ++f)
{
......@@ -240,10 +198,10 @@ cp_thing (errfn, atarg1, ec, ap)
}
#ifdef __STDC__
#define DECLARE(name) void name (error_code ec, ...)
#define INIT va_start (ap, ec)
#define DECLARE(name) void name (const char *format, ...)
#define INIT va_start (ap, format)
#else
#define DECLARE(name) void name (ec, va_alist) error_code ec; va_dcl
#define DECLARE(name) void name (format, va_alist) char *format; va_dcl
#define INIT va_start (ap)
#endif
......@@ -252,7 +210,7 @@ DECLARE (cp_error)
va_list ap;
INIT;
if (! cp_silent)
cp_thing ((errorfn *) error, 0, ec, ap);
cp_thing ((errorfn *) error, 0, format, ap);
va_end (ap);
}
......@@ -260,8 +218,8 @@ DECLARE (cp_warning)
{
va_list ap;
INIT;
if (! cp_silent && is_warning_enabled (ec))
cp_thing ((errorfn *) warning, 0, ec, ap);
if (! cp_silent)
cp_thing ((errorfn *) warning, 0, format, ap);
va_end (ap);
}
......@@ -269,8 +227,8 @@ DECLARE (cp_pedwarn)
{
va_list ap;
INIT;
if (! cp_silent && is_warning_enabled (ec))
cp_thing ((errorfn *) pedwarn, 0, ec, ap);
if (! cp_silent)
cp_thing ((errorfn *) pedwarn, 0, format, ap);
va_end (ap);
}
......@@ -280,7 +238,7 @@ DECLARE (cp_compiler_error)
va_list ap;
INIT;
if (! cp_silent)
cp_thing (compiler_error, 0, ec, ap);
cp_thing (compiler_error, 0, format, ap);
va_end (ap);
}
......@@ -288,7 +246,7 @@ DECLARE (cp_sprintf)
{
va_list ap;
INIT;
cp_thing ((errorfn *) sprintf, 0, ec, ap);
cp_thing ((errorfn *) sprintf, 0, format, ap);
va_end (ap);
}
......@@ -297,7 +255,7 @@ DECLARE (cp_error_at)
va_list ap;
INIT;
if (! cp_silent)
cp_thing ((errorfn *) error_with_file_and_line, 1, ec, ap);
cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap);
va_end (ap);
}
......@@ -305,8 +263,8 @@ DECLARE (cp_warning_at)
{
va_list ap;
INIT;
if (! cp_silent && is_warning_enabled (ec))
cp_thing ((errorfn *) warning_with_file_and_line, 1, ec, ap);
if (! cp_silent)
cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap);
va_end (ap);
}
......@@ -314,42 +272,7 @@ DECLARE (cp_pedwarn_at)
{
va_list ap;
INIT;
if (! cp_silent && is_warning_enabled (ec))
cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, ec, ap);
if (! cp_silent)
cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap);
va_end (ap);
}
/* If ON is non-zero, enable the warning with the indicated NUMBER.
If OFF is zero, disable it. Actually, this function manipulates a
counter, so that enabling/disabling of warnings can nest
appropriately. */
void
cp_enable_warning (number, on)
int number;
int on;
{
if (number < 0 || number > (int) ec_last_error_code)
error ("invalid warning number %d", number);
else if (on)
err_msgs[number].enabled++;
else
{
if (!err_msgs[number].enabled)
warning ("warning %d not enabled", number);
else
err_msgs[number].enabled--;
}
}
/* Returns non-zero if EC corresponds to an enabled error message. */
int
is_warning_enabled (ec)
error_code ec;
{
my_friendly_assert ((int) ec >= 0 && (int) ec < ec_last_error_code,
0);
return err_msgs[(int) ec].enabled;
}
......@@ -633,7 +633,7 @@ process_start_catch_block_old (declspecs, declarator)
decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
if (decl == NULL_TREE)
cp_error (ec_invalid_catch_parameter);
error ("invalid catch parameter");
}
if (decl)
......@@ -745,7 +745,7 @@ process_start_catch_block (declspecs, declarator)
decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
if (decl == NULL_TREE)
cp_error (ec_invalid_catch_parameter);
error ("invalid catch parameter");
}
if (decl)
......@@ -1173,7 +1173,7 @@ expand_throw (exp)
exp = build_modify_expr (object, INIT_EXPR, exp);
if (exp == error_mark_node)
cp_error (ec_in_thrown_expression);
error (" in thrown expression");
expand_expr (exp, const0_rtx, VOIDmode, 0);
expand_eh_region_end (build_terminate_handler ());
......@@ -1277,7 +1277,7 @@ build_throw (e)
return build_min (THROW_EXPR, void_type_node, e);
if (e == null_node)
cp_warning (ec_throwing_which_has_integral_not_pointer_type);
cp_warning ("throwing NULL, which has integral, not pointer type");
e = build1 (THROW_EXPR, void_type_node, e);
TREE_SIDE_EFFECTS (e) = 1;
......
......@@ -331,10 +331,10 @@ do_case (start, end)
if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE
&& POINTER_TYPE_P (TREE_TYPE (start)))
cp_error (ec_pointers_are_not_permitted_as_case_values);
error ("pointers are not permitted as case values");
if (end && pedantic)
cp_pedwarn (ec_forbids_range_expressions_in_switch_statement);
pedwarn ("ANSI C++ forbids range expressions in switch statement");
if (processing_template_decl)
{
......@@ -366,43 +366,43 @@ do_case (start, end)
if (success == 1)
{
if (end)
cp_error (ec_case_label_not_within_a_switch_statement);
error ("case label not within a switch statement");
else if (start)
cp_error (ec_case_label_not_within_a_switch_statement, start);
cp_error ("case label `%E' not within a switch statement", start);
else
cp_error (ec_default_label_not_within_a_switch_statement);
error ("default label not within a switch statement");
}
else if (success == 2)
{
if (end)
{
cp_error (ec_duplicate_or_overlapping_case_value);
cp_error_at (ec_this_is_the_first_entry_overlapping_that_value,
error ("duplicate (or overlapping) case value");
cp_error_at ("this is the first entry overlapping that value",
duplicate);
}
else if (start)
{
cp_error (ec_duplicate_case_value, start);
cp_error_at (ec_previously_used_here, duplicate);
cp_error ("duplicate case value `%E'", start);
cp_error_at ("previously used here", duplicate);
}
else
{
cp_error (ec_multiple_default_labels_in_one_switch);
cp_error_at (ec_this_is_the_first_default_label, duplicate);
error ("multiple default labels in one switch");
cp_error_at ("this is the first default label", duplicate);
}
}
else if (success == 3)
cp_warning (ec_case_value_out_of_range);
warning ("case value out of range");
else if (success == 4)
cp_warning (ec_empty_range_specified);
warning ("empty range specified");
else if (success == 5)
{
if (end)
cp_error (ec_case_label_within_scope_of_cleanup_or_variable_array);
error ("case label within scope of cleanup or variable array");
else if (! start)
cp_error (ec_default_label_within_scope_of_cleanup_or_variable_array);
error ("`default' label within scope of cleanup or variable array");
else
cp_error (ec_case_label_within_scope_of_cleanup_or_variable_array, start);
cp_error ("case label `%E' within scope of cleanup or variable array", start);
}
}
if (start)
......
......@@ -155,9 +155,9 @@ add_friend (type, decl)
{
if (decl == TREE_VALUE (friends))
{
cp_warning (ec_is_already_a_friend_of_class,
cp_warning ("`%D' is already a friend of class `%T'",
decl, type);
cp_warning_at (ec_previous_friend_declaration_of,
cp_warning_at ("previous friend declaration of `%D'",
TREE_VALUE (friends));
return;
}
......@@ -205,11 +205,11 @@ add_friends (type, name, friend_type)
if (friends)
{
if (friend_type)
cp_warning (ec_method_ss_is_already_a_friend_of_class,
warning ("method `%s::%s' is already a friend of class",
TYPE_NAME_STRING (friend_type),
IDENTIFIER_POINTER (name));
else
cp_warning (ec_function_s_is_already_a_friend_of_class_s,
warning ("function `%s' is already a friend of class `%s'",
IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (DECL_NAME (typedecl)));
}
......@@ -252,12 +252,12 @@ make_friend_class (type, friend_type)
if (IS_SIGNATURE (type))
{
cp_error (ec_friend_declaration_in_signature_definition);
error ("`friend' declaration in signature definition");
return;
}
if (IS_SIGNATURE (friend_type))
{
cp_error (ec_signature_type_s_declared_friend,
error ("signature type `%s' declared `friend'",
IDENTIFIER_POINTER (TYPE_IDENTIFIER (friend_type)));
return;
}
......@@ -269,7 +269,7 @@ make_friend_class (type, friend_type)
Friend declarations shall not declare partial
specializations. */
cp_error (ec_partial_specialization_declared_friend,
cp_error ("partial specialization `%T' declared `friend'",
friend_type);
return;
}
......@@ -281,7 +281,7 @@ make_friend_class (type, friend_type)
is_template_friend = 1;
else if (comptypes (type, friend_type, 1))
{
cp_pedwarn (ec_class_s_is_implicitly_friends_with_itself,
pedwarn ("class `%s' is implicitly friends with itself",
TYPE_NAME_STRING (type));
return;
}
......@@ -301,7 +301,7 @@ make_friend_class (type, friend_type)
comptypes (TREE_VALUE (classes), friend_type, 1)))
classes = TREE_CHAIN (classes);
if (classes)
cp_warning (ec_is_already_a_friend_of,
cp_warning ("`%T' is already a friend of `%T'",
TREE_VALUE (classes), type);
else
{
......@@ -384,7 +384,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
TYPE_SIZE (ctype) || template_class_depth (ctype) > 0)
add_friend (current_class_type, decl);
else
cp_error (ec_member_declared_as_friend_before_type_defined,
cp_error ("member `%D' declared as friend before type `%T' defined",
decl, ctype);
}
}
......@@ -399,7 +399,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
if (fields)
add_friends (current_class_type, declarator, ctype);
else
cp_error (ec_method_is_not_a_member_of_class,
cp_error ("method `%D' is not a member of class `%T'",
declarator, ctype);
decl = void_type_node;
}
......@@ -452,14 +452,14 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
&& current_template_parms && uses_template_parms (decl))
{
static int explained;
cp_warning (ec_friend_declaration, decl);
cp_warning (ec_declares_a_nontemplate_function);
cp_warning ("friend declaration `%#D'", decl);
warning (" declares a non-template function");
if (! explained)
{
cp_warning (ec_if_this_is_not_what_you_intended_make_sure);
cp_warning (ec_the_function_template_has_already_been_declared);
cp_warning (ec_and_add_after_the_function_name_here);
cp_warning (ec_o_disable_warning_use_nonontemplatefriend);
warning (" (if this is not what you intended, make sure");
warning (" the function template has already been declared,");
warning (" and add <> after the function name here)");
warning (" To disable warning use -Wno-non-template-friend");
explained = 1;
}
}
......@@ -477,7 +477,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
tree decl = lookup_name_nonclass (declarator);
if (decl == NULL_TREE)
{
cp_warning (ec_implicitly_declaring_as_struct, declarator);
cp_warning ("implicitly declaring `%T' as struct", declarator);
decl = xref_tag (record_type_node, declarator, 1);
decl = TYPE_MAIN_DECL (decl);
}
......@@ -486,7 +486,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
but not if those functions are really class names. */
if (TREE_CODE (decl) == TREE_LIST && TREE_TYPE (TREE_PURPOSE (decl)))
{
cp_warning (ec_friend_archaic_use_friend_class_instead,
cp_warning ("`friend %T' archaic, use `friend class %T' instead",
declarator, declarator);
decl = TREE_TYPE (TREE_PURPOSE (decl));
}
......
......@@ -101,8 +101,6 @@ DEFINE_LANG_NAME ("C++")
{ "-fno-weak", "" },
{ "-fxref", "Emit cross referencing information" },
{ "-fno-xref", "" },
{ "-fdiag-codes", "Show code numbers when printing diagnostics" },
{ "-fno-diag-codes", "" },
{ "-Wreturn-type", "Warn about inconsistent return types" },
{ "-Wno-return-type", "" },
......@@ -128,6 +126,4 @@ DEFINE_LANG_NAME ("C++")
{ "-Wno-old-style-cast", "" },
{ "-Wnon-template-friend", "" },
{ "-Wno-non-template-friend", "Don't warn when non-templatized friend functions are declared within a template" },
{ "-Wnumber-" },
{ "-Wno-number-" },
......@@ -679,7 +679,7 @@ build_overload_value (type, value, in_template)
REAL_VALUE_TYPE val;
char *bufp = digit_buffer;
cp_pedwarn (ec_forbids_floatingpoint_template_arguments);
pedwarn ("ANSI C++ forbids floating-point template arguments");
my_friendly_assert (TREE_CODE (value) == REAL_CST, 244);
val = TREE_REAL_CST (value);
......@@ -1814,12 +1814,12 @@ hack_identifier (value, name)
#ifdef DEAD
if (DECL_CHAIN (fndecl) == NULL_TREE)
{
cp_warning (ec_methods_cannot_be_converted_to_function_pointers);
warning ("methods cannot be converted to function pointers");
return fndecl;
}
else
{
cp_error (ec_ambiguous_request_for_method_pointer_s,
error ("ambiguous request for method pointer `%s'",
IDENTIFIER_POINTER (name));
return error_mark_node;
}
......@@ -1840,13 +1840,13 @@ hack_identifier (value, name)
{
if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
cp_error (ec_invalid_use_of_member_in_static_member_function,
cp_error ("invalid use of member `%D' in static member function",
value);
else
/* We can get here when processing a bad default
argument, like:
struct S { int a; void f(int i = a); } */
cp_error (ec_invalid_use_of_member, value);
cp_error ("invalid use of member `%D'", value);
return error_mark_node;
}
......@@ -1887,12 +1887,12 @@ hack_identifier (value, name)
}
else if (TREE_CODE (value) == NAMESPACE_DECL)
{
cp_error (ec_use_of_namespace_as_expression, value);
cp_error ("use of namespace `%D' as expression", value);
return error_mark_node;
}
else if (DECL_CLASS_TEMPLATE_P (value))
{
cp_error (ec_use_of_class_template_as_expression, value);
cp_error ("use of class template `%T' as expression", value);
return error_mark_node;
}
else
......@@ -1904,10 +1904,10 @@ hack_identifier (value, name)
if (context != NULL_TREE && context != current_function_decl
&& ! TREE_STATIC (value))
{
cp_error (ec_use_of_s_from_containing_function,
cp_error ("use of %s from containing function",
(TREE_CODE (value) == VAR_DECL
? "`auto' variable" : "parameter"));
cp_error_at (ec_declared_here, value);
cp_error_at (" `%#D' declared here", value);
value = error_mark_node;
}
}
......@@ -1930,12 +1930,12 @@ hack_identifier (value, name)
if (access != access_public_node)
{
if (TREE_CODE (value) == VAR_DECL)
cp_error (ec_static_member_s_is_s,
error ("static member `%s' is %s",
IDENTIFIER_POINTER (name),
TREE_PRIVATE (value) ? "private"
: "from a private base class");
else
cp_error (ec_enum_s_is_from_private_base_class,
error ("enum `%s' is from private base class",
IDENTIFIER_POINTER (name));
return error_mark_node;
}
......@@ -1946,7 +1946,7 @@ hack_identifier (value, name)
{
if (type == 0)
{
cp_error (ec_request_for_member_s_is_ambiguous_in_multiple_inheritance_lattice,
error ("request for member `%s' is ambiguous in multiple inheritance lattice",
IDENTIFIER_POINTER (name));
return error_mark_node;
}
......@@ -1992,7 +1992,7 @@ make_thunk (function, delta)
thunk = IDENTIFIER_GLOBAL_VALUE (thunk_id);
if (thunk && TREE_CODE (thunk) != THUNK_DECL)
{
cp_error (ec_implementationreserved_name_used, thunk_id);
cp_error ("implementation-reserved name `%D' used", thunk_id);
thunk = NULL_TREE;
SET_IDENTIFIER_GLOBAL_VALUE (thunk_id, thunk);
}
......@@ -2061,7 +2061,7 @@ emit_thunk (thunk_fndecl)
tree a, t;
if (varargs_function_p (function))
cp_error (ec_generic_thunk_code_fails_for_method_which_uses,
cp_error ("generic thunk code fails for method `%#D' which uses `...'",
function);
/* Set up clone argument trees for the thunk. */
......@@ -2173,7 +2173,7 @@ do_build_copy_constructor (fndecl)
p = convert_from_reference (p);
if (p == error_mark_node)
cp_error (ec_in_default_copy_constructor);
cp_error ("in default copy constructor");
else
current_base_init_list = tree_cons (basetype,
p, current_base_init_list);
......@@ -2191,7 +2191,7 @@ do_build_copy_constructor (fndecl)
CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE);
if (p == error_mark_node)
cp_error (ec_in_default_copy_constructor);
cp_error ("in default copy constructor");
else
{
p = convert_from_reference (p);
......@@ -2299,17 +2299,17 @@ do_build_assign_ref (fndecl)
if (TREE_READONLY (field))
{
if (DECL_NAME (field))
cp_error (ec_nonstatic_const_member_cant_use_default_assignment_operator, field);
cp_error ("non-static const member `%#D', can't use default assignment operator", field);
else
cp_error (ec_nonstatic_const_member_in_type_cant_use_default_assignment_operator, current_class_type);
cp_error ("non-static const member in type `%T', can't use default assignment operator", current_class_type);
continue;
}
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
{
if (DECL_NAME (field))
cp_error (ec_nonstatic_reference_member_cant_use_default_assignment_operator, field);
cp_error ("non-static reference member `%#D', can't use default assignment operator", field);
else
cp_error (ec_nonstatic_reference_member_in_type_cant_use_default_assignment_operator, current_class_type);
cp_error ("non-static reference member in type `%T', can't use default assignment operator", current_class_type);
continue;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -254,7 +254,7 @@ get_base_filename (filename)
if (p && ! compiling)
{
cp_warning (ec_frepo_must_be_used_with_c);
warning ("-frepo must be used with -c");
flag_use_repository = 0;
return NULL;
}
......@@ -344,7 +344,7 @@ init_repo (filename)
}
break;
default:
cp_error (ec_mysterious_repository_information_in_s, repo_name);
error ("mysterious repository information in %s", repo_name);
}
obstack_free (&temporary_obstack, buf);
}
......@@ -359,7 +359,7 @@ reopen_repo_file_for_write ()
if (repo_file == 0)
{
cp_error (ec_cant_create_repository_information_file_s, repo_name);
error ("can't create repository information file `%s'", repo_name);
flag_use_repository = 0;
}
}
......
......@@ -101,7 +101,7 @@ build_headof (exp)
if (TREE_CODE (type) != POINTER_TYPE)
{
cp_error (ec_headof_applied_to_nonpointer_type);
error ("`headof' applied to non-pointer type");
return error_mark_node;
}
type = TREE_TYPE (type);
......@@ -190,7 +190,7 @@ get_tinfo_fn_dynamic (exp)
if (type_unknown_p (exp))
{
cp_error (ec_typeid_of_overloaded_function);
error ("typeid of overloaded function");
return error_mark_node;
}
......@@ -211,7 +211,7 @@ get_tinfo_fn_dynamic (exp)
if (! flag_rtti)
{
cp_warning (ec_taking_dynamic_typeid_of_object_without_frtti);
warning ("taking dynamic typeid of object without -frtti");
push_obstacks (&permanent_obstack, &permanent_obstack);
init_rtti_processing ();
pop_obstacks ();
......@@ -401,7 +401,7 @@ get_typeid (type)
if (! flag_rtti)
{
cp_warning (ec_requesting_typeid_of_object_without_frtti);
warning ("requesting typeid of object without -frtti");
push_obstacks (&permanent_obstack, &permanent_obstack);
init_rtti_processing ();
pop_obstacks ();
......@@ -554,7 +554,7 @@ build_dynamic_cast_1 (type, expr)
if (TREE_CODE (expr) == VAR_DECL
&& TREE_CODE (TREE_TYPE (expr)) == RECORD_TYPE)
{
cp_warning (ec_dynamic_cast_of_to_can_never_succeed,
cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
expr, type);
return throw_bad_cast ();
}
......@@ -566,7 +566,7 @@ build_dynamic_cast_1 (type, expr)
if (TREE_CODE (op) == VAR_DECL
&& TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
{
cp_warning (ec_dynamic_cast_of_to_can_never_succeed,
cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
expr, type);
retval = build_int_2 (0, 0);
TREE_TYPE (retval) = type;
......@@ -650,7 +650,7 @@ build_dynamic_cast_1 (type, expr)
}
fail:
cp_error (ec_cannot_dynamic_cast_of_type_to_type,
cp_error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T'",
expr, exprtype, type);
return error_mark_node;
}
......
......@@ -278,13 +278,13 @@ get_binfo (parent, binfo, protect)
if (dist == -3)
{
cp_error (ec_fields_of_are_inaccessible_in_due_to_private_inheritance,
cp_error ("fields of `%T' are inaccessible in `%T' due to private inheritance",
parent, type);
return error_mark_node;
}
else if (dist == -2 && protect)
{
cp_error (ec_type_is_ambiguous_base_class_for_type, parent,
cp_error ("type `%T' is ambiguous base class for type `%T'", parent,
type);
return error_mark_node;
}
......@@ -884,7 +884,7 @@ lookup_field (xbasetype, name, protect, want_type)
we know that binfo of a virtual base class will always == itself when
found along any line. (mrs) */
error_code ec = ec_last_error_code;
char *errstr = 0;
#if 0
/* We cannot search for constructor/destructor names like this. */
......@@ -952,10 +952,20 @@ lookup_field (xbasetype, name, protect, want_type)
{
if (TREE_PRIVATE (rval) | TREE_PROTECTED (rval))
this_v = compute_access (basetype_path, rval);
if (this_v == access_private_node)
ec = ec_private_in_class;
else if (this_v == access_protected_node)
ec = ec_protected_in_class;
if (TREE_CODE (rval) == CONST_DECL)
{
if (this_v == access_private_node)
errstr = "enum `%D' is a private value of class `%T'";
else if (this_v == access_protected_node)
errstr = "enum `%D' is a protected value of class `%T'";
}
else
{
if (this_v == access_private_node)
errstr = "member `%D' is a private member of class `%T'";
else if (this_v == access_protected_node)
errstr = "member `%D' is a protected member of class `%T'";
}
}
rval_binfo = basetype_path;
......@@ -1064,7 +1074,7 @@ lookup_field (xbasetype, name, protect, want_type)
else
{
/* This is ambiguous. */
ec = ec_ambiguous_member;
errstr = "request for member `%D' is ambiguous";
protect += 2;
break;
}
......@@ -1099,10 +1109,10 @@ lookup_field (xbasetype, name, protect, want_type)
}
if (rval == NULL_TREE)
ec = ec_last_error_code;
errstr = 0;
/* If this FIELD_DECL defines its own access level, deal with that. */
if (rval && ec == ec_last_error_code
if (rval && errstr == 0
&& (protect & 1)
&& DECL_LANG_SPECIFIC (rval)
&& DECL_ACCESS (rval))
......@@ -1118,7 +1128,7 @@ lookup_field (xbasetype, name, protect, want_type)
new_v = compute_access (TREE_VALUE (TREE_CHAIN (*tp)), rval);
if (this_v != access_default_node && new_v != this_v)
{
ec = ec_conflicting_access;
errstr = "conflicting access to member `%D'";
this_v = access_default_node;
}
own_access = new_v;
......@@ -1137,18 +1147,20 @@ lookup_field (xbasetype, name, protect, want_type)
}
search_stack = pop_search_level (search_stack);
if (ec == ec_last_error_code)
if (errstr == 0)
{
if (own_access == access_private_node)
ec = ec_member_private;
errstr = "member `%D' declared private";
else if (own_access == access_protected_node)
ec = ec_member_protected;
errstr = "member `%D' declared protected";
else if (this_v == access_private_node)
ec = TREE_PRIVATE (rval)
? ec_member_private : ec_member_in_private_base;
errstr = TREE_PRIVATE (rval)
? "member `%D' is private"
: "member `%D' is from private base class";
else if (this_v == access_protected_node)
ec = TREE_PROTECTED (rval)
? ec_member_protected : ec_member_in_protected_base;
errstr = TREE_PROTECTED (rval)
? "member `%D' is protected"
: "member `%D' is from protected base class";
}
out:
......@@ -1160,9 +1172,9 @@ lookup_field (xbasetype, name, protect, want_type)
protect = 0;
}
if (ec != ec_last_error_code && protect)
if (errstr && protect)
{
cp_error (ec, name, type);
cp_error (errstr, name, type);
rval = error_mark_node;
}
......@@ -1231,7 +1243,7 @@ lookup_nested_field (name, complain)
enums in nested classes) when we do need to call
this fn at parse time. So, in those cases, we pass
complain as a 0 and just return a NULL_TREE. */
cp_error (ec_assignment_to_nonstatic_member_of_enclosing_class,
cp_error ("assignment to non-static member `%D' of enclosing class `%T'",
id, DECL_CONTEXT (t));
/* Mark this for do_identifier(). It would otherwise
claim that the variable was undeclared. */
......@@ -1355,7 +1367,7 @@ lookup_fnfields (basetype_path, name, complain)
/* For now, don't try this. */
int protect = complain;
error_code ec = ec_last_error_code;
char *errstr = 0;
if (complain == -1)
{
......@@ -1512,7 +1524,7 @@ lookup_fnfields (basetype_path, name, complain)
else
{
/* This is ambiguous. */
ec = ec_ambiguous_member;
errstr = "request for method `%D' is ambiguous";
rvals = error_mark_node;
break;
}
......@@ -1530,9 +1542,9 @@ lookup_fnfields (basetype_path, name, complain)
}
search_stack = pop_search_level (search_stack);
if (ec != ec_last_error_code && protect)
if (errstr && protect)
{
cp_error (ec, name);
cp_error (errstr, name);
rvals = error_mark_node;
}
......@@ -1842,21 +1854,21 @@ get_matching_virtual (binfo, fndecl, dtorp)
if (pedantic && i == -1)
{
cp_pedwarn_at (ec_invalid_covariant_return_type_for_must_be_pointer_or_reference_to_class, fndecl);
cp_pedwarn_at (ec_overriding, tmp);
cp_pedwarn_at ("invalid covariant return type for `%#D' (must be pointer or reference to class)", fndecl);
cp_pedwarn_at (" overriding `%#D'", tmp);
}
}
else if (IS_AGGR_TYPE_2 (brettype, drettype)
&& comptypes (brettype, drettype, 0))
{
cp_error (ec_invalid_covariant_return_type_must_use_pointer_or_reference);
cp_error_at (ec_overriding, tmp);
cp_error_at (ec_with, fndecl);
error ("invalid covariant return type (must use pointer or reference)");
cp_error_at (" overriding `%#D'", tmp);
cp_error_at (" with `%#D'", fndecl);
}
else if (IDENTIFIER_ERROR_LOCUS (name) == NULL_TREE)
{
cp_error_at (ec_conflicting_return_type_specified_for_virtual_function, fndecl);
cp_error_at (ec_overriding_definition_as, tmp);
cp_error_at ("conflicting return type specified for virtual function `%#D'", fndecl);
cp_error_at (" overriding definition as `%#D'", tmp);
SET_IDENTIFIER_ERROR_LOCUS (name, basetype);
}
break;
......@@ -2434,7 +2446,7 @@ virtual_context (fndecl, t, vbase)
}
}
/* This shouldn't happen, I don't want errors! */
cp_warning (ec_recoverable_compiler_error_fixups_for_virtual_function);
warning ("recoverable compiler error, fixups for virtual function");
return vbase;
}
while (path)
......@@ -2697,7 +2709,7 @@ expand_indirect_vtbls_init (binfo, true_exp, decl_ptr)
tree in_charge_node = lookup_name (in_charge_identifier, 0);
if (! in_charge_node)
{
cp_warning (ec_recoverable_internal_compiler_error_nobodys_in_charge);
warning ("recoverable internal compiler error, nobody's in charge!");
in_charge_node = integer_zero_node;
}
in_charge_node = build_binary_op (EQ_EXPR, in_charge_node, integer_zero_node, 1);
......@@ -2825,9 +2837,9 @@ envelope_add_decl (type, decl, values)
|| ! TREE_PRIVATE (value)))
/* Should figure out access control more accurately. */
{
cp_warning_at (ec_member_is_shadowed, value);
cp_warning_at (ec_by_member_function, decl);
cp_warning (ec_in_this_context);
cp_warning_at ("member `%#D' is shadowed", value);
cp_warning_at ("by member function `%#D'", decl);
warning ("in this context");
}
context = DECL_REAL_CONTEXT (value);
......
......@@ -453,7 +453,7 @@ finish_break_stmt ()
if (processing_template_decl)
add_tree (build_min_nt (BREAK_STMT));
else if ( ! expand_exit_something ())
cp_error (ec_break_statement_not_within_loop_or_switch);
cp_error ("break statement not within loop or switch");
}
/* Finish a continue-statement. */
......@@ -465,7 +465,7 @@ finish_continue_stmt ()
if (processing_template_decl)
add_tree (build_min_nt (CONTINUE_STMT));
else if (! expand_continue_loop (0))
cp_error (ec_continue_statement_not_within_a_loop);
cp_error ("continue statement not within a loop");
}
/* Begin a switch-statement. */
......@@ -735,7 +735,7 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
{
if (cv_qualifier != NULL_TREE
&& cv_qualifier != ridpointers[(int) RID_VOLATILE])
cp_warning (ec_qualifier_ignored_on_asm,
cp_warning ("%s qualifier ignored on asm",
IDENTIFIER_POINTER (cv_qualifier));
c_expand_asm_operands (string, output_operands,
......@@ -748,7 +748,7 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
else
{
if (cv_qualifier != NULL_TREE)
cp_warning (ec_qualifier_ignored_on_asm,
cp_warning ("%s qualifier ignored on asm",
IDENTIFIER_POINTER (cv_qualifier));
expand_asm (string);
}
......@@ -895,15 +895,15 @@ finish_this_expr ()
else if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
{
cp_error (ec_this_is_unavailable_for_static_member_functions);
error ("`this' is unavailable for static member functions");
result = error_mark_node;
}
else
{
if (current_function_decl)
cp_error (ec_invalid_use_of_this_in_nonmember_function);
error ("invalid use of `this' in non-member function");
else
cp_error (ec_invalid_use_of_this_at_top_level);
error ("invalid use of `this' at top level");
result = error_mark_node;
}
......@@ -941,7 +941,7 @@ finish_object_call_expr (fn, object, args)
fn = DECL_NAME (fn);
else
{
cp_error (ec_calling_type_like_a_method, fn);
cp_error ("calling type `%T' like a method", fn);
return error_mark_node;
}
}
......@@ -961,7 +961,7 @@ finish_qualified_object_call_expr (fn, object, args)
{
if (IS_SIGNATURE (TREE_OPERAND (fn, 0)))
{
cp_warning (ec_signature_name_in_scope_resolution_ignored);
warning ("signature name in scope resolution ignored");
return finish_object_call_expr (TREE_OPERAND (fn, 1), object, args);
}
else
......@@ -980,13 +980,13 @@ finish_pseudo_destructor_call_expr (object, scope, destructor)
tree destructor;
{
if (scope && scope != destructor)
cp_error (ec_destructor_specifier_must_have_matching_names,
cp_error ("destructor specifier `%T::~%T()' must have matching names",
scope, destructor);
if ((scope == NULL_TREE || IDENTIFIER_GLOBAL_VALUE (destructor))
&& (TREE_CODE (TREE_TYPE (object)) !=
TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (destructor)))))
cp_error (ec_is_not_of_type, object, destructor);
cp_error ("`%E' is not of type `%T'", object, destructor);
return cp_convert (void_type_node, object);
}
......@@ -1159,7 +1159,7 @@ finish_template_type_parm (aggr, identifier)
sorry ("signature as template type parameter");
else if (aggr != class_type_node)
{
cp_pedwarn (ec_template_type_parameters_must_use_the_keyword_class_or_typename);
pedwarn ("template type parameters must use the keyword `class' or `typename'");
aggr = class_type_node;
}
......@@ -1459,19 +1459,19 @@ finish_base_specifier (access_specifier, base_class,
if (base_class == NULL_TREE)
{
cp_error (ec_invalid_base_class);
error ("invalid base class");
type = error_mark_node;
}
else
type = TREE_TYPE (base_class);
if (current_aggr_is_signature && access_specifier)
cp_error (ec_access_and_source_specifiers_not_allowed_in_signature);
error ("access and source specifiers not allowed in signature");
if (! is_aggr_type (type, 1))
result = NULL_TREE;
else if (current_aggr_is_signature
&& (! type) && (! IS_SIGNATURE (type)))
{
cp_error (ec_class_name_not_allowed_as_base_signature);
error ("class name not allowed as base signature");
result = NULL_TREE;
}
else if (current_aggr_is_signature)
......@@ -1482,7 +1482,7 @@ finish_base_specifier (access_specifier, base_class,
}
else if (type && IS_SIGNATURE (type))
{
cp_error (ec_signature_name_not_allowed_as_base_class);
error ("signature name not allowed as base class");
result = NULL_TREE;
}
else
......
......@@ -492,7 +492,7 @@ build_signature_table_constructor (sig_ty, rhs)
if (oty_type == NULL_TREE || oty_type == error_mark_node)
{
cp_error (ec_class_does_not_contain_type,
cp_error ("class `%T' does not contain type `%T'",
rhstype, oty_type);
undo_casts (sig_ty);
return error_mark_node;
......@@ -518,7 +518,7 @@ build_signature_table_constructor (sig_ty, rhs)
{
if (! IS_DEFAULT_IMPLEMENTATION (sig_method))
{
cp_error (ec_class_does_not_contain_method,
cp_error ("class `%T' does not contain method `%D'",
rhstype, sig_mname);
undo_casts (sig_ty);
return error_mark_node;
......@@ -549,7 +549,7 @@ build_signature_table_constructor (sig_ty, rhs)
|| (compute_access (basetypes, rhs_method)
!= access_public_node))
{
cp_error (ec_class_s_does_not_contain_a_method_conforming_to_s,
error ("class `%s' does not contain a method conforming to `%s'",
TYPE_NAME_STRING (rhstype),
fndecl_as_string (sig_method, 1));
undo_casts (sig_ty);
......@@ -735,7 +735,7 @@ build_sigtable (sig_type, rhs_type, init_from)
if (SIGNATURE_HAS_OPAQUE_TYPEDECLS (sig_type)
&& SIGTABLE_HAS_BEEN_GENERATED (sig_type))
{
cp_error (ec_signature_with_opaque_type_implemented_by_multiple_classes);
error ("signature with opaque type implemented by multiple classes");
return error_mark_node;
}
SIGTABLE_HAS_BEEN_GENERATED (sig_type) = 1;
......@@ -806,13 +806,13 @@ build_signature_pointer_constructor (lhs, rhs)
&& (IS_SIGNATURE_POINTER (rhstype)
|| IS_SIGNATURE_REFERENCE (rhstype)))))
{
cp_error (ec_invalid_assignment_to_signature_pointer_or_reference);
error ("invalid assignment to signature pointer or reference");
return error_mark_node;
}
if (TYPE_SIZE (sig_ty) == NULL_TREE)
{
cp_error (ec_undefined_signature_used_in_signature_s_declaration,
cp_error ("undefined signature `%T' used in signature %s declaration",
sig_ty,
IS_SIGNATURE_POINTER (lhstype) ? "pointer" : "reference");
return error_mark_node;
......@@ -1018,7 +1018,7 @@ build_signature_method_call (function, parms)
|| (IS_DEFAULT_IMPLEMENTATION (function)
&& (!deflt_call || deflt_call == error_mark_node)))
{
cp_compiler_error (ec_cannot_build_call_of_signature_member_function_s,
compiler_error ("cannot build call of signature member function `%s'",
fndecl_as_string (function, 1));
return error_mark_node;
}
......
......@@ -221,7 +221,7 @@ lvalue_or_else (ref, string)
{
int win = lvalue_p (ref);
if (! win)
cp_error (ec_nonlvalue_in_s, string);
error ("non-lvalue in %s", string);
return win;
}
......@@ -755,7 +755,7 @@ layout_basetypes (rec, max)
my_friendly_assert (TREE_TYPE (field) == basetype, 23897);
if (get_base_distance (basetype, rec, 0, (tree*)0) == -2)
cp_warning (ec_direct_base_inaccessible_in_due_to_ambiguity,
cp_warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
basetype, rec);
BINFO_OFFSET (base_binfo)
......@@ -776,7 +776,7 @@ layout_basetypes (rec, max)
{
tree basetype = BINFO_TYPE (vbase_types);
if (get_base_distance (basetype, rec, 0, (tree*)0) == -2)
cp_warning (ec_virtual_base_inaccessible_in_due_to_ambiguity,
cp_warning ("virtual base `%T' inaccessible in `%T' due to ambiguity",
basetype, rec);
}
}
......@@ -1240,7 +1240,7 @@ binfo_value (elem, type)
tree type;
{
if (get_base_distance (elem, type, 0, (tree *)0) == -2)
cp_compiler_error (ec_base_class_s_ambiguous_in_binfo_value,
compiler_error ("base class `%s' ambiguous in binfo_value",
TYPE_NAME_STRING (elem));
if (elem == type)
return TYPE_BINFO (type);
......
......@@ -832,7 +832,7 @@ open_xref_file(file)
if (xref_file == NULL)
{
cp_error (ec_ant_create_crossreference_file_s, xref_name);
error("Can't create cross-reference file `%s'", xref_name);
doing_xref = 0;
}
}
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