aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-08-29 21:39:49 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-08-29 21:39:49 +0000
commit63ad61edae6f0ecd498f2d78beadf782e56c9c33 (patch)
treef12dafe607163b1a32d59a3f95160157c959dc7d /gcc
parentcee58bc005408e87d6b6ba77adf4f288e9a34b9c (diff)
downloadgcc-63ad61edae6f0ecd498f2d78beadf782e56c9c33.zip
gcc-63ad61edae6f0ecd498f2d78beadf782e56c9c33.tar.gz
gcc-63ad61edae6f0ecd498f2d78beadf782e56c9c33.tar.bz2
top level:
* c-common.c (declare_function_name): Use func_id_node, function_id_node, and pretty_function_id_node. Do not make __func__ visible at file scope. * c-common.h (c_tree_index): Add CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID. (function_id_node, pretty_function_id_node, func_id_node): New macros. * c-decl.c (init_decl_processing): Initialize function_id_node, pretty_function_id_node, and func_id_node. (c_make_fname_decl): Correct comment. * tree.h (struct tree_identifier): Constify pointer member. * c-decl.c (pushdecl, implicit_decl_warning): Constify a char *. * c-pragma.h (struct weak_syms): Constify name and value members. (add_weak): Constify arguments. * calls.c (special_function_p): Constify a char *. (expand_call): Remove variable which is initialized and then never used. * dependence.c (struct def_use, struct induction, struct subscript): Constify 'variable' member. (get_low_bound, have_induction_variable): Constify char * argument. (find_induction_variable): Add braces to avoid dangling else. (classify_dependence): Constify char * arrays. * profile.c (output_func_start_profiler): Constify a char *. * stor-layout.c (finalize_record_size): Constify a char *. * tree.c (is_attribute_p): Constify a char *. * varasm.c (add_weak, remove_from_pending_weak_list): Constify argument. * varasm.c (make_function_rtl, make_decl_rtl): Rearrange code for comprehensibility. Do not call get_identifier if we did not change the DECL_ASSEMBLER_NAME of the decl. Use alloca to create temporary string constants, not ggc_alloc_string. No need to copy result of ASM_FORMAT_PRIVATE_NAME. Use const char * to hold IDENTIFIER_POINTERs. ch: * inout.c (add_enum_to_list): Use DECL_NAME directly, don't get its IDENTIFIER_POINTER and immediately call get_identifier on it. * lex.c (yywrap): Constify a char *. cp: * class.c (build_secondary_vtable): Constify a char *. * decl.c (init_decl_processing): Initialize function_id_node, pretty_function_id_node, and func_id_node. * input.c (struct input_source): Constify 'str'. (feed_input): Constify first argument. * mangle.c (write_identifier): Constify argument. * pt.c (mangle_class_name_for_template): Constify argument. f: * ansify.c: Use #line, not # <number>. java: * jcf-parse.c (set_source_filename): Constify a char *. * jcf-write.c (append_innerclasses_attribute, make_class_file_name): Constify a char *. Don't recycle a variable for an unrelated purpose. * parse.y: (build_alias_initializer_parameter_list): Constify a char *. (breakdown_qualified): Do not modify IDENTIFIER_POINTER strings. From-SVN: r36055
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog39
-rw-r--r--gcc/c-common.c17
-rw-r--r--gcc/c-common.h9
-rw-r--r--gcc/c-decl.c12
-rw-r--r--gcc/c-pragma.h6
-rw-r--r--gcc/calls.c8
-rw-r--r--gcc/ch/ChangeLog6
-rw-r--r--gcc/ch/inout.c3
-rw-r--r--gcc/ch/lex.c2
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/input.c6
-rw-r--r--gcc/cp/mangle.c4
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/dependence.c40
-rw-r--r--gcc/f/ChangeLog4
-rw-r--r--gcc/f/ansify.c2
-rw-r--r--gcc/java/ChangeLog9
-rw-r--r--gcc/java/jcf-parse.c2
-rw-r--r--gcc/java/jcf-write.c16
-rw-r--r--gcc/java/parse.y13
-rw-r--r--gcc/profile.c3
-rw-r--r--gcc/stor-layout.c2
-rw-r--r--gcc/tree.c2
-rw-r--r--gcc/tree.h2
-rw-r--r--gcc/varasm.c320
27 files changed, 318 insertions, 230 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 79d622e..3ef282b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,42 @@
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * c-common.c (declare_function_name): Use func_id_node,
+ function_id_node, and pretty_function_id_node. Do not make
+ __func__ visible at file scope.
+ * c-common.h (c_tree_index): Add CTI_FUNCTION_ID,
+ CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID.
+ (function_id_node, pretty_function_id_node, func_id_node): New
+ macros.
+ * c-decl.c (init_decl_processing): Initialize function_id_node,
+ pretty_function_id_node, and func_id_node.
+ (c_make_fname_decl): Correct comment.
+
+ * tree.h (struct tree_identifier): Constify pointer member.
+
+ * c-decl.c (pushdecl, implicit_decl_warning): Constify a char *.
+ * c-pragma.h (struct weak_syms): Constify name and value members.
+ (add_weak): Constify arguments.
+
+ * calls.c (special_function_p): Constify a char *.
+ (expand_call): Remove variable which is initialized and then
+ never used.
+ * dependence.c (struct def_use, struct induction, struct subscript):
+ Constify 'variable' member.
+ (get_low_bound, have_induction_variable): Constify char * argument.
+ (find_induction_variable): Add braces to avoid dangling else.
+ (classify_dependence): Constify char * arrays.
+ * profile.c (output_func_start_profiler): Constify a char *.
+ * stor-layout.c (finalize_record_size): Constify a char *.
+ * tree.c (is_attribute_p): Constify a char *.
+ * varasm.c (add_weak, remove_from_pending_weak_list): Constify argument.
+
+ * varasm.c (make_function_rtl, make_decl_rtl): Rearrange code
+ for comprehensibility. Do not call get_identifier if we did
+ not change the DECL_ASSEMBLER_NAME of the decl. Use alloca to
+ create temporary string constants, not ggc_alloc_string. No
+ need to copy result of ASM_FORMAT_PRIVATE_NAME. Use const
+ char * to hold IDENTIFIER_POINTERs.
+
2000-08-29 Richard Henderson <rth@cygnus.com>
* config/ia64/ia64.md (muldi3): Use grfr_register_operand
diff --git a/gcc/c-common.c b/gcc/c-common.c
index cf145ca..7fcdbeb 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -130,6 +130,12 @@ enum cpp_token cpp_token;
tree void_list_node;
+ The identifiers __FUNCTION__, __PRETTY_FUNCTION__, and __func__.
+
+ tree function_id_node;
+ tree pretty_function_id_node;
+ tree func_id_node;
+
*/
tree c_global_trees[CTI_MAX];
@@ -271,13 +277,14 @@ declare_function_name ()
else
name = "";
printable_name = (*decl_printable_name) (current_function_decl, 2);
+
+ /* ISO C99 defines __func__, which is a variable, not a string
+ constant, and which is not a defined symbol at file scope. */
+ (*make_fname_decl) (func_id_node, name, 0);
}
- (*make_fname_decl) (get_identifier ("__FUNCTION__"), name, 0);
- (*make_fname_decl) (get_identifier ("__PRETTY_FUNCTION__"), printable_name, 1);
- /* The ISO C people "of course" couldn't use __FUNCTION__ in the
- ISO C 99 standard; instead a new variable is invented. */
- (*make_fname_decl) (get_identifier ("__func__"), name, 0);
+ (*make_fname_decl) (function_id_node, name, 0);
+ (*make_fname_decl) (pretty_function_id_node, printable_name, 1);
}
/* Given a chain of STRING_CST nodes,
diff --git a/gcc/c-common.h b/gcc/c-common.h
index ab294ed..2d9e7b0 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -118,6 +118,11 @@ enum c_tree_index
CTI_G77_LONGINT_TYPE,
CTI_G77_ULONGINT_TYPE,
+ /* These are not types, but we have to look them up all the time. */
+ CTI_FUNCTION_ID,
+ CTI_PRETTY_FUNCTION_ID,
+ CTI_FUNC_ID,
+
CTI_MAX
};
@@ -153,6 +158,10 @@ enum c_tree_index
#define g77_longint_type_node c_global_trees[CTI_G77_LONGINT_TYPE]
#define g77_ulongint_type_node c_global_trees[CTI_G77_ULONGINT_TYPE]
+#define function_id_node c_global_trees[CTI_FUNCTION_ID]
+#define pretty_function_id_node c_global_trees[CTI_PRETTY_FUNCTION_ID]
+#define func_id_node c_global_trees[CTI_FUNC_ID]
+
extern tree c_global_trees[CTI_MAX];
typedef enum c_language_kind
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 545ac88..6820ced 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2439,7 +2439,7 @@ pushdecl (x)
/* No shadow warnings for vars made for inlining. */
&& ! DECL_FROM_INLINE (x))
{
- char *id = IDENTIFIER_POINTER (name);
+ const char *id = IDENTIFIER_POINTER (name);
if (TREE_CODE (x) == PARM_DECL
&& current_binding_level->level_chain->parm_flag)
@@ -2560,7 +2560,7 @@ void
implicit_decl_warning (id)
tree id;
{
- char *name = IDENTIFIER_POINTER (id);
+ const char *name = IDENTIFIER_POINTER (id);
if (mesg_implicit_function_declaration == 2)
error ("implicit declaration of function `%s'", name);
else if (mesg_implicit_function_declaration == 1)
@@ -3187,7 +3187,11 @@ init_decl_processing ()
pedantic_lvalues = pedantic;
- /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */
+ /* Create the global bindings for __FUNCTION__, __PRETTY_FUNCTION__,
+ and __func__. */
+ function_id_node = get_identifier ("__FUNCTION__");
+ pretty_function_id_node = get_identifier ("__PRETTY_FUNCTION__");
+ func_id_node = get_identifier ("__func__");
make_fname_decl = c_make_fname_decl;
declare_function_name ();
@@ -3217,7 +3221,7 @@ init_decl_processing ()
delayed emission of static data, we mark the decl as emitted
so it is not placed in the output. Anything using it must therefore pull
out the STRING_CST initializer directly. This does mean that these names
- are string merging candidates, which C99 does not permit. */
+ are string merging candidates, which is wrong for C99's __func__. FIXME. */
static tree
c_make_fname_decl (id, name, type_dep)
diff --git a/gcc/c-pragma.h b/gcc/c-pragma.h
index be94442..65b1cc4 100644
--- a/gcc/c-pragma.h
+++ b/gcc/c-pragma.h
@@ -47,14 +47,14 @@ Boston, MA 02111-1307, USA. */
struct weak_syms
{
struct weak_syms * next;
- char * name;
- char * value;
+ const char * name;
+ const char * value;
};
/* Declared in varasm.c */
extern struct weak_syms * weak_decls;
-extern int add_weak PARAMS ((char *, char *));
+extern int add_weak PARAMS ((const char *, const char *));
#endif /* HANDLE_PRAGMA_WEAK */
diff --git a/gcc/calls.c b/gcc/calls.c
index 605c5ae..ed35daf 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -683,8 +683,8 @@ special_function_p (fndecl, flags)
think they are. */
&& DECL_CONTEXT (fndecl) == NULL_TREE && TREE_PUBLIC (fndecl))
{
- char *name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
- char *tname = name;
+ const char *name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
+ const char *tname = name;
/* We assume that alloca will always be called by name. It
makes no sense to pass it as a pointer-to-function to
@@ -2070,7 +2070,6 @@ expand_call (exp, target, ignore)
/* Declaration of the function being called,
or 0 if the function is computed (not known by name). */
tree fndecl = 0;
- char *name = 0;
rtx insn;
int try_tail_call = 1;
int try_tail_recursion = 1;
@@ -2289,9 +2288,6 @@ expand_call (exp, target, ignore)
return temp;
}
- if (fndecl && DECL_NAME (fndecl))
- name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
-
/* Figure out the amount to which the stack should be aligned. */
#ifdef PREFERRED_STACK_BOUNDARY
preferred_stack_boundary = PREFERRED_STACK_BOUNDARY;
diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog
index 9c15d17..44049cc 100644
--- a/gcc/ch/ChangeLog
+++ b/gcc/ch/ChangeLog
@@ -1,3 +1,9 @@
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * inout.c (add_enum_to_list): Use DECL_NAME directly, don't get
+ its IDENTIFIER_POINTER and immediately call get_identifier on it.
+ * lex.c (yywrap): Constify a char *.
+
2000-08-24 Mark Mitchell <mark@codesourcery.com>
* Make-lang.in (cc1chill): Don't depend on c-iterate.o.
diff --git a/gcc/ch/inout.c b/gcc/ch/inout.c
index 56164ac..ff2de0a 100644
--- a/gcc/ch/inout.c
+++ b/gcc/ch/inout.c
@@ -130,8 +130,7 @@ static tree add_enum_to_list (type, context)
if (wrk->context == context && wrk->type == type)
{
/* yes, found. look if the ptrdecl is valid in this scope */
- char *name = IDENTIFIER_POINTER (DECL_NAME (wrk->ptrdecl));
- tree var = get_identifier (name);
+ tree var = DECL_NAME (wrk->ptrdecl);
tree decl = lookup_name (var);
if (decl == NULL_TREE)
diff --git a/gcc/ch/lex.c b/gcc/ch/lex.c
index cd433ca..868d8ed 100644
--- a/gcc/ch/lex.c
+++ b/gcc/ch/lex.c
@@ -2158,7 +2158,7 @@ yywrap ()
if (next_file_to_seize && !grant_only_flag)
{
FILE *grt_in = NULL;
- char *seizefile_name_chars
+ const char *seizefile_name_chars
= IDENTIFIER_POINTER (TREE_VALUE (next_file_to_seize));
/* find a seize file, open it. If it's not at the path the
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 325872d..84954e7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * class.c (build_secondary_vtable): Constify a char *.
+ * decl.c (init_decl_processing): Initialize function_id_node,
+ pretty_function_id_node, and func_id_node.
+ * input.c (struct input_source): Constify 'str'.
+ (feed_input): Constify first argument.
+ * mangle.c (write_identifier): Constify argument.
+ * pt.c (mangle_class_name_for_template): Constify argument.
+
2000-08-29 Mark Mitchell <mark@codesourcery.com>
* typeck.c (mark_addressable): Remove code that pokes around in
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index dfbdc94..c10f09d 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -855,7 +855,8 @@ build_secondary_vtable (binfo, for_type)
tree new_decl;
tree offset;
tree path = binfo;
- char *buf, *buf2;
+ char *buf;
+ const char *buf2;
char joiner = '_';
int i;
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 552070b..e84232d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6671,6 +6671,10 @@ init_decl_processing ()
flag_weak = 0;
/* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */
+ function_id_node = get_identifier ("__FUNCTION__");
+ pretty_function_id_node = get_identifier ("__PRETTY_FUNCTION__");
+ func_id_node = get_identifier ("__func__");
+
make_fname_decl = cp_make_fname_decl;
declare_function_name ();
diff --git a/gcc/cp/input.c b/gcc/cp/input.c
index 8c96c37..431fed7 100644
--- a/gcc/cp/input.c
+++ b/gcc/cp/input.c
@@ -45,7 +45,7 @@ static struct putback_buffer putback = {NULL, 0, -1};
struct input_source {
/* saved string */
- char *str;
+ const char *str;
int length;
/* current position, when reading as input */
int offset;
@@ -67,7 +67,7 @@ extern unsigned char *yy_cur, *yy_lim;
extern int yy_get_token ();
#endif
-extern void feed_input PARAMS ((char *, int, const char *, int));
+extern void feed_input PARAMS ((const char *, int, const char *, int));
extern void put_input PARAMS ((int));
extern void put_back PARAMS ((int));
extern int getch PARAMS ((void));
@@ -109,7 +109,7 @@ free_input (inp)
inline
void
feed_input (str, len, file, line)
- char *str;
+ const char *str;
int len;
const char *file;
int line;
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 98f59ab..fb4d166 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -156,7 +156,7 @@ static void write_source_name PARAMS ((tree));
static void write_number PARAMS ((unsigned HOST_WIDE_INT, int,
unsigned int));
static void write_integer_cst PARAMS ((tree));
-static void write_identifier PARAMS ((char *));
+static void write_identifier PARAMS ((const char *));
static void write_special_name_constructor PARAMS ((tree));
static void write_special_name_destructor PARAMS ((tree));
static void write_type PARAMS ((tree));
@@ -1053,7 +1053,7 @@ write_integer_cst (cst)
static void
write_identifier (identifier)
- char *identifier;
+ const char *identifier;
{
MANGLE_TRACE ("identifier", identifier);
write_string (identifier);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 59fe306..9da72ee 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -103,7 +103,7 @@ static void add_pending_template PARAMS ((tree));
static int push_tinst_level PARAMS ((tree));
static void reopen_tinst_level PARAMS ((tree));
static tree classtype_mangled_name PARAMS ((tree));
-static char *mangle_class_name_for_template PARAMS ((char *, tree, tree));
+static char *mangle_class_name_for_template PARAMS ((const char *, tree, tree));
static tree tsubst_initializer_list PARAMS ((tree, tree));
static int list_eq PARAMS ((tree, tree));
static tree get_class_bindings PARAMS ((tree, tree, tree));
@@ -3504,7 +3504,7 @@ comp_template_args (oldargs, newargs)
static char *
mangle_class_name_for_template (name, parms, arglist)
- char *name;
+ const char *name;
tree parms, arglist;
{
static struct obstack scratch_obstack;
diff --git a/gcc/dependence.c b/gcc/dependence.c
index ac6abda..141d9ac 100644
--- a/gcc/dependence.c
+++ b/gcc/dependence.c
@@ -89,7 +89,7 @@ typedef struct def_use
/* this expression */
tree expression;
/* our name */
- char *variable;
+ const char *variable;
/* def or use */
enum def_use_type type;
/* status flags */
@@ -126,7 +126,7 @@ typedef struct loop
typedef struct induction
{
/* our name */
- char *variable;
+ const char *variable;
/* increment. Currently only +1 or -1 */
int increment;
/* lower bound */
@@ -161,7 +161,7 @@ typedef struct subscript
/* Y in X * i + Y */
int offset;
/* our name */
- char *variable;
+ const char *variable;
/* next subscript term. Currently null. */
struct subscript *next;
} subscript;
@@ -186,8 +186,8 @@ void init_dependence_analysis PARAMS ((tree));
static void build_def_use PARAMS ((tree, enum def_use_type));
static loop* add_loop PARAMS ((tree, tree, int));
static int find_induction_variable PARAMS ((tree, tree, tree, loop*));
-static int get_low_bound PARAMS ((tree, char*));
-static int have_induction_variable PARAMS ((tree, char*));
+static int get_low_bound PARAMS ((tree, const char*));
+static int have_induction_variable PARAMS ((tree, const char*));
static void link_loops PARAMS ((void));
static void get_node_dependence PARAMS ((void));
static void check_node_dependence PARAMS ((def_use*));
@@ -518,17 +518,23 @@ find_induction_variable (init_node, cond_node, incr_node, loop_def)
if (TREE_CODE (TREE_OPERAND (cond_node, 0)) == VAR_DECL
&& IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (cond_node, 0)))
== ind_ptr->variable)
- if (TREE_CODE (TREE_OPERAND (cond_node, 1)) == INTEGER_CST)
- ind_ptr->high_bound = TREE_INT_CST_LOW (TREE_OPERAND (cond_node, 1));
- else
- ind_ptr->high_bound = ind_ptr->increment < 0 ? INT_MIN : INT_MAX;
+ {
+ if (TREE_CODE (TREE_OPERAND (cond_node, 1)) == INTEGER_CST)
+ ind_ptr->high_bound =
+ TREE_INT_CST_LOW (TREE_OPERAND (cond_node, 1));
+ else
+ ind_ptr->high_bound = ind_ptr->increment < 0 ? INT_MIN : INT_MAX;
+ }
else if (TREE_CODE (TREE_OPERAND (cond_node, 1)) == VAR_DECL
&& IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (cond_node, 1)))
== ind_ptr->variable)
- if (TREE_CODE (TREE_OPERAND (cond_node, 0)) == INTEGER_CST)
- ind_ptr->high_bound = TREE_INT_CST_LOW (TREE_OPERAND (cond_node, 0));
- else
- ind_ptr->high_bound = ind_ptr->increment < 0 ? INT_MIN : INT_MAX;
+ {
+ if (TREE_CODE (TREE_OPERAND (cond_node, 0)) == INTEGER_CST)
+ ind_ptr->high_bound =
+ TREE_INT_CST_LOW (TREE_OPERAND (cond_node, 0));
+ else
+ ind_ptr->high_bound = ind_ptr->increment < 0 ? INT_MIN : INT_MAX;
+ }
ind_ptr->next = 0;
return 1;
}
@@ -540,7 +546,7 @@ find_induction_variable (init_node, cond_node, incr_node, loop_def)
static int
get_low_bound (node, variable)
tree node;
- char *variable;
+ const char *variable;
{
if (TREE_CODE (node) == SCOPE_STMT)
@@ -577,7 +583,7 @@ get_low_bound (node, variable)
static int
have_induction_variable (outer_loop, ind_var)
tree outer_loop;
- char *ind_var;
+ const char *ind_var;
{
induction *ind_ptr;
loop *loop_ptr;
@@ -981,8 +987,8 @@ classify_dependence (icoefficients, ocoefficients, complexity, separability,
int *separability;
int count;
{
- char *iiv_used [MAX_SUBSCRIPTS];
- char *oiv_used [MAX_SUBSCRIPTS];
+ const char *iiv_used [MAX_SUBSCRIPTS];
+ const char *oiv_used [MAX_SUBSCRIPTS];
int ocoeff [MAX_SUBSCRIPTS];
int icoeff [MAX_SUBSCRIPTS];
int idx, cidx;
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index 6a10820..19ca3799 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,7 @@
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * ansify.c: Use #line, not # <number>.
+
2000-08-24 Greg McGary <greg@mcgary.org>
* intdoc.c (ARRAY_SIZE): Remove macro.
diff --git a/gcc/f/ansify.c b/gcc/f/ansify.c
index 1c6f92d..ec99107 100644
--- a/gcc/f/ansify.c
+++ b/gcc/f/ansify.c
@@ -47,7 +47,7 @@ main(int argc, char **argv)
printf ("\
/* This file is automatically generated from `%s',\n\
which you should modify instead. */\n\
-# 1 \"%s\"\n\
+#line 1 \"%s\"\n\
",
argv[1], argv[1]);
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 55b4295..4dfa874 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,12 @@
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * jcf-parse.c (set_source_filename): Constify a char *.
+ * jcf-write.c (append_innerclasses_attribute,
+ make_class_file_name): Constify a char *. Don't recycle a
+ variable for an unrelated purpose.
+ * parse.y: (build_alias_initializer_parameter_list): Constify a char *.
+ (breakdown_qualified): Do not modify IDENTIFIER_POINTER strings.
+
2000-08-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
* expr.c (can_widen_reference_to): Fixed indentation.
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 4b00c43..02becc0 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -99,7 +99,7 @@ set_source_filename (jcf, index)
int index;
{
tree sfname_id = get_name_constant (jcf, index);
- char *sfname = IDENTIFIER_POINTER (sfname_id);
+ const char *sfname = IDENTIFIER_POINTER (sfname_id);
if (input_filename != NULL)
{
int old_len = strlen (input_filename);
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index 7ab1518..6a6d7e1 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -3161,7 +3161,7 @@ append_innerclasses_attribute (state, class)
process: itself, up and down. */
while (class && INNER_CLASS_TYPE_P (class))
{
- char *n;
+ const char *n;
decl = TYPE_NAME (class);
n = IDENTIFIER_POINTER (DECL_NAME (decl)) +
@@ -3218,8 +3218,8 @@ static char *
make_class_file_name (clas)
tree clas;
{
- const char *dname, *slash;
- char *cname, *r;
+ const char *dname, *cname, *slash;
+ char *r;
struct stat sb;
cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)),
@@ -3261,10 +3261,10 @@ make_class_file_name (clas)
dname = r + (slash - dname) + 1;
while (1)
{
- cname = strchr (dname, DIR_SEPARATOR);
- if (cname == NULL)
+ char *s = strchr (dname, DIR_SEPARATOR);
+ if (s == NULL)
break;
- *cname = '\0';
+ *s = '\0';
if (stat (r, &sb) == -1)
{
/* Try to make it. */
@@ -3275,9 +3275,9 @@ make_class_file_name (clas)
return NULL;
}
}
- *cname = DIR_SEPARATOR;
+ *s = DIR_SEPARATOR;
/* Skip consecutive separators. */
- for (dname = cname + 1; *dname && *dname == DIR_SEPARATOR; ++dname)
+ for (dname = s + 1; *dname && *dname == DIR_SEPARATOR; ++dname)
;
}
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index d67b6c7..4676153 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -5014,7 +5014,7 @@ build_alias_initializer_parameter_list (mode, class_type, parm, artificial)
for (field = TYPE_FIELDS (class_type); field; field = TREE_CHAIN (field))
if (FIELD_LOCAL_ALIAS (field))
{
- char *buffer = IDENTIFIER_POINTER (DECL_NAME (field));
+ const char *buffer = IDENTIFIER_POINTER (DECL_NAME (field));
tree purpose = NULL_TREE, value = NULL_TREE, name = NULL_TREE;
switch (mode)
@@ -10746,12 +10746,14 @@ static int
breakdown_qualified (left, right, source)
tree *left, *right, source;
{
- char *p = IDENTIFIER_POINTER (source), *base;
+ char *p, *base;
int l = IDENTIFIER_LENGTH (source);
+ base = alloca (l + 1);
+ memcpy (base, IDENTIFIER_POINTER (source), l + 1);
+
/* Breakdown NAME into REMAINDER . IDENTIFIER */
- base = p;
- p += (l-1);
+ p = base + l - 1;
while (*p != '.' && p != base)
p--;
@@ -10762,8 +10764,7 @@ breakdown_qualified (left, right, source)
*p = '\0';
if (right)
*right = get_identifier (p+1);
- *left = get_identifier (IDENTIFIER_POINTER (source));
- *p = '.';
+ *left = get_identifier (base);
return 0;
}
diff --git a/gcc/profile.c b/gcc/profile.c
index 627d6e4..fa6b230 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1069,7 +1069,8 @@ void
output_func_start_profiler ()
{
tree fnname, fndecl;
- char *name, *cfnname;
+ char *name;
+ const char *cfnname;
rtx table_address;
enum machine_mode mode = mode_for_size (LONG_TYPE_SIZE, MODE_INT, 0);
int save_flag_inline_functions = flag_inline_functions;
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 43ae6f2..af219cc 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -991,7 +991,7 @@ finalize_record_size (rli)
if (TYPE_NAME (rli->t))
{
- char *name;
+ const char *name;
if (TREE_CODE (TYPE_NAME (rli->t)) == IDENTIFIER_NODE)
name = IDENTIFIER_POINTER (TYPE_NAME (rli->t));
diff --git a/gcc/tree.c b/gcc/tree.c
index 6e96487..e1a4a7d 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3786,7 +3786,7 @@ is_attribute_p (attr, ident)
tree ident;
{
int ident_len, attr_len;
- char *p;
+ const char *p;
if (TREE_CODE (ident) != IDENTIFIER_NODE)
return 0;
diff --git a/gcc/tree.h b/gcc/tree.h
index 93a5416..e9b0da4 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -737,7 +737,7 @@ struct tree_identifier
{
struct tree_common common;
int length;
- char *pointer;
+ const char *pointer;
};
/* In a TREE_LIST node. */
diff --git a/gcc/varasm.c b/gcc/varasm.c
index b30d089..5193dd6 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -175,7 +175,7 @@ static int output_addressed_constants PARAMS ((tree));
static void output_after_function_constants PARAMS ((void));
static void output_constructor PARAMS ((tree, int));
#ifdef ASM_WEAKEN_LABEL
-static void remove_from_pending_weak_list PARAMS ((char *));
+static void remove_from_pending_weak_list PARAMS ((const char *));
#endif
#ifdef ASM_OUTPUT_BSS
static void asm_output_bss PARAMS ((FILE *, tree, const char *, int, int));
@@ -519,8 +519,27 @@ void
make_function_rtl (decl)
tree decl;
{
- char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- char *new_name = name;
+ const char *name;
+ const char *new_name;
+
+ if (DECL_RTL (decl) != 0)
+ {
+ /* ??? Another way to do this would be to do what halfpic.c does
+ and maintain a hashed table of such critters. */
+ /* ??? Another way to do this would be to pass a flag bit to
+ ENCODE_SECTION_INFO saying whether this is a new decl or not. */
+ /* Let the target reassign the RTL if it wants.
+ This is necessary, for example, when one machine specific
+ decl attribute overrides another. */
+#ifdef REDO_SECTION_INFO_P
+ if (REDO_SECTION_INFO_P (decl))
+ ENCODE_SECTION_INFO (decl);
+#endif
+ return;
+ }
+
+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+ new_name = name;
/* Rename a nested function to avoid conflicts, unless it's a member of
a local class, in which case the class name is already unique. */
@@ -530,60 +549,45 @@ make_function_rtl (decl)
&& DECL_RTL (decl) == 0)
{
char *label;
-
- name = IDENTIFIER_POINTER (DECL_NAME (decl));
ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
- name = ggc_alloc_string (label, -1);
var_labelno++;
+ new_name = label;
}
- else
+ /* When -fprefix-function-name is used, every function name is
+ prefixed. Even static functions are prefixed because they
+ could be declared latter. Note that a nested function name
+ is not prefixed. */
+ else if (flag_prefix_function_name)
{
- /* When -fprefix-function-name is used, every function name is
- prefixed. Even static functions are prefixed because they
- could be declared latter. Note that a nested function name
- is not prefixed. */
- if (flag_prefix_function_name)
- {
- size_t name_len = strlen (name);
+ size_t name_len = IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl));
+ char *pname;
- new_name = ggc_alloc_string (NULL, name_len + CHKR_PREFIX_SIZE);
- memcpy (new_name, CHKR_PREFIX, CHKR_PREFIX_SIZE);
- memcpy (new_name + CHKR_PREFIX_SIZE, name, name_len + 1);
- name = new_name;
- }
+ pname = alloca (name_len + CHKR_PREFIX_SIZE + 1);
+ memcpy (pname, CHKR_PREFIX, CHKR_PREFIX_SIZE);
+ memcpy (pname + CHKR_PREFIX_SIZE, name, name_len + 1);
+ new_name = pname;
}
- if (DECL_RTL (decl) == 0)
+ if (name != new_name)
{
- DECL_ASSEMBLER_NAME (decl) = get_identifier (name);
- DECL_RTL (decl)
- = gen_rtx_MEM (DECL_MODE (decl),
- gen_rtx_SYMBOL_REF (Pmode, name));
-
- /* Optionally set flags or add text to the name to record
- information such as that it is a function name. If the name
- is changed, the macro ASM_OUTPUT_LABELREF will have to know
- how to strip this information. */
-#ifdef ENCODE_SECTION_INFO
- ENCODE_SECTION_INFO (decl);
-#endif
+ DECL_ASSEMBLER_NAME (decl) = get_identifier (new_name);
+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
}
- else
- {
- /* ??? Another way to do this would be to do what halfpic.c does
- and maintain a hashed table of such critters. */
- /* ??? Another way to do this would be to pass a flag bit to
- ENCODE_SECTION_INFO saying whether this is a new decl or not. */
- /* Let the target reassign the RTL if it wants.
- This is necessary, for example, when one machine specific
- decl attribute overrides another. */
-#ifdef REDO_SECTION_INFO_P
- if (REDO_SECTION_INFO_P (decl))
- ENCODE_SECTION_INFO (decl);
+
+ DECL_RTL (decl)
+ = gen_rtx_MEM (DECL_MODE (decl),
+ gen_rtx_SYMBOL_REF (Pmode, name));
+
+ /* Optionally set flags or add text to the name to record
+ information such as that it is a function name. If the name
+ is changed, the macro ASM_OUTPUT_LABELREF will have to know
+ how to strip this information. */
+#ifdef ENCODE_SECTION_INFO
+ ENCODE_SECTION_INFO (decl);
#endif
- }
}
+
/* Given NAME, a putative register name, discard any customary prefixes. */
static const char *
@@ -673,54 +677,57 @@ make_decl_rtl (decl, asmspec, top_level)
const char *asmspec;
int top_level;
{
- register char *name = 0;
+ const char *name = 0;
+ const char *new_name = 0;
int reg_number;
- reg_number = decode_reg_name (asmspec);
-
- if (DECL_ASSEMBLER_NAME (decl) != NULL_TREE)
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-
- if (reg_number == -2)
+ /* For a duplicate declaration, we can be called twice on the
+ same DECL node. Don't discard the RTL already made. */
+ if (DECL_RTL (decl) != 0)
{
- /* ASMSPEC is given, and not the name of a register. */
- size_t len = strlen (asmspec);
+ /* If the old RTL had the wrong mode, fix the mode. */
+ if (GET_MODE (DECL_RTL (decl)) != DECL_MODE (decl))
+ {
+ rtx rtl = DECL_RTL (decl);
+ PUT_MODE (rtl, DECL_MODE (decl));
+ }
- name = ggc_alloc_string (NULL, len + 1);
- name[0] = '*';
- memcpy (&name[1], asmspec, len + 1);
+ /* ??? Another way to do this would be to do what halfpic.c does
+ and maintain a hashed table of such critters. */
+ /* ??? Another way to do this would be to pass a flag bit to
+ ENCODE_SECTION_INFO saying whether this is a new decl or not. */
+ /* Let the target reassign the RTL if it wants.
+ This is necessary, for example, when one machine specific
+ decl attribute overrides another. */
+#ifdef REDO_SECTION_INFO_P
+ if (REDO_SECTION_INFO_P (decl))
+ ENCODE_SECTION_INFO (decl);
+#endif
+ return;
}
- /* For a duplicate declaration, we can be called twice on the
- same DECL node. Don't discard the RTL already made. */
- if (DECL_RTL (decl) == 0)
+ new_name = name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+
+ reg_number = decode_reg_name (asmspec);
+ if (reg_number == -2)
+ /* ASMSPEC is given, and not the name of a register. */
+ new_name = asmspec;
+
+ if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
{
/* First detect errors in declaring global registers. */
- if (TREE_CODE (decl) != FUNCTION_DECL
- && DECL_REGISTER (decl) && reg_number == -1)
- error_with_decl (decl,
- "register name not specified for `%s'");
- else if (TREE_CODE (decl) != FUNCTION_DECL
- && DECL_REGISTER (decl) && reg_number < 0)
- error_with_decl (decl,
- "invalid register name for `%s'");
- else if ((reg_number >= 0 || reg_number == -3)
- && (TREE_CODE (decl) == FUNCTION_DECL
- && ! DECL_REGISTER (decl)))
- error_with_decl (decl,
- "register name given for non-register variable `%s'");
- else if (TREE_CODE (decl) != FUNCTION_DECL
- && DECL_REGISTER (decl)
- && TYPE_MODE (TREE_TYPE (decl)) == BLKmode)
+ if (reg_number == -1)
+ error_with_decl (decl, "register name not specified for `%s'");
+ else if (reg_number < 0)
+ error_with_decl (decl, "invalid register name for `%s'");
+ else if (TYPE_MODE (TREE_TYPE (decl)) == BLKmode)
error_with_decl (decl,
"data type of `%s' isn't suitable for a register");
- else if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl)
- && ! HARD_REGNO_MODE_OK (reg_number,
- TYPE_MODE (TREE_TYPE (decl))))
+ else if (! HARD_REGNO_MODE_OK (reg_number, TYPE_MODE (TREE_TYPE (decl))))
error_with_decl (decl,
- "register number for `%s' isn't suitable for data type");
+ "register specified for `%s' isn't suitable for data type");
/* Now handle properly declared static register variables. */
- else if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
+ else
{
int nregs;
@@ -754,96 +761,81 @@ make_decl_rtl (decl, asmspec, top_level)
while (nregs > 0)
globalize_reg (reg_number + --nregs);
}
+
+ /* As a register variable, it has no section. */
+ return;
}
- /* Specifying a section attribute on a variable forces it into a
- non-.bss section, and thus it cannot be common. */
- else if (TREE_CODE (decl) == VAR_DECL
- && DECL_SECTION_NAME (decl) != NULL_TREE
- && DECL_INITIAL (decl) == NULL_TREE
- && DECL_COMMON (decl))
- DECL_COMMON (decl) = 0;
-
- /* Now handle ordinary static variables and functions (in memory).
- Also handle vars declared register invalidly. */
- if (DECL_RTL (decl) == 0)
- {
- /* Can't use just the variable's own name for a variable
- whose scope is less than the whole file, unless it's a member
- of a local class (which will already be unambiguous).
- Concatenate a distinguishing number. */
- if (!top_level && !TREE_PUBLIC (decl)
- && ! (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl)))
- && asmspec == 0)
- {
- char *label;
+ }
- ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
- name = ggc_alloc_string (label, -1);
- var_labelno++;
- }
+ /* Now handle ordinary static variables and functions (in memory).
+ Also handle vars declared register invalidly. */
- if (name == 0)
- abort ();
+ if (reg_number >= 0 || reg_number == -3)
+ error_with_decl (decl,
+ "register name given for non-register variable `%s'");
- /* When -fprefix-function-name is used, the functions
- names are prefixed. Only nested function names are not
- prefixed. */
- if (flag_prefix_function_name && TREE_CODE (decl) == FUNCTION_DECL)
- {
- size_t name_len = strlen (name);
- char *new_name;
+ /* Specifying a section attribute on a variable forces it into a
+ non-.bss section, and thus it cannot be common. */
+ if (TREE_CODE (decl) == VAR_DECL
+ && DECL_SECTION_NAME (decl) != NULL_TREE
+ && DECL_INITIAL (decl) == NULL_TREE
+ && DECL_COMMON (decl))
+ DECL_COMMON (decl) = 0;
+
+ /* Can't use just the variable's own name for a variable
+ whose scope is less than the whole file, unless it's a member
+ of a local class (which will already be unambiguous).
+ Concatenate a distinguishing number. */
+ if (!top_level && !TREE_PUBLIC (decl)
+ && ! (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl)))
+ && asmspec == 0)
+ {
+ char *label;
+ ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
+ var_labelno++;
+ new_name = label;
+ }
- new_name = ggc_alloc_string (NULL, name_len + CHKR_PREFIX_SIZE);
- memcpy (new_name, CHKR_PREFIX, CHKR_PREFIX_SIZE);
- memcpy (new_name + CHKR_PREFIX_SIZE, name, name_len + 1);
- name = new_name;
- }
+ /* When -fprefix-function-name is used, the functions
+ names are prefixed. Only nested function names are not
+ prefixed. */
+ else if (flag_prefix_function_name && TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ size_t name_len = IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl));
+ char *pname;
- /* If this variable is to be treated as volatile, show its
- tree node has side effects. */
- if ((flag_volatile_global && TREE_CODE (decl) == VAR_DECL
- && TREE_PUBLIC (decl))
- || ((flag_volatile_static && TREE_CODE (decl) == VAR_DECL
- && (TREE_PUBLIC (decl) || TREE_STATIC (decl)))))
- TREE_SIDE_EFFECTS (decl) = 1;
-
- DECL_ASSEMBLER_NAME (decl)
- = get_identifier (name[0] == '*' ? name + 1 : name);
- DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
- gen_rtx_SYMBOL_REF (Pmode, name));
- if (TREE_CODE (decl) != FUNCTION_DECL)
- set_mem_attributes (DECL_RTL (decl), decl, 1);
-
- /* Optionally set flags or add text to the name to record information
- such as that it is a function name.
- If the name is changed, the macro ASM_OUTPUT_LABELREF
- will have to know how to strip this information. */
-#ifdef ENCODE_SECTION_INFO
- ENCODE_SECTION_INFO (decl);
-#endif
- }
+ pname = alloca (name_len + CHKR_PREFIX_SIZE + 1);
+ memcpy (pname, CHKR_PREFIX, CHKR_PREFIX_SIZE);
+ memcpy (pname + CHKR_PREFIX_SIZE, name, name_len + 1);
+ new_name = pname;
}
- else
+
+ if (name != new_name)
{
- /* If the old RTL had the wrong mode, fix the mode. */
- if (GET_MODE (DECL_RTL (decl)) != DECL_MODE (decl))
- {
- rtx rtl = DECL_RTL (decl);
- PUT_MODE (rtl, DECL_MODE (decl));
- }
+ DECL_ASSEMBLER_NAME (decl) = get_identifier (new_name);
+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+ }
- /* ??? Another way to do this would be to do what halfpic.c does
- and maintain a hashed table of such critters. */
- /* ??? Another way to do this would be to pass a flag bit to
- ENCODE_SECTION_INFO saying whether this is a new decl or not. */
- /* Let the target reassign the RTL if it wants.
- This is necessary, for example, when one machine specific
- decl attribute overrides another. */
-#ifdef REDO_SECTION_INFO_P
- if (REDO_SECTION_INFO_P (decl))
- ENCODE_SECTION_INFO (decl);
+ /* If this variable is to be treated as volatile, show its
+ tree node has side effects. */
+ if ((flag_volatile_global && TREE_CODE (decl) == VAR_DECL
+ && TREE_PUBLIC (decl))
+ || ((flag_volatile_static && TREE_CODE (decl) == VAR_DECL
+ && (TREE_PUBLIC (decl) || TREE_STATIC (decl)))))
+ TREE_SIDE_EFFECTS (decl) = 1;
+
+ DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
+ gen_rtx_SYMBOL_REF (Pmode, name));
+ if (TREE_CODE (decl) != FUNCTION_DECL)
+ set_mem_attributes (DECL_RTL (decl), decl, 1);
+
+ /* Optionally set flags or add text to the name to record information
+ such as that it is a function name.
+ If the name is changed, the macro ASM_OUTPUT_LABELREF
+ will have to know how to strip this information. */
+#ifdef ENCODE_SECTION_INFO
+ ENCODE_SECTION_INFO (decl);
#endif
- }
}
/* Make the rtl for variable VAR be volatile.
@@ -4656,8 +4648,8 @@ output_constructor (exp, size)
int
add_weak (name, value)
- char *name;
- char *value;
+ const char *name;
+ const char *value;
{
struct weak_syms *weak;
@@ -4724,7 +4716,7 @@ weak_finish ()
#ifdef ASM_WEAKEN_LABEL
static void
remove_from_pending_weak_list (name)
- char *name ATTRIBUTE_UNUSED;
+ const char *name ATTRIBUTE_UNUSED;
{
#ifdef HANDLE_PRAGMA_WEAK
if (HANDLE_PRAGMA_WEAK)