Commit 79ff2c6c by Mike Stump

64th Cygnus<->FSF merge

From-SVN: r9341
parent aba892c4
Sat Apr 8 17:45:41 1995 Mike Stump <mrs@cygnus.com>
* gc.c (build_headof): Use ptrdiff_type_node instead of
integer_type_node on pointer arithmetic.
Sat Apr 8 11:57:04 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* typeck.c (build_modify_expr): Undo previous change.
Thu Apr 6 01:23:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* Makefile.in (compiler): Remove ../cc1plus before rebuilding it.
* repo.c (get_base_filename): Put the .rpo file in the directory
with the object file, not the source.
* typeck.c (build_conditional_expr): Handle pmf's better.
* repo.c (finish_repo): Also use ASM_OUTPUT_LABELREF to print out
the name of the symbol.
Wed Apr 5 15:24:12 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* repo.c (open_repo_file): Make repo filename DOS-compliant.
(*): Also write a new repo file if some previously-used
templates are no longer used. Only remember the identifier.
* lex.c (cons_up_default_function): If this function belongs to a
template class, call repo_template_used for it.
* repo.c (repo_template_used): Using a class means using its vtable,
if any.
(finish_repo): Ditto.
* typeck.c (build_modify_expr): Only wrap TARGET_EXPRs in RTL_EXPRs
if the type has a complex copy constructor.
* decl2.c (lang_decode_option): -frepo implies
-fno-implicit-templates.
* decl.c (start_function): Clear current_{base,member}_init_list.
* lex.c (init_lex): Also unset *_eq if ! flag_operator_names.
Tue Apr 4 16:11:08 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* decl.c (struct cp_function): Add {base,member}_init_list.
(push_cp_function_context): Save current_{base,member}_init_list.
(pop_cp_function_context): Restore them.
Mon Apr 3 16:55:08 1995 Jason Merrill <jason@phydeaux.cygnus.com> Mon Apr 3 16:55:08 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* repo.c (get_base_filename): Take filename parm, fix logic bug. * repo.c (get_base_filename): Take filename parm, fix logic bug.
......
...@@ -167,7 +167,7 @@ OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o ...@@ -167,7 +167,7 @@ OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o
compiler: ../cc1plus compiler: ../cc1plus
../cc1plus: $(P) $(CXX_OBJS) $(OBJDEPS) $(LIBDEPS) ../cc1plus: $(P) $(CXX_OBJS) $(OBJDEPS) $(LIBDEPS)
rm -f $@ rm -f ../cc1plus
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o ../cc1plus \ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o ../cc1plus \
$(CXX_OBJS) $(OBJS) $(LIBS) $(CXX_OBJS) $(OBJS) $(LIBS)
......
...@@ -10653,6 +10653,8 @@ start_function (declspecs, declarator, raises, pre_parsed_p) ...@@ -10653,6 +10653,8 @@ start_function (declspecs, declarator, raises, pre_parsed_p)
current_function_obstack_usage = 0; current_function_obstack_usage = 0;
base_init_insns = NULL_RTX; base_init_insns = NULL_RTX;
protect_list = NULL_TREE; protect_list = NULL_TREE;
current_base_init_list = NULL_TREE;
current_member_init_list = NULL_TREE;
clear_temp_name (); clear_temp_name ();
...@@ -12137,6 +12139,8 @@ struct cp_function ...@@ -12137,6 +12139,8 @@ struct cp_function
tree ctor_label; tree ctor_label;
tree dtor_label; tree dtor_label;
tree protect_list; tree protect_list;
tree base_init_list;
tree member_init_list;
rtx result_rtx; rtx result_rtx;
rtx base_init_insns; rtx base_init_insns;
struct cp_function *next; struct cp_function *next;
...@@ -12177,6 +12181,8 @@ push_cp_function_context (context) ...@@ -12177,6 +12181,8 @@ push_cp_function_context (context)
p->base_init_insns = base_init_insns; p->base_init_insns = base_init_insns;
p->protect_list = protect_list; p->protect_list = protect_list;
p->temp_name_counter = temp_name_counter; p->temp_name_counter = temp_name_counter;
p->base_init_list = current_base_init_list;
p->member_init_list = current_member_init_list;
} }
/* Restore the variables used during compilation of a C++ function. */ /* Restore the variables used during compilation of a C++ function. */
...@@ -12224,6 +12230,8 @@ pop_cp_function_context (context) ...@@ -12224,6 +12230,8 @@ pop_cp_function_context (context)
original_result_rtx = p->result_rtx; original_result_rtx = p->result_rtx;
base_init_insns = p->base_init_insns; base_init_insns = p->base_init_insns;
temp_name_counter = p->temp_name_counter; temp_name_counter = p->temp_name_counter;
current_base_init_list = p->base_init_list;
current_member_init_list = p->member_init_list;
free (p); free (p);
} }
...@@ -494,6 +494,13 @@ lang_decode_option (p) ...@@ -494,6 +494,13 @@ lang_decode_option (p)
else if (!strcmp (p, "ansi-overloading")) else if (!strcmp (p, "ansi-overloading"))
{ {
warning ("-fansi-overloading is no longer meaningful"); warning ("-fansi-overloading is no longer meaningful");
found = 1;
}
else if (!strcmp (p, "repo"))
{
flag_use_repository = 1;
flag_implicit_templates = 0;
found = 1;
} }
else for (j = 0; else for (j = 0;
!found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]); !found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]);
......
...@@ -809,12 +809,16 @@ init_lex () ...@@ -809,12 +809,16 @@ init_lex ()
{ {
/* These are new ANSI keywords that may break code. */ /* These are new ANSI keywords that may break code. */
UNSET_RESERVED_WORD ("and"); UNSET_RESERVED_WORD ("and");
UNSET_RESERVED_WORD ("and_eq");
UNSET_RESERVED_WORD ("bitand"); UNSET_RESERVED_WORD ("bitand");
UNSET_RESERVED_WORD ("bitor"); UNSET_RESERVED_WORD ("bitor");
UNSET_RESERVED_WORD ("compl"); UNSET_RESERVED_WORD ("compl");
UNSET_RESERVED_WORD ("not"); UNSET_RESERVED_WORD ("not");
UNSET_RESERVED_WORD ("not_eq");
UNSET_RESERVED_WORD ("or"); UNSET_RESERVED_WORD ("or");
UNSET_RESERVED_WORD ("or_eq");
UNSET_RESERVED_WORD ("xor"); UNSET_RESERVED_WORD ("xor");
UNSET_RESERVED_WORD ("xor_eq");
} }
if (! flag_traditional) if (! flag_traditional)
UNSET_RESERVED_WORD ("overload"); UNSET_RESERVED_WORD ("overload");
...@@ -1784,7 +1788,10 @@ cons_up_default_function (type, full_name, kind) ...@@ -1784,7 +1788,10 @@ cons_up_default_function (type, full_name, kind)
return fn; return fn;
if (processing_template_defn) if (processing_template_defn)
{
SET_DECL_IMPLICIT_INSTANTIATION (fn); SET_DECL_IMPLICIT_INSTANTIATION (fn);
repo_template_used (fn);
}
if (CLASSTYPE_INTERFACE_KNOWN (type)) if (CLASSTYPE_INTERFACE_KNOWN (type))
{ {
......
...@@ -29,19 +29,19 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -29,19 +29,19 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "tree.h" #include "tree.h"
#include "cp-tree.h" #include "cp-tree.h"
#include "input.h" #include "input.h"
#include "obstack.h"
extern char * rindex (); extern char * rindex ();
extern char * getenv (); extern char * getenv ();
static tree pending_repo; static tree pending_repo;
static tree original_repo;
static char repo_name[1024]; static char repo_name[1024];
static FILE *repo_file; static FILE *repo_file;
extern int flag_use_repository; extern int flag_use_repository;
extern int errorcount, sorrycount; extern int errorcount, sorrycount;
static int repo_changed;
#define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE)) #define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE))
#define IDENTIFIER_REPO_CHOSEN(NODE) (TREE_LANG_FLAG_4 (NODE)) #define IDENTIFIER_REPO_CHOSEN(NODE) (TREE_LANG_FLAG_4 (NODE))
...@@ -93,7 +93,10 @@ repo_template_used (t) ...@@ -93,7 +93,10 @@ repo_template_used (t)
if (TREE_CODE_CLASS (TREE_CODE (t)) == 't') if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
{ {
id = DECL_ASSEMBLER_NAME (TYPE_MAIN_DECL (t)); id = TYPE_BINFO_VTABLE (t);
if (id == NULL_TREE)
return;
id = DECL_ASSEMBLER_NAME (id);
if (IDENTIFIER_REPO_CHOSEN (id)) if (IDENTIFIER_REPO_CHOSEN (id))
mark_class_instantiated (t, 0); mark_class_instantiated (t, 0);
} }
...@@ -108,10 +111,9 @@ repo_template_used (t) ...@@ -108,10 +111,9 @@ repo_template_used (t)
if (! IDENTIFIER_REPO_USED (id)) if (! IDENTIFIER_REPO_USED (id))
{ {
repo_changed = 1;
IDENTIFIER_REPO_USED (id) = 1; IDENTIFIER_REPO_USED (id) = 1;
pending_repo = perm_tree_cons (NULL_TREE, id, pending_repo);
} }
pending_repo = perm_tree_cons (NULL_TREE, t, pending_repo);
} }
/* Note that the vtable for a class has been used, and offer to emit it. */ /* Note that the vtable for a class has been used, and offer to emit it. */
...@@ -160,11 +162,8 @@ save_string (s, len) ...@@ -160,11 +162,8 @@ save_string (s, len)
char *s; char *s;
int len; int len;
{ {
register char *result = xmalloc (len + 1); extern struct obstack temporary_obstack;
return obstack_copy0 (&temporary_obstack, s, len);
bcopy (s, result, len);
result[len] = 0;
return result;
} }
static char * static char *
...@@ -201,7 +200,18 @@ get_base_filename (filename) ...@@ -201,7 +200,18 @@ get_base_filename (filename)
if (compiling && output) if (compiling && output)
return output; return output;
return save_string (filename, strlen (filename)); if (p && ! compiling)
{
warning ("-frepo must be used with -c");
flag_use_repository = 0;
return NULL;
}
p = rindex (filename, '/');
if (p)
return p+1;
else
return filename;
} }
static void static void
...@@ -210,7 +220,12 @@ open_repo_file (filename) ...@@ -210,7 +220,12 @@ open_repo_file (filename)
{ {
register char *p, *q; register char *p, *q;
char *file = get_base_filename (filename); char *file = get_base_filename (filename);
char *s = rindex (file, '/'); char *s;
if (file == NULL)
return;
s = rindex (file, '/');
if (s == NULL) if (s == NULL)
s = file; s = file;
else else
...@@ -218,16 +233,15 @@ open_repo_file (filename) ...@@ -218,16 +233,15 @@ open_repo_file (filename)
for (p = repo_name, q = file; q < s; ) for (p = repo_name, q = file; q < s; )
*p++ = *q++; *p++ = *q++;
*p++ = '.'; /* *p++ = '.'; */
if ((s = rindex (q, '.')) == NULL) if ((s = rindex (q, '.')) == NULL)
strcpy (p, q); strcpy (p, q);
else else
for (; q < s;) for (; q < s;)
*p++ = *q++; *p++ = *q++;
strcat (p, ".repo"); strcat (p, ".rpo");
repo_file = fopen (repo_name, "r"); repo_file = fopen (repo_name, "r");
free (file);
} }
void void
...@@ -239,18 +253,13 @@ init_repo (filename) ...@@ -239,18 +253,13 @@ init_repo (filename)
if (! flag_use_repository) if (! flag_use_repository)
return; return;
open_repo_file (); open_repo_file (filename);
if (repo_file == 0) if (repo_file == 0)
return; return;
while (fgets (buf, 1024, repo_file)) while (fgets (buf, 1024, repo_file))
{ {
int len = strlen (buf) - 1;
if (buf[len] != '\n')
error ("repository info line too long in %s", repo_name);
buf[len] = '\0';
switch (buf[0]) switch (buf[0])
{ {
case 'A': case 'A':
...@@ -260,10 +269,16 @@ init_repo (filename) ...@@ -260,10 +269,16 @@ init_repo (filename)
case 'C': case 'C':
case 'O': case 'O':
{ {
tree id = get_identifier (&buf[2]); char *q;
IDENTIFIER_REPO_USED (id) = 1; tree id;
for (q = &buf[2]; *q && *q != ' ' && *q != '\n'; ++q) ;
q = save_string (&buf[2], q - &buf[2]);
id = get_identifier (q);
if (buf[0] == 'C') if (buf[0] == 'C')
IDENTIFIER_REPO_CHOSEN (id) = 1; IDENTIFIER_REPO_CHOSEN (id) = 1;
original_repo = perm_tree_cons (NULL_TREE, id, original_repo);
} }
break; break;
default: default:
...@@ -293,12 +308,37 @@ finish_repo () ...@@ -293,12 +308,37 @@ finish_repo ()
{ {
tree t; tree t;
char *p; char *p;
int repo_changed = 0;
if (! flag_use_repository) if (! flag_use_repository)
return; return;
/* Do we have to write out a new info file? */ /* Do we have to write out a new info file? */
/* Are there any old templates that aren't used any longer? */
for (t = original_repo; t; t = TREE_CHAIN (t))
{
if (! IDENTIFIER_REPO_USED (TREE_VALUE (t)))
{
repo_changed = 1;
break;
}
IDENTIFIER_REPO_USED (TREE_VALUE (t)) = 0;
}
/* Are there any templates that are newly used? */
if (! repo_changed)
for (t = pending_repo; t; t = TREE_CHAIN (t))
{
if (IDENTIFIER_REPO_USED (TREE_VALUE (t)))
{
repo_changed = 1;
break;
}
}
if (! repo_changed || errorcount || sorrycount) if (! repo_changed || errorcount || sorrycount)
goto out; goto out;
...@@ -320,19 +360,11 @@ finish_repo () ...@@ -320,19 +360,11 @@ finish_repo ()
for (t = pending_repo; t; t = TREE_CHAIN (t)) for (t = pending_repo; t; t = TREE_CHAIN (t))
{ {
tree val = TREE_VALUE (t); tree val = TREE_VALUE (t);
char type; char type = IDENTIFIER_REPO_CHOSEN (val) ? 'C' : 'O';
if (TREE_CODE_CLASS (TREE_CODE (val)) == 't')
val = TYPE_MAIN_DECL (val);
val = DECL_ASSEMBLER_NAME (val);
if (! IDENTIFIER_REPO_USED (val))
continue;
IDENTIFIER_REPO_USED (val) = 0;
type = IDENTIFIER_REPO_CHOSEN (val) ? 'C' : 'O';
fprintf (repo_file, "%c %s\n", type, IDENTIFIER_POINTER (val)); fprintf (repo_file, "%c %s ", type, IDENTIFIER_POINTER (val));
ASM_OUTPUT_LABELREF (repo_file, IDENTIFIER_POINTER (val));
putc ('\n', repo_file);
} }
out: out:
......
...@@ -4769,6 +4769,10 @@ build_conditional_expr (ifexp, op1, op2) ...@@ -4769,6 +4769,10 @@ build_conditional_expr (ifexp, op1, op2)
} }
} }
if (TREE_CODE (result_type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
result_type = build_ptrmemfunc_type (result_type);
if (result_type != TREE_TYPE (op1)) if (result_type != TREE_TYPE (op1))
op1 = convert_and_check (result_type, op1); op1 = convert_and_check (result_type, op1);
if (result_type != TREE_TYPE (op2)) if (result_type != TREE_TYPE (op2))
......
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