as error output not -j64 safe

Mike Stump mikestump@comcast.net
Thu May 15 23:13:00 GMT 2014


On May 15, 2014, at 3:52 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> 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.

Yes, thanks for the catch:

diff --git a/binutils/gas/messages.c b/binutils/gas/messages.c
index e1734f2..a4efaa5 100644
--- a/binutils/gas/messages.c
+++ b/binutils/gas/messages.c
@@ -219,13 +219,12 @@ 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);
+  else
+    fprintf (stderr, "%s %s\n", _("Error:"), buffer);
 #ifndef NO_LISTING
   listing_error (buffer);
 #endif



More information about the Binutils mailing list