Add a compile-time test for PR ld/22263
[binutils-gdb.git] / ld / ldmisc.c
index 321db9a21c59f2d85b74c29a4365c8eb1d364256..420ddb13c18273f786cb4c6ef3ad1d7d00061352 100644 (file)
@@ -1,5 +1,5 @@
 /* ldmisc.c
-   Copyright (C) 1991-2016 Free Software Foundation, Inc.
+   Copyright (C) 1991-2017 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
    This file is part of the GNU Binutils.
@@ -231,13 +231,13 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                lang_input_statement_type *i;
 
                i = va_arg (arg, lang_input_statement_type *);
-               if (bfd_my_archive (i->the_bfd) != NULL
-                   && !bfd_is_thin_archive (bfd_my_archive (i->the_bfd)))
+               if (i->the_bfd->my_archive != NULL
+                   && !bfd_is_thin_archive (i->the_bfd->my_archive))
                  fprintf (fp, "(%s)",
-                          bfd_get_filename (bfd_my_archive (i->the_bfd)));
+                          bfd_get_filename (i->the_bfd->my_archive));
                fprintf (fp, "%s", i->local_sym_name);
-               if ((bfd_my_archive (i->the_bfd) == NULL
-                    || bfd_is_thin_archive (bfd_my_archive (i->the_bfd)))
+               if ((i->the_bfd->my_archive == NULL
+                    || bfd_is_thin_archive (i->the_bfd->my_archive))
                    && filename_cmp (i->local_sym_name, i->filename) != 0)
                  fprintf (fp, " (%s)", i->filename);
              }
@@ -280,8 +280,8 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                 The arguments are a BFD, a section, and an offset.  */
              {
                static bfd *last_bfd;
-               static char *last_file = NULL;
-               static char *last_function = NULL;
+               static char *last_file;
+               static char *last_function;
                bfd *abfd;
                asection *section;
                bfd_vma offset;
@@ -331,9 +331,9 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                           (eg emacs) to correctly locate multiple
                           errors in the same source file.  */
                        if (last_bfd == NULL
-                           || last_file == NULL
                            || last_function == NULL
                            || last_bfd != abfd
+                           || (last_file == NULL) != (filename == NULL)
                            || (filename != NULL
                                && filename_cmp (last_file, filename) != 0)
                            || strcmp (last_function, functionname) != 0)
@@ -425,7 +425,7 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                  ++fmt;
                  break;
                }
-             /* Fall thru */
+             /* Fallthru */
 
            default:
              fprintf (fp, "%%%c", fmt[-1]);