This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: as error output not -j64 safe


On Thu, May 15, 2014 at 3:48 PM, Mike Stump <mikestump@comcast.net> wrote:
> So when dealing with error messages, it is important that they be one per line and -j safe.  This fixes intermingled output when -j64 is used on linux:
>
> diff --git a/binutils/gas/messages.c b/binutils/gas/messages.c
> index e1734f2..c3a551b 100644
> --- a/binutils/gas/messages.c
> +++ b/binutils/gas/messages.c
> @@ -219,13 +219,10 @@ as_bad_internal (char *file, unsigned int line, char *buffer)
>    if (file)
>      {
>        if (line != 0)
> -       fprintf (stderr, "%s:%u: ", file, line);
> +       fprintf (stderr, "%s:%u: %s %s\n", file, line, _("Error:"), buffer);
>        else
> -       fprintf (stderr, "%s: ", file);
> +       fprintf (stderr, "%s: %s %s\n", file, _("Error:"), buffer);
>      }
> -  fprintf (stderr, _("Error: "));
> -  fputs (buffer, stderr);
> -  (void) putc ('\n', stderr);
>  #ifndef NO_LISTING
>    listing_error (buffer);
>  #endif
>

This changes the semantics of the error message if file is null.
Try:
   if (file)
     {
       if (line != 0)
         fprintf (stderr, "%s:%u: %s %s\n", file, line, _("Error:"), buffer);
       else
         fprintf (stderr, "%s: %s %s\n", file, _("Error:"), buffer);
     }
else
       fprintf (stderr, "%s %s\n", _("Error:"), buffer);

Thanks,
Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]