90th Cygnus<->FSF quick merge

From-SVN: r13673
This commit is contained in:
Mike Stump 1997-02-21 20:28:30 +00:00
parent 9290558260
commit 2ba25f504d
10 changed files with 93 additions and 25 deletions

View File

@ -1,3 +1,33 @@
Thu Feb 20 15:12:15 1997 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_over_call): Call mark_used before trying to elide
the call.
* decl.c (implicitly_declare): Don't set DECL_ARTIFICIAL.
Wed Feb 19 11:18:53 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
* typeck.c (build_modify_expr): Always pedwarn for a cast to
non-reference used as an lvalue.
Wed Feb 19 10:35:37 1997 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (cp_convert_to_pointer): Convert from 0 to a pmf properly.
Tue Feb 18 15:40:57 1997 Jason Merrill <jason@yorick.cygnus.com>
* parse.y (handler): Fix template typo.
Sun Feb 16 02:12:28 1997 Jason Merrill <jason@yorick.cygnus.com>
* error.c (lang_decl_name): New fn.
* tree.c (lang_printable_name): Use it.
Fri Feb 14 16:57:05 1997 Mike Stump <mrs@cygnus.com>
* g++spec.c: Include config.h so that we can catch bzero #defines
from the config file.
Tue Feb 11 13:50:48 1997 Mike Stump <mrs@cygnus.com>
* new1.cc: Include a declaration for malloc, to avoid warning, and

View File

@ -5092,6 +5092,10 @@ build_over_call (fn, convs, args, flags)
converted_args = nreverse (converted_args);
/* [class.copy]: the copy constructor is implicitly defined even if the
implementation elided its use. */
mark_used (fn);
/* Avoid actually calling copy constructors and copy assignment operators,
if possible. */
if (DECL_CONSTRUCTOR_P (fn)
@ -5155,8 +5159,6 @@ build_over_call (fn, convs, args, flags)
return val;
}
mark_used (fn);
if (DECL_CONTEXT (fn) && IS_SIGNATURE (DECL_CONTEXT (fn)))
return build_signature_method_call (fn, converted_args);
else if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0)

View File

@ -2163,6 +2163,7 @@ extern char *parm_as_string PROTO((int, int));
extern char *op_as_string PROTO((enum tree_code, int));
extern char *assop_as_string PROTO((enum tree_code, int));
extern char *cv_as_string PROTO((tree, int));
extern char *lang_decl_name PROTO((tree, int));
/* in except.c */
extern void init_exception_processing PROTO((void));
@ -2410,7 +2411,7 @@ extern tree function_arg_chain PROTO((tree));
extern int promotes_to_aggr_type PROTO((tree, enum tree_code));
extern int is_aggr_type_2 PROTO((tree, tree));
extern void message_2_types PROTO((void (*)(), char *, tree, tree));
extern char *lang_printable_name PROTO((tree));
extern char *lang_printable_name PROTO((tree, int));
extern tree build_exception_variant PROTO((tree, tree));
extern tree copy_to_permanent PROTO((tree));
extern void print_lang_statistics PROTO((void));

View File

@ -272,6 +272,8 @@ cp_convert_to_pointer (type, expr)
if (integer_zerop (expr))
{
if (TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
return build_ptrmemfunc (type, expr, 0);
expr = build_int_2 (0, 0);
TREE_TYPE (expr) = type;
return expr;

View File

@ -3583,7 +3583,6 @@ implicitly_declare (functionid)
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
/* ANSI standard says implicit declarations are in the innermost block.
So we record the decl in the standard fashion. */

View File

@ -1486,6 +1486,41 @@ decl_as_string (decl, v)
return (char *)obstack_base (&scratch_obstack);
}
/* Generate the three forms of printable names for lang_printable_name. */
char *
lang_decl_name (decl, v)
tree decl;
int v;
{
if (v >= 2)
return decl_as_string (decl, 1);
OB_INIT ();
if (v == 1 && DECL_CONTEXT (decl)
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
{
tree cname;
if (TREE_CODE (decl) == FUNCTION_DECL)
cname = DECL_CLASS_CONTEXT (decl);
else
cname = DECL_CONTEXT (decl);
dump_type (cname, 0);
OB_PUTC2 (':', ':');
}
if (TREE_CODE (decl) == FUNCTION_DECL)
dump_function_name (decl);
else
dump_decl (DECL_NAME (decl), 0);
OB_FINISH ();
return (char *)obstack_base (&scratch_obstack);
}
char *
cp_file_of (t)
tree t;

View File

@ -1,5 +1,7 @@
#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

@ -3742,18 +3742,18 @@ handler:
{
if (processing_template_decl)
{
TREE_OPERAND ($<ttype>3, 0) = TREE_CHAIN ($<ttype>3);
TREE_CHAIN ($<ttype>3) = NULL_TREE;
last_tree = $<ttype>3;
TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
TREE_CHAIN ($<ttype>2) = NULL_TREE;
last_tree = $<ttype>2;
}
}
compstmt
{
if (processing_template_decl)
{
TREE_OPERAND ($<ttype>3, 1) = TREE_CHAIN ($<ttype>3);
TREE_CHAIN ($<ttype>3) = NULL_TREE;
last_tree = $<ttype>3;
TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
TREE_CHAIN ($<ttype>2) = NULL_TREE;
last_tree = $<ttype>2;
}
else
expand_end_catch_block ();

View File

@ -1385,8 +1385,9 @@ message_2_types (pfn, s, type1, type2)
#define PRINT_RING_SIZE 4
char *
lang_printable_name (decl)
lang_printable_name (decl, v)
tree decl;
int v;
{
static tree decl_ring[PRINT_RING_SIZE];
static char *print_ring[PRINT_RING_SIZE];
@ -1394,9 +1395,10 @@ lang_printable_name (decl)
int i;
/* Only cache functions. */
if (TREE_CODE (decl) != FUNCTION_DECL
if (v < 2
|| TREE_CODE (decl) != FUNCTION_DECL
|| DECL_LANG_SPECIFIC (decl) == 0)
return decl_as_string (decl, 1);
return lang_decl_name (decl, v);
/* See if this print name is lying around. */
for (i = 0; i < PRINT_RING_SIZE; i++)
@ -1420,16 +1422,8 @@ lang_printable_name (decl)
if (print_ring[ring_counter])
free (print_ring[ring_counter]);
{
int print_ret_type_p
= (!DECL_CONSTRUCTOR_P (decl)
&& !DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl)));
char *name = (char *)decl_as_string (decl, print_ret_type_p);
print_ring[ring_counter] = (char *)malloc (strlen (name) + 1);
strcpy (print_ring[ring_counter], name);
decl_ring[ring_counter] = decl;
}
print_ring[ring_counter] = xstrdup (lang_decl_name (decl, v));
decl_ring[ring_counter] = decl;
return print_ring[ring_counter];
}

View File

@ -5787,8 +5787,11 @@ build_modify_expr (lhs, modifycode, rhs)
{
tree inner_lhs = TREE_OPERAND (lhs, 0);
tree result;
if (! lvalue_p (lhs) && pedantic)
pedwarn ("cast to non-reference type used as lvalue");
/* WP 5.4.1: The result is an lvalue if T is a reference type,
otherwise the result is an rvalue. */
if (! lvalue_p (lhs))
pedwarn ("ANSI C++ forbids cast to non-reference type used as lvalue");
result = build_modify_expr (inner_lhs, NOP_EXPR,
convert (TREE_TYPE (inner_lhs),