Commit 486837a7 by Kaveh R. Ghazi Committed by Kaveh Ghazi

class.c (get_vtable_name): Use a literal format string and VTABLE_NAME_PREFIX macro instead of...

	* class.c (get_vtable_name): Use a literal format string and
	VTABLE_NAME_PREFIX macro instead of VTABLE_NAME_FORMAT.
	(prepare_fresh_vtable): Likewise.

	* cp-tree.h (VTABLE_NAME_PREFIX): Define this instead of
	VTABLE_NAME_FORMAT.

	* decl.c (make_rtl_for_local_static): Remove unused variable `type'.

	* init.c (build_vec_init): Initialize variable `try_body'.

	* lex.c (yyerror): Don't call a variadic function with a
	non-literal format string.

	* optimize.c (optimize_function): Call memset, not bzero.

	* pt.c (for_each_template_parm_r): Add static prototype.

From-SVN: r30868
parent 509c1e9c
1999-12-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* class.c (get_vtable_name): Use a literal format string and
VTABLE_NAME_PREFIX macro instead of VTABLE_NAME_FORMAT.
(prepare_fresh_vtable): Likewise.
* cp-tree.h (VTABLE_NAME_PREFIX): Define this instead of
VTABLE_NAME_FORMAT.
* decl.c (make_rtl_for_local_static): Remove unused variable `type'.
* init.c (build_vec_init): Initialize variable `try_body'.
* lex.c (yyerror): Don't call a variadic function with a
non-literal format string.
* optimize.c (optimize_function): Call memset, not bzero.
* pt.c (for_each_template_parm_r): Add static prototype.
11999-12-09 Andreas Jaeger <aj@suse.de> 11999-12-09 Andreas Jaeger <aj@suse.de>
* except.c (expand_throw): Add static attribute to match * except.c (expand_throw): Add static attribute to match
......
...@@ -583,7 +583,7 @@ get_vtable_name (type) ...@@ -583,7 +583,7 @@ get_vtable_name (type)
tree type; tree type;
{ {
tree type_id = build_typename_overload (type); tree type_id = build_typename_overload (type);
char *buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT) char *buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX)
+ IDENTIFIER_LENGTH (type_id) + 2); + IDENTIFIER_LENGTH (type_id) + 2);
const char *ptr = IDENTIFIER_POINTER (type_id); const char *ptr = IDENTIFIER_POINTER (type_id);
int i; int i;
...@@ -596,7 +596,7 @@ get_vtable_name (type) ...@@ -596,7 +596,7 @@ get_vtable_name (type)
while (ptr[i] >= '0' && ptr[i] <= '9') while (ptr[i] >= '0' && ptr[i] <= '9')
i += 1; i += 1;
#endif #endif
sprintf (buf, VTABLE_NAME_FORMAT, ptr+i); sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, ptr+i);
return get_identifier (buf); return get_identifier (buf);
} }
...@@ -796,8 +796,8 @@ prepare_fresh_vtable (binfo, for_type) ...@@ -796,8 +796,8 @@ prepare_fresh_vtable (binfo, for_type)
sprintf (buf1, "%s%c%s", TYPE_ASSEMBLER_NAME_STRING (for_type), joiner, sprintf (buf1, "%s%c%s", TYPE_ASSEMBLER_NAME_STRING (for_type), joiner,
buf2); buf2);
buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT) + strlen (buf1) + 1); buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX) + strlen (buf1) + 1);
sprintf (buf, VTABLE_NAME_FORMAT, buf1); sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, buf1);
name = get_identifier (buf); name = get_identifier (buf);
/* If this name doesn't clash, then we can use it, otherwise /* If this name doesn't clash, then we can use it, otherwise
...@@ -827,9 +827,9 @@ prepare_fresh_vtable (binfo, for_type) ...@@ -827,9 +827,9 @@ prepare_fresh_vtable (binfo, for_type)
sprintf (buf1, "%s%c%s%c%d", sprintf (buf1, "%s%c%s%c%d",
TYPE_ASSEMBLER_NAME_STRING (basetype), joiner, TYPE_ASSEMBLER_NAME_STRING (basetype), joiner,
buf2, joiner, j); buf2, joiner, j);
buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT) buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX)
+ strlen (buf1) + 1); + strlen (buf1) + 1);
sprintf (buf, VTABLE_NAME_FORMAT, buf1); sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, buf1);
name = get_identifier (buf); name = get_identifier (buf);
/* If this name doesn't clash, then we can use it, /* If this name doesn't clash, then we can use it,
......
...@@ -2922,7 +2922,7 @@ extern tree global_base_init_list; ...@@ -2922,7 +2922,7 @@ extern tree global_base_init_list;
#define AUTO_TEMP_NAME "_$tmp_" #define AUTO_TEMP_NAME "_$tmp_"
#define AUTO_TEMP_FORMAT "_$tmp_%d" #define AUTO_TEMP_FORMAT "_$tmp_%d"
#define VTABLE_BASE "$vb" #define VTABLE_BASE "$vb"
#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s") #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt$")
#define VFIELD_BASE "$vf" #define VFIELD_BASE "$vf"
#define VFIELD_NAME "_vptr$" #define VFIELD_NAME "_vptr$"
#define VFIELD_NAME_FORMAT "_vptr$%s" #define VFIELD_NAME_FORMAT "_vptr$%s"
...@@ -2944,7 +2944,7 @@ extern tree global_base_init_list; ...@@ -2944,7 +2944,7 @@ extern tree global_base_init_list;
#define AUTO_TEMP_NAME "_.tmp_" #define AUTO_TEMP_NAME "_.tmp_"
#define AUTO_TEMP_FORMAT "_.tmp_%d" #define AUTO_TEMP_FORMAT "_.tmp_%d"
#define VTABLE_BASE ".vb" #define VTABLE_BASE ".vb"
#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt.%s") #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt.")
#define VFIELD_BASE ".vf" #define VFIELD_BASE ".vf"
#define VFIELD_NAME "_vptr." #define VFIELD_NAME "_vptr."
#define VFIELD_NAME_FORMAT "_vptr.%s" #define VFIELD_NAME_FORMAT "_vptr.%s"
...@@ -2973,7 +2973,7 @@ extern tree global_base_init_list; ...@@ -2973,7 +2973,7 @@ extern tree global_base_init_list;
#define AUTO_TEMP_FORMAT "__tmp_%d" #define AUTO_TEMP_FORMAT "__tmp_%d"
#define VTABLE_BASE "__vtb" #define VTABLE_BASE "__vtb"
#define VTABLE_NAME "__vt_" #define VTABLE_NAME "__vt_"
#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt_%s") #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt_")
#define VTABLE_NAME_P(ID_NODE) \ #define VTABLE_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
sizeof (VTABLE_NAME) - 1)) sizeof (VTABLE_NAME) - 1))
......
...@@ -7381,7 +7381,6 @@ void ...@@ -7381,7 +7381,6 @@ void
make_rtl_for_local_static (decl) make_rtl_for_local_static (decl)
tree decl; tree decl;
{ {
tree type = TREE_TYPE (decl);
const char *asmspec = NULL; const char *asmspec = NULL;
/* If we inlined this variable, we could see it's declaration /* If we inlined this variable, we could see it's declaration
......
...@@ -2640,7 +2640,7 @@ build_vec_init (decl, base, maxindex, init, from_array) ...@@ -2640,7 +2640,7 @@ build_vec_init (decl, base, maxindex, init, from_array)
tree compound_stmt; tree compound_stmt;
int destroy_temps; int destroy_temps;
tree try_block = NULL_TREE; tree try_block = NULL_TREE;
tree try_body; tree try_body = NULL_TREE;
int num_initialized_elts = 0; int num_initialized_elts = 0;
maxindex = cp_convert (ptrdiff_type_node, maxindex); maxindex = cp_convert (ptrdiff_type_node, maxindex);
......
...@@ -2936,29 +2936,26 @@ yyerror (string) ...@@ -2936,29 +2936,26 @@ yyerror (string)
const char *string; const char *string;
{ {
extern int end_of_file; extern int end_of_file;
char buf[200];
strcpy (buf, string);
/* We can't print string and character constants well /* We can't print string and character constants well
because the token_buffer contains the result of processing escapes. */ because the token_buffer contains the result of processing escapes. */
if (end_of_file) if (end_of_file)
strcat (buf, input_redirected () {
? " at end of saved text" if (input_redirected ())
: " at end of input"); error ("%s at end of saved text", string);
else
error ("%s at end of input", string);
}
else if (token_buffer[0] == 0) else if (token_buffer[0] == 0)
strcat (buf, " at null character"); error ("%s at null character", string);
else if (token_buffer[0] == '"') else if (token_buffer[0] == '"')
strcat (buf, " before string constant"); error ("%s before string constant", string);
else if (token_buffer[0] == '\'') else if (token_buffer[0] == '\'')
strcat (buf, " before character constant"); error ("%s before character constant", string);
else if (!ISGRAPH ((unsigned char)token_buffer[0])) else if (!ISGRAPH ((unsigned char)token_buffer[0]))
sprintf (buf + strlen (buf), " before character 0%o", error ("%s before character 0%o", string, (unsigned char) token_buffer[0]);
(unsigned char) token_buffer[0]);
else else
strcat (buf, " before `%s'"); error ("%s before `%s'", string, token_buffer);
error (buf, token_buffer);
} }
/* Value is 1 (or 2) if we should try to make the next identifier look like /* Value is 1 (or 2) if we should try to make the next identifier look like
......
...@@ -695,7 +695,7 @@ optimize_function (fn) ...@@ -695,7 +695,7 @@ optimize_function (fn)
struct saved_scope *s; struct saved_scope *s;
/* Clear out ID. */ /* Clear out ID. */
bzero (&id, sizeof (id)); memset (&id, 0, sizeof (id));
/* Don't allow recursion into FN. */ /* Don't allow recursion into FN. */
VARRAY_TREE_INIT (id.fns, 32, "fns"); VARRAY_TREE_INIT (id.fns, 32, "fns");
......
...@@ -157,6 +157,7 @@ static tree determine_specialization PROTO((tree, tree, tree *, int)); ...@@ -157,6 +157,7 @@ static tree determine_specialization PROTO((tree, tree, tree *, int));
static int template_args_equal PROTO((tree, tree)); static int template_args_equal PROTO((tree, tree));
static void print_template_context PROTO((int)); static void print_template_context PROTO((int));
static void tsubst_default_arguments PROTO((tree)); static void tsubst_default_arguments PROTO((tree));
static tree for_each_template_parm_r PROTO((tree *, int *, void *));
/* Called once to initialize pt.c. */ /* Called once to initialize pt.c. */
......
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