public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFA:] Prepend "warning: " to "user" linker warnings, as ELF does.
@ 2005-02-06 18:22 Hans-Peter Nilsson
  2005-02-07  7:58 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Hans-Peter Nilsson @ 2005-02-06 18:22 UTC (permalink / raw)
  To: binutils

The ELF section warning construct was recentlish (2003-08-04)
changed to have "warning: " prepended, so for symmetry I suggest
all (i.e. including the a.out stabs construct) do the same (or
I'll have to submit the corresponding a/symmetric patch to
newlib).  I expect even less breakage on a.out, compared to the
ELF-only change. ;-)  No test-cases need be adjusted, but
forthcoming test-cases depend on this.

Since the ELF warnings go through here, that "warning: " string
would be doubled, so I removed it.  Yay, removed code!
Translating "warning: " for *those* messages in ldmain.c is now
inconsistent; other "warning: " strings aren't.  Should they all
be translated or left alone?

Ok to commit?

bfd:
	* elflink.c (elf_link_add_object_symbols): Don't add "warning: "
	prefix here.

ld:
	* ldmain.c (warning_callback, warning_find_reloc): Prepend
	"warning: " to warning messages.


Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.129
diff -c -p -r1.129 elflink.c
*** bfd/elflink.c	3 Feb 2005 14:12:49 -0000	1.129
--- bfd/elflink.c	6 Feb 2005 14:28:23 -0000
*************** elf_link_add_object_symbols (bfd *abfd, 
*** 3142,3149 ****
  	    {
  	      char *msg;
  	      bfd_size_type sz;
- 	      bfd_size_type prefix_len;
- 	      const char * gnu_warning_prefix = _("warning: ");
  
  	      name += sizeof ".gnu.warning." - 1;
  
--- 3142,3147 ----
*************** elf_link_add_object_symbols (bfd *abfd, 
*** 3177,3192 ****
  		}
  
  	      sz = s->size;
! 	      prefix_len = strlen (gnu_warning_prefix);
! 	      msg = bfd_alloc (abfd, prefix_len + sz + 1);
  	      if (msg == NULL)
  		goto error_return;
  
! 	      strcpy (msg, gnu_warning_prefix);
! 	      if (! bfd_get_section_contents (abfd, s, msg + prefix_len, 0, sz))
  		goto error_return;
  
! 	      msg[prefix_len + sz] = '\0';
  
  	      if (! (_bfd_generic_link_add_one_symbol
  		     (info, abfd, name, BSF_WARNING, s, 0, msg,
--- 3175,3188 ----
  		}
  
  	      sz = s->size;
! 	      msg = bfd_alloc (abfd, sz + 1);
  	      if (msg == NULL)
  		goto error_return;
  
! 	      if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
  		goto error_return;
  
! 	      msg[sz] = '\0';
  
  	      if (! (_bfd_generic_link_add_one_symbol
  		     (info, abfd, name, BSF_WARNING, s, 0, msg,
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.91
diff -c -p -r1.91 ldmain.c
*** ld/ldmain.c	19 Jan 2005 11:42:49 -0000	1.91
--- ld/ldmain.c	6 Feb 2005 14:28:23 -0000
*************** warning_callback (struct bfd_link_info *
*** 1200,1210 ****
      return TRUE;
  
    if (section != NULL)
!     einfo ("%C: %s\n", abfd, section, address, warning);
    else if (abfd == NULL)
!     einfo ("%P: %s\n", warning);
    else if (symbol == NULL)
!     einfo ("%B: %s\n", abfd, warning);
    else
      {
        lang_input_statement_type *entry;
--- 1200,1210 ----
      return TRUE;
  
    if (section != NULL)
!     einfo ("%C: %s%s\n", abfd, section, address, _("warning: "), warning);
    else if (abfd == NULL)
!     einfo ("%P: %s%s\n", _("warning: "), warning);
    else if (symbol == NULL)
!     einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
    else
      {
        lang_input_statement_type *entry;
*************** warning_callback (struct bfd_link_info *
*** 1242,1248 ****
        bfd_map_over_sections (abfd, warning_find_reloc, &info);
  
        if (! info.found)
! 	einfo ("%B: %s\n", abfd, warning);
  
        if (entry == NULL)
  	free (asymbols);
--- 1242,1248 ----
        bfd_map_over_sections (abfd, warning_find_reloc, &info);
  
        if (! info.found)
! 	einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
  
        if (entry == NULL)
  	free (asymbols);
*************** warning_find_reloc (bfd *abfd, asection 
*** 1290,1296 ****
  	  && strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0)
  	{
  	  /* We found a reloc for the symbol we are looking for.  */
! 	  einfo ("%C: %s\n", abfd, sec, q->address, info->warning);
  	  info->found = TRUE;
  	  break;
  	}
--- 1290,1297 ----
  	  && strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0)
  	{
  	  /* We found a reloc for the symbol we are looking for.  */
! 	  einfo ("%C: %s%s\n", abfd, sec, q->address, _("warning: "),
! 		 info->warning);
  	  info->found = TRUE;
  	  break;
  	}

brgds, H-P

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA:] Prepend "warning: " to "user" linker warnings, as ELF does.
  2005-02-06 18:22 [RFA:] Prepend "warning: " to "user" linker warnings, as ELF does Hans-Peter Nilsson
@ 2005-02-07  7:58 ` Ian Lance Taylor
  2005-02-08 11:16   ` Hans-Peter Nilsson
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2005-02-07  7:58 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

Hans-Peter Nilsson <hans-peter.nilsson@axis.com> writes:

> The ELF section warning construct was recentlish (2003-08-04)
> changed to have "warning: " prepended, so for symmetry I suggest
> all (i.e. including the a.out stabs construct) do the same (or
> I'll have to submit the corresponding a/symmetric patch to
> newlib).  I expect even less breakage on a.out, compared to the
> ELF-only change. ;-)  No test-cases need be adjusted, but
> forthcoming test-cases depend on this.
> 
> Since the ELF warnings go through here, that "warning: " string
> would be doubled, so I removed it.  Yay, removed code!
> Translating "warning: " for *those* messages in ldmain.c is now
> inconsistent; other "warning: " strings aren't.  Should they all
> be translated or left alone?
> 
> Ok to commit?
> 
> bfd:
> 	* elflink.c (elf_link_add_object_symbols): Don't add "warning: "
> 	prefix here.
> 
> ld:
> 	* ldmain.c (warning_callback, warning_find_reloc): Prepend
> 	"warning: " to warning messages.

I think this patch is OK, but please give it 24 hours in case somebody
doesn't like it.

I think in general the "warning:" string should be translated.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA:] Prepend "warning: " to "user" linker warnings, as ELF does.
  2005-02-07  7:58 ` Ian Lance Taylor
@ 2005-02-08 11:16   ` Hans-Peter Nilsson
  0 siblings, 0 replies; 3+ messages in thread
From: Hans-Peter Nilsson @ 2005-02-08 11:16 UTC (permalink / raw)
  To: binutils; +Cc: hans-peter.nilsson

> From: Ian Lance Taylor <ian@airs.com>
> Date: 06 Feb 2005 13:25:27 -0500
> Hans-Peter Nilsson <hans-peter.nilsson@axis.com> writes:

> > bfd:
> > 	* elflink.c (elf_link_add_object_symbols): Don't add "warning: "
> > 	prefix here.
> > 
> > ld:
> > 	* ldmain.c (warning_callback, warning_find_reloc): Prepend
> > 	"warning: " to warning messages.
> 
> I think this patch is OK, but please give it 24 hours in case somebody
> doesn't like it.

Now committed.

brgds, H-P

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-02-08  3:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-06 18:22 [RFA:] Prepend "warning: " to "user" linker warnings, as ELF does Hans-Peter Nilsson
2005-02-07  7:58 ` Ian Lance Taylor
2005-02-08 11:16   ` Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).