diff options
author | Mike Stump <mrs@gcc.gnu.org> | 1997-02-21 20:28:30 +0000 |
---|---|---|
committer | Mike Stump <mrs@gcc.gnu.org> | 1997-02-21 20:28:30 +0000 |
commit | 2ba25f504d54596978a4efa6531cb313688d1ae0 (patch) | |
tree | 7f8754a63a49f51e2887ad1d6e48c15ec046b993 | |
parent | 9290558260c3d26ae55adb61a7225dde9e61fb79 (diff) | |
download | gcc-2ba25f504d54596978a4efa6531cb313688d1ae0.zip gcc-2ba25f504d54596978a4efa6531cb313688d1ae0.tar.gz gcc-2ba25f504d54596978a4efa6531cb313688d1ae0.tar.bz2 |
90th Cygnus<->FSF quick merge
From-SVN: r13673
-rw-r--r-- | gcc/cp/ChangeLog | 30 | ||||
-rw-r--r-- | gcc/cp/call.c | 6 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 3 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 2 | ||||
-rw-r--r-- | gcc/cp/decl.c | 1 | ||||
-rw-r--r-- | gcc/cp/error.c | 35 | ||||
-rw-r--r-- | gcc/cp/g++spec.c | 2 | ||||
-rw-r--r-- | gcc/cp/parse.y | 12 | ||||
-rw-r--r-- | gcc/cp/tree.c | 20 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 7 |
10 files changed, 93 insertions, 25 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8f1f715..78ca954 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f9fe74d..75e7b56 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cdc8dd6..9bd73ab 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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)); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index ad3c208..1c40640 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -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; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 26601104..77dce5b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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. */ diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 31431e7..8d9ade4 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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; diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c index e4bfc8d..d41c516 100644 --- a/gcc/cp/g++spec.c +++ b/gcc/cp/g++spec.c @@ -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. */ diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 6a53fee..ff0a139 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -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 (); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index a5b7916..df732f5 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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]; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 2363098..10fbdef 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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), |