From-SVN: r14852
This commit is contained in:
Jason Merrill 1997-08-19 18:37:19 -04:00
parent 62d65906d6
commit da20811c09
21 changed files with 173 additions and 33 deletions

View File

@ -1,6 +1,80 @@
Thu Aug 14 10:05:13 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
* rtti.c (permanent_obstack): Fix decl to not be a pointer.
* cp-tree.h (report_type_mismatch): Add prototype.
* call.c (build_overload_call_real): Remove erroneous fourth
argument to report_type_mismatch.
(build_user_type_conversion_1): Remove erroneous second arg to
tourney.
(build_new_function_call): Likewise.
(build_object_call): Likewise.
(build_new_op): Likewise.
(build_new_method_call): Likewise.
Wed Aug 13 19:19:25 1997 Jason Merrill <jason@yorick.cygnus.com>
* error.c (dump_decl): Don't bother processing a function with no
DECL_LANG_SPECIFIC.
* method.c (emit_thunk): Call init_function_start in the macro case.
Wed Aug 13 10:46:19 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
* decl2.c (DEFAULT_VTABLE_THUNKS): Define to be 0 if not
defined and used to set flag_vtable_thunks.
Tue Aug 12 20:13:57 1997 Jason Merrill <jason@yorick.cygnus.com>
* parse.y: Don't clear the inlines from their obstack until they've
all been processed.
* decl.c (duplicate_decls): Don't complain about exception
specification mismatch if flag_exceptions is off.
Mon Aug 11 15:01:56 1997 Marc Lehmann <pcg@goof.com>
* Make-lang.in (c++.distclean): Remove g++.c on make distclean.
Sun Aug 10 12:06:09 1997 Paul Eggert <eggert@twinsun.com>
* cp-tree.h: Replace STDIO_PROTO with PROTO in include files.
* cvt.c, error.c, except.c, expr.c, friend.c, init.c, rtti.c:
Include <stdio.h> before include files that formerly used STDIO_PROTO.
* decl.c, g++spec.c, lex.c, method.c, repo.c:
Include "config.h" first, as per autoconf manual.
Fri Aug 8 11:47:48 1997 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (duplicate_decls): Tweak wording.
* lex.c (do_pending_defargs): Don't die if we see a default arg
that isn't a DEFAULT_ARG.
* error.c (dump_expr): Handle DEFAULT_ARG.
* decl2.c (lang_decode_option): Handle -fhandle-exceptions.
* lang-options.h: Add -fhandle-exceptions.
* class.c (build_vtable): vtables are artificial.
(prepare_fresh_vtable): Likewise.
Wed Aug 6 11:02:36 1997 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (ocp_convert): After converting to the target type, set
LOOKUP_NO_CONVERSION.
* call.c (joust): Warn about potentially confusing promotion rules
with -Wsign-promo.
* cp-tree.h, lang-options.h, decl2.c: Support -Wsign-promo.
Tue Aug 5 15:15:07 1997 Michael Meissner <meissner@cygnus.com>
* exception.cc: Declare __terminate_func with noreturn attribute.
Fri Aug 1 03:18:15 1997 Jason Merrill <jason@yorick.cygnus.com>
* parse.y: Break out eat_saved_input, handle errors.
(function_try_block): Use compstmt instead of compstmt_or_error.
Thu Jul 31 17:14:04 1997 Jason Merrill <jason@yorick.cygnus.com>
@ -573,6 +647,8 @@ Mon Apr 21 15:42:27 1997 Jason Merrill <jason@yorick.cygnus.com>
function is not changed.
* call.c (build_over_call): Move setting of conv into the loop.
Note: this change, along with the related changes of the 18th thru
the 20th of April, fix an infinite loop problem in conversions.
Sun Apr 20 16:24:29 1997 Jason Merrill <jason@yorick.cygnus.com>

View File

@ -247,6 +247,7 @@ c++.clean:
c++.distclean:
-rm -f cp/config.status cp/Makefile
-rm -f cp/parse.output
-rm -f g++.c
c++.extraclean:
c++.maintainer-clean:
-rm -f cp/parse.c cp/parse.h

View File

@ -2885,8 +2885,7 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
return NULL_TREE;
if (flags & LOOKUP_COMPLAIN)
report_type_mismatch (cp, parms, "function",
decl_as_string (cp->function, 1));
report_type_mismatch (cp, parms, "function");
return error_mark_node;
}
@ -4287,7 +4286,7 @@ build_user_type_conversion_1 (totype, expr, flags)
}
candidates = splice_viable (candidates);
cand = tourney (candidates, totype);
cand = tourney (candidates);
if (cand == 0)
{
@ -4400,7 +4399,7 @@ build_new_function_call (fn, args, obj)
return error_mark_node;
}
candidates = splice_viable (candidates);
cand = tourney (candidates, NULL_TREE);
cand = tourney (candidates);
if (cand == 0)
{
@ -4474,7 +4473,7 @@ build_object_call (obj, args)
}
candidates = splice_viable (candidates);
cand = tourney (candidates, NULL_TREE);
cand = tourney (candidates);
if (cand == 0)
{
@ -4749,7 +4748,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
return error_mark_node;
}
candidates = splice_viable (candidates);
cand = tourney (candidates, NULL_TREE);
cand = tourney (candidates);
if (cand == 0)
{
@ -5386,7 +5385,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
return error_mark_node;
}
candidates = splice_viable (candidates);
cand = tourney (candidates, NULL_TREE);
cand = tourney (candidates);
if (cand == 0)
{
@ -5751,11 +5750,36 @@ joust (cand1, cand2)
for (i = 0; i < len; ++i)
{
int comp = compare_ics (TREE_VEC_ELT (cand1->convs, i+off1),
TREE_VEC_ELT (cand2->convs, i+off2));
tree t1 = TREE_VEC_ELT (cand1->convs, i+off1);
tree t2 = TREE_VEC_ELT (cand2->convs, i+off2);
int comp = compare_ics (t1, t2);
if (comp != 0)
{
if (warn_sign_promo
&& ICS_RANK (t1) + ICS_RANK (t2) == STD_RANK + PROMO_RANK
&& TREE_CODE (t1) == STD_CONV
&& TREE_CODE (t2) == STD_CONV
&& TREE_CODE (TREE_TYPE (t1)) == INTEGER_TYPE
&& TREE_CODE (TREE_TYPE (t2)) == INTEGER_TYPE
&& (TYPE_PRECISION (TREE_TYPE (t1))
== TYPE_PRECISION (TREE_TYPE (t2)))
&& (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (t1, 0)))
|| (TREE_CODE (TREE_TYPE (TREE_OPERAND (t1, 0)))
== ENUMERAL_TYPE)))
{
tree type = TREE_TYPE (TREE_OPERAND (t1, 0));
tree type1, type2;
if (comp > 0)
type1 = TREE_TYPE (t1), type2 = TREE_TYPE (t2);
else
type1 = TREE_TYPE (t2), type2 = TREE_TYPE (t1);
cp_warning ("`%T' promotes to `%T', not `%T'",
type, type1, type2);
cp_warning (" in call to `%D'", DECL_NAME (cand1->fn));
}
if (winner && comp != winner)
{
winner = 0;

View File

@ -671,6 +671,7 @@ build_vtable (binfo, type)
TYPE_BINFO_VTABLE (type) = decl;
TYPE_BINFO_VIRTUALS (type) = virtuals;
DECL_ARTIFICIAL (decl) = 1;
TREE_STATIC (decl) = 1;
#ifndef WRITABLE_VTABLES
/* Make them READONLY by default. (mrs) */
@ -781,6 +782,7 @@ prepare_fresh_vtable (binfo, for_type)
/* Remember which class this vtable is really for. */
DECL_CONTEXT (new_decl) = for_type;
DECL_ARTIFICIAL (new_decl) = 1;
TREE_STATIC (new_decl) = 1;
BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl);
DECL_VIRTUAL_P (new_decl) = 1;

View File

@ -248,6 +248,11 @@ extern int warn_pmf2ptr;
extern int warn_ecpp;
/* Nonzero means warn where overload resolution chooses a promotion from
unsigned to signed over a conversion to an unsigned of the same size. */
extern int warn_sign_promo;
/* Non-zero means warn when a function is declared extern and later inline. */
extern int warn_extern_inline;
@ -1463,7 +1468,7 @@ extern tree convert_and_check PROTO((tree, tree));
extern void overflow_warning PROTO((tree));
extern void unsigned_conversion_warning PROTO((tree, tree));
/* Read the rest of the current #-directive line. */
extern char *get_directive_line STDIO_PROTO((FILE *));
extern char *get_directive_line PROTO((FILE *));
/* Subroutine of build_binary_op, used for comparison operations.
See if the operands have both been converted from subword integer types
and, if so, perhaps change them both back to their original type. */
@ -2265,7 +2270,7 @@ extern void yyerror PROTO((char *));
/* in method.c */
extern void init_method PROTO((void));
extern void do_inline_function_hair PROTO((tree, tree));
/* skip report_type_mismatch */
extern void report_type_mismatch PROTO((struct candidate *, tree, char *));
extern char *build_overload_name PROTO((tree, int, int));
extern tree build_static_name PROTO((tree, tree));
extern tree build_decl_overload PROTO((tree, tree, int));

View File

@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */
but what kind of conversions it does will depend on the language. */
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "flags.h"
#include "cp-tree.h"
@ -1100,7 +1101,10 @@ ocp_convert (type, expr, convtype, flags)
if ((flags & LOOKUP_ONLYCONVERTING)
&& ! (IS_AGGR_TYPE (dtype) && DERIVED_FROM_P (type, dtype)))
ctor = build_user_type_conversion (type, ctor, flags);
{
ctor = build_user_type_conversion (type, ctor, flags);
flags |= LOOKUP_NO_CONVERSION;
}
if (ctor)
ctor = build_method_call (NULL_TREE, ctor_identifier,
build_tree_list (NULL_TREE, ctor),

View File

@ -27,8 +27,8 @@ Boston, MA 02111-1307, USA. */
/* ??? not all decl nodes are given the most useful possible
line numbers. For example, the CONST_DECLs for enum values. */
#include <stdio.h>
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "rtl.h"
#include "flags.h"
@ -2576,7 +2576,7 @@ duplicate_decls (newdecl, olddecl)
{
cp_error ("default argument given for parameter %d of `%#D'",
i, newdecl);
cp_error_at ("conflicts with previous specification in `%#D'",
cp_error_at ("after previous specification in `%#D'",
olddecl);
}
}
@ -2699,6 +2699,7 @@ duplicate_decls (newdecl, olddecl)
TYPE_RAISES_EXCEPTIONS (oldtype));
if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
&& flag_exceptions
&& ! compexcepttypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl)))
{
cp_pedwarn ("declaration of `%D' throws different exceptions",

View File

@ -158,11 +158,10 @@ int warn_ctor_dtor_privacy = 1;
/* True if we want to implement vtables using "thunks".
The default is off. */
#if defined(NEW_OVER) && defined (__i386__)
int flag_vtable_thunks = 1;
#else
int flag_vtable_thunks;
#ifndef DEFAULT_VTABLE_THUNKS
#define DEFAULT_VTABLE_THUNKS 0
#endif
int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
/* True if we want to deal with repository information. */
@ -246,7 +245,12 @@ int warn_pmf2ptr = 1;
/* Nonzero means warn about violation of some Effective C++ style rules. */
int warn_ecpp = 0;
int warn_ecpp;
/* Nonzero means warn where overload resolution chooses a promotion from
unsigned to signed over a conversion to an unsigned of the same size. */
int warn_sign_promo;
/* Nonzero means `$' can be in an identifier.
See cccp.c for reasons why this breaks some obscure ANSI C programs. */
@ -409,6 +413,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"all-virtual", &flag_all_virtual, 1},
{"memoize-lookups", &flag_memoize_lookups, 1},
{"elide-constructors", &flag_elide_constructors, 1},
{"handle-exceptions", &flag_exceptions, 1},
{"handle-signatures", &flag_handle_signatures, 1},
{"default-inline", &flag_default_inline, 1},
{"dollars-in-identifiers", &dollars_in_ident, 1},
@ -470,13 +475,17 @@ lang_decode_option (p)
p += 2;
/* Try special -f options. */
if (!strcmp (p, "handle-exceptions")
|| !strcmp (p, "no-handle-exceptions"))
warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)");
if (!strcmp (p, "save-memoized"))
{
flag_memoize_lookups = 1;
flag_save_memoized_contexts = 1;
found = 1;
}
if (!strcmp (p, "no-save-memoized"))
else if (!strcmp (p, "no-save-memoized"))
{
flag_memoize_lookups = 0;
flag_save_memoized_contexts = 0;
@ -585,6 +594,8 @@ lang_decode_option (p)
warn_pmf2ptr = setting;
else if (!strcmp (p, "effc++"))
warn_ecpp = setting;
else if (!strcmp (p, "sign-promo"))
warn_sign_promo = setting;
else if (!strcmp (p, "comment"))
; /* cpp handles this one. */
else if (!strcmp (p, "comments"))
@ -613,6 +624,7 @@ lang_decode_option (p)
warn_uninitialized = (setting ? 2 : 0);
warn_template_debugging = setting;
warn_reorder = setting;
warn_sign_promo = setting;
}
else if (!strcmp (p, "overloaded-virtual"))

View File

@ -20,6 +20,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "cp-tree.h"
#include "obstack.h"
@ -700,6 +701,8 @@ dump_decl (t, v)
case FUNCTION_DECL:
if (GLOBAL_IORD_P (DECL_ASSEMBLER_NAME (t)))
dump_global_iord (DECL_ASSEMBLER_NAME (t));
else if (! DECL_LANG_SPECIFIC (t))
OB_PUTS ("{internal}");
else
dump_function_decl (t, v);
break;
@ -1388,6 +1391,10 @@ dump_expr (t, nop)
OB_PUTC (')');
break;
case DEFAULT_ARG:
OB_PUTS ("{unparsed}");
break;
case TREE_LIST:
if (TREE_VALUE (t) && TREE_CODE (TREE_VALUE (t)) == FUNCTION_DECL)
{

View File

@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "rtl.h"
#include "cp-tree.h"
@ -44,8 +45,6 @@ tree builtin_return_address_fndecl;
static tree BuiltinReturnAddress;
#include <stdio.h>
static void
easy_expand_asm (str)
char *str;

View File

@ -33,7 +33,7 @@
/* Define terminate, unexpected, set_terminate, set_unexpected as
well as the default terminate func and default unexpected func. */
extern terminate_handler __terminate_func;
extern terminate_handler __terminate_func __attribute__((__noreturn__));
void
terminate ()

View File

@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include <stdio.h>
#include "rtl.h"
#include "tree.h"
#include "flags.h"

View File

@ -19,6 +19,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "rtl.h"
#include "cp-tree.h"

View File

@ -1,7 +1,8 @@
#include "config.h"
#include <sys/types.h>
#include <stdio.h>
#include "config.h"
#include "gansidecl.h"
/* This bit is set if we saw a `-xfoo' language specification. */

View File

@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */
/* High-level class interface. */
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "rtl.h"
#include "cp-tree.h"

View File

@ -50,6 +50,8 @@ Boston, MA 02111-1307, USA. */
"-fno-for-scope",
"-fgnu-keywords",
"-fno-gnu-keywords",
"-fhandle-exceptions",
"-fno-handle-exceptions",
"-fhandle-signatures",
"-fno-handle-signatures",
"-fhuge-objects",
@ -104,3 +106,5 @@ Boston, MA 02111-1307, USA. */
"-Wno-pmf-conversions",
"-Weffc++",
"-Wno-effc++",
"-Wsign-promo",
"-Wno-sign-promo",

View File

@ -25,11 +25,11 @@ Boston, MA 02111-1307, USA. */
/* Cause the `yydebug' variable to be defined. */
#define YYDEBUG 1
#include "config.h"
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <setjmp.h>
#include "config.h"
#include "input.h"
#include "tree.h"
#include "lex.h"
@ -1865,10 +1865,9 @@ do_pending_defargs ()
defarg_parm = TREE_CHAIN (defarg_parm);
for (; defarg_parm; defarg_parm = TREE_CHAIN (defarg_parm))
if (TREE_PURPOSE (defarg_parm))
if (TREE_PURPOSE (defarg_parm)
&& TREE_CODE (TREE_PURPOSE (defarg_parm)) == DEFAULT_ARG)
{
my_friendly_assert (TREE_CODE (TREE_PURPOSE (defarg_parm))
== DEFAULT_ARG, 2349);
feed_defarg (defarg_fn, defarg_parm);
/* Return to the parser, which will process this defarg

View File

@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA. */
#endif
/* Handle method declarations. */
#include <stdio.h>
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "cp-tree.h"
#include "class.h"
@ -1777,6 +1777,7 @@ emit_thunk (thunk_fndecl)
DECL_RESULT (thunk_fndecl)
= build_decl (RESULT_DECL, 0, integer_type_node);
fnname = XSTR (XEXP (DECL_RTL (thunk_fndecl), 0), 0);
init_function_start (thunk_fndecl, input_filename, lineno);
assemble_start_function (thunk_fndecl, fnname);
ASM_OUTPUT_MI_THUNK (asm_out_file, thunk_fndecl, delta, function);
assemble_end_function (thunk_fndecl, fnname);

View File

@ -2227,7 +2227,7 @@ structsp:
{
$$.t = $<ttype>6;
$$.new_type_flag = 1;
if (current_scope () == current_function_decl)
if (current_class_type == NULL_TREE)
clear_inline_text_obstack ();
}
| class_head %prec EMPTY
@ -3719,7 +3719,7 @@ function_try_block:
store_parm_decls ();
expand_start_early_try_stmts ();
}
ctor_initializer_opt compstmt_or_error
ctor_initializer_opt compstmt
{ expand_start_all_catch (); }
handler_seq
{

View File

@ -25,8 +25,8 @@ Boston, MA 02111-1307, USA. */
The results of the automatic process should be easily reproducible with
explicit code. */
#include <stdio.h>
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "cp-tree.h"
#include "input.h"

View File

@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include <stdio.h>
#include "tree.h"
#include "cp-tree.h"
#include "flags.h"
@ -33,7 +34,7 @@ Boston, MA 02111-1307, USA. */
extern tree define_function ();
extern tree build_t_desc_overload ();
extern struct obstack *permanent_obstack;
extern struct obstack permanent_obstack;
tree type_info_type_node;
tree tinfo_fn_id;