aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
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/java
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/java')
-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
4 files changed, 25 insertions, 15 deletions
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;
}