summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/collect2.c63
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/mangle.c6
-rw-r--r--gcc/gcc.c20
5 files changed, 49 insertions, 52 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6ea0c949f9c..70d0494f7e0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2001-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * collect2.c (main): Const-ification.
+ * gcc.c (translate_options, process_command): Use xstrdup in
+ lieu of xmalloc/strcpy.
+ (main): Use concat in lieu of xmalloc/strcpy/strcat.
+
2001-09-14 Roman Lechtchinsky <rl@cs.tu-berlin.de>
* doc/install.texi (Specific, alphaev5-cray-unicosmk*): Fix
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 4877790eaf5..dc3b7f8f258 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -797,21 +797,47 @@ main (argc, argv)
char *argv[];
{
static const char *const ld_suffix = "ld";
- const char *full_ld_suffix = ld_suffix;
static const char *const real_ld_suffix = "real-ld";
static const char *const collect_ld_suffix = "collect-ld";
static const char *const nm_suffix = "nm";
- const char *full_nm_suffix = nm_suffix;
static const char *const gnm_suffix = "gnm";
- const char *full_gnm_suffix = gnm_suffix;
#ifdef LDD_SUFFIX
static const char *const ldd_suffix = LDD_SUFFIX;
- const char *full_ldd_suffix = ldd_suffix;
#endif
static const char *const strip_suffix = "strip";
- const char *full_strip_suffix = strip_suffix;
static const char *const gstrip_suffix = "gstrip";
- const char *full_gstrip_suffix = gstrip_suffix;
+
+#ifdef CROSS_COMPILE
+ /* If we look for a program in the compiler directories, we just use
+ the short name, since these directories are already system-specific.
+ But it we look for a program in the system directories, we need to
+ qualify the program name with the target machine. */
+
+ const char *const full_ld_suffix =
+ concat(target_machine, "-", ld_suffix, NULL);
+ const char *const full_nm_suffix =
+ concat (target_machine, "-", nm_suffix, NULL);
+ const char *const full_gnm_suffix =
+ concat (target_machine, "-", gnm_suffix, NULL);
+#ifdef LDD_SUFFIX
+ const char *const full_ldd_suffix =
+ concat (target_machine, "-", ldd_suffix, NULL);
+#endif
+ const char *const full_strip_suffix =
+ concat (target_machine, "-", strip_suffix, NULL);
+ const char *const full_gstrip_suffix =
+ concat (target_machine, "-", gstrip_suffix, NULL);
+#else
+ const char *const full_ld_suffix = ld_suffix;
+ const char *const full_nm_suffix = nm_suffix;
+ const char *const full_gnm_suffix = gnm_suffix;
+#ifdef LDD_SUFFIX
+ const char *const full_ldd_suffix = ldd_suffix;
+#endif
+ const char *const full_strip_suffix = strip_suffix;
+ const char *const full_gstrip_suffix = gstrip_suffix;
+#endif /* CROSS_COMPILE */
+
const char *arg;
FILE *outf;
#ifdef COLLECT_EXPORT_LIST
@@ -936,31 +962,6 @@ main (argc, argv)
prefix_from_env ("COMPILER_PATH", &cpath);
prefix_from_env ("PATH", &path);
-#ifdef CROSS_COMPILE
- /* If we look for a program in the compiler directories, we just use
- the short name, since these directories are already system-specific.
- But it we look for a program in the system directories, we need to
- qualify the program name with the target machine. */
-
- full_ld_suffix = concat(target_machine, "-", ld_suffix, NULL);
-
-#if 0
- full_gld_suffix = concat (target_machine, "-", gld_suffix, NULL);
-#endif
-
- full_nm_suffix = concat (target_machine, "-", nm_suffix, NULL);
-
- full_gnm_suffix = concat (target_machine, "-", gnm_suffix, NULL);
-
-#ifdef LDD_SUFFIX
- full_ldd_suffix = concat (target_machine, "-", ldd_suffix, NULL);
-#endif
-
- full_strip_suffix = concat (target_machine, "-", strip_suffix, NULL);
-
- full_gstrip_suffix = concat (target_machine, "-", gstrip_suffix, NULL);
-#endif /* CROSS_COMPILE */
-
/* Try to discover a valid linker/nm/strip to use. */
/* Maybe we know the right file to use (if not cross). */
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ef48dc301cf..38358428658 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * mangle.c (mangle_conv_op_name_for_type): Use concat in lieu of
+ xmalloc/strcpy/strcat.
+
2001-09-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* decl.c (warn_extern_redeclared_static, cp_make_fname_decl):
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 6e94681e51e..6ad9ffa3f26 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2392,11 +2392,7 @@ mangle_conv_op_name_for_type (type)
/* Build the mangling for TYPE. */
const char *mangled_type = mangle_type_string (type);
/* Allocate a temporary buffer for the complete name. */
- char *op_name = (char *) xmalloc (strlen ("operator ")
- + strlen (mangled_type) + 1);
- /* Assemble the mangling. */
- strcpy (op_name, "operator ");
- strcat (op_name, mangled_type);
+ char *op_name = concat ("operator ", mangled_type, NULL);
/* Find or create an identifier. */
identifier = get_identifier (op_name);
/* Done with the temporary buffer. */
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 9b6c1e50ff4..55188cf6359 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1011,8 +1011,7 @@ translate_options (argcp, argvp)
newv = (const char **) xrealloc (newv, newvsize);
sp = target_option_translations[tott_idx].replacements;
- np = (char *) xmalloc (strlen (sp) + 1);
- strcpy (np, sp);
+ np = xstrdup (sp);
while (1)
{
@@ -3910,15 +3909,13 @@ process_command (argc, argv)
/* On some systems, ld cannot handle some options without
a space. So split the option from its argument. */
char *part1 = (char *) xmalloc (2);
- char *tmp;
part1[0] = c;
part1[1] = '\0';
switches[n_switches].part1 = part1;
switches[n_switches].args
= (const char **) xmalloc (2 * sizeof (const char *));
- switches[n_switches].args[0] = tmp = xmalloc (strlen (p));
- strcpy (tmp, &p[1]);
+ switches[n_switches].args[0] = xstrdup (p+1);
switches[n_switches].args[1] = 0;
}
else
@@ -5812,17 +5809,8 @@ main (argc, argv)
/* If we have a GCC_EXEC_PREFIX envvar, modify it for cpp's sake. */
if (gcc_exec_prefix)
- {
- char *temp = (char *) xmalloc (strlen (gcc_exec_prefix)
- + strlen (spec_version)
- + strlen (spec_machine) + 3);
- strcpy (temp, gcc_exec_prefix);
- strcat (temp, spec_machine);
- strcat (temp, dir_separator_str);
- strcat (temp, spec_version);
- strcat (temp, dir_separator_str);
- gcc_exec_prefix = temp;
- }
+ gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
+ spec_version, dir_separator_str, NULL);
/* Now we have the specs.
Set the `valid' bits for switches that match anything in any spec. */