static struct path_prefix libpath_lib_dirs; /* directories in LIBPATH */
static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs,
&libpath_lib_dirs, NULL};
-static const char *libexts[3] = {"a", "so", NULL}; /* possible library extentions */
+static const char *const libexts[3] = {"a", "so", NULL}; /* possible library extentions */
#endif
static void handler PARAMS ((int));
void
notice VPARAMS ((const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- msgid = va_arg (ap, const char *);
-#endif
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
vfprintf (stderr, _(msgid), ap);
- va_end (ap);
+ VA_CLOSE (ap);
}
/* Die when sys call fails. */
void
fatal_perror VPARAMS ((const char * msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- const char *msgid;
-#endif
int e = errno;
- va_list ap;
-
- VA_START (ap, msgid);
-#ifndef ANSI_PROTOTYPES
- msgid = va_arg (ap, const char *);
-#endif
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
fprintf (stderr, "collect2: ");
vfprintf (stderr, _(msgid), ap);
fprintf (stderr, ": %s\n", xstrerror (e));
- va_end (ap);
+ VA_CLOSE (ap);
collect_exit (FATAL_EXIT_CODE);
}
void
fatal VPARAMS ((const char * msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- msgid = va_arg (ap, const char *);
-#endif
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
fprintf (stderr, "collect2: ");
vfprintf (stderr, _(msgid), ap);
fprintf (stderr, "\n");
- va_end (ap);
+ VA_CLOSE (ap);
collect_exit (FATAL_EXIT_CODE);
}
void
error VPARAMS ((const char * msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- const char * msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- msgid = va_arg (ap, const char *);
-#endif
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
fprintf (stderr, "collect2: ");
vfprintf (stderr, _(msgid), ap);
fprintf (stderr, "\n");
- va_end(ap);
+ VA_CLOSE(ap);
}
/* In case obstack is linked in, and abort is defined to fancy_abort,
{
int c;
while (c = getc (stream),
- c != EOF && (ISALNUM (c) || c == '_' || c == '$' || c == '.'))
+ c != EOF && (ISIDNUM (c) || c == '$' || c == '.'))
obstack_1grow (&temporary_obstack, c);
if (obstack_object_size (&temporary_obstack) > 0)
{
is_ctor_dtor (s)
const char *s;
{
- struct names { const char *name; int len; int ret; int two_underscores; };
+ struct names { const char *const name; const int len; const int ret;
+ const int two_underscores; };
- register struct names *p;
- register int ch;
- register const char *orig_s = s;
+ struct names *p;
+ int ch;
+ const char *orig_s = s;
static struct names special[] = {
{ "GLOBAL__I_", sizeof ("GLOBAL__I_")-1, 1, 0 },
int argc;
char *argv[];
{
- const char *ld_suffix = "ld";
- const char *full_ld_suffix = ld_suffix;
- const char *real_ld_suffix = "real-ld";
- const char *collect_ld_suffix = "collect-ld";
- const char *nm_suffix = "nm";
- const char *full_nm_suffix = nm_suffix;
- const char *gnm_suffix = "gnm";
- const char *full_gnm_suffix = gnm_suffix;
+ static const char *const ld_suffix = "ld";
+ 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";
+ static const char *const gnm_suffix = "gnm";
#ifdef LDD_SUFFIX
- const char *ldd_suffix = LDD_SUFFIX;
- const char *full_ldd_suffix = ldd_suffix;
+ static const char *const ldd_suffix = LDD_SUFFIX;
#endif
- const char *strip_suffix = "strip";
- const char *full_strip_suffix = strip_suffix;
- const char *gstrip_suffix = "gstrip";
- const char *full_gstrip_suffix = gstrip_suffix;
+ static const char *const strip_suffix = "strip";
+ static const char *const gstrip_suffix = "gstrip";
+
+#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
signal (SIGCHLD, SIG_DFL);
#endif
-/* LC_CTYPE determines the character set used by the terminal so it has be set
- to output messages correctly. */
-
-#ifdef HAVE_LC_MESSAGES
- setlocale (LC_CTYPE, "");
- setlocale (LC_MESSAGES, "");
-#else
- setlocale (LC_ALL, "");
-#endif
-
- (void) bindtextdomain (PACKAGE, localedir);
- (void) textdomain (PACKAGE);
+ gcc_init_libintl ();
/* Do not invoke xcalloc before this point, since locale needs to be
set first, in case a diagnostic is issued. */
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). */
/* It has a valid numeric extension, prefer this one. */
if (*e1 == '.' && e1[1] && ISDIGIT (e1[1]))
return 1;
- /* It has a invalid numeric extension, must prefer the other one. */
+ /* It has an invalid numeric extension, must prefer the other one. */
else
return -1;
}
/* It has a valid numeric extension, prefer this one. */
if (*e2 == '.' && e2[1] && ISDIGIT (e2[1]))
return -1;
- /* It has a invalid numeric extension, must prefer the other one. */
+ /* It has an invalid numeric extension, must prefer the other one. */
else
return 1;
}
/* Array of standard AIX libraries which should not
be scanned for ctors/dtors. */
-static const char *aix_std_libs[] = {
+static const char *const aix_std_libs[] = {
"/unix",
"/lib/libc.a",
"/lib/libm.a",
ignore_library (name)
const char *name;
{
- const char **p = &aix_std_libs[0];
+ const char *const *p = &aix_std_libs[0];
while (*p++ != NULL)
if (! strcmp (name, *p)) return 1;
return 0;