Leave more space in TUI mode for thread ID.
[deliverable/binutils-gdb.git] / gas / as.c
index 7aa319a54594e45ee091ccd20740f3e731882dfd..503add992a1adf360182b05d199f1c0018a0fcbb 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -1,5 +1,5 @@
 /* as.c - GAS main program.
-   Copyright 1987-2014 Free Software Foundation, Inc.
+   Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -97,7 +97,7 @@ int debug_memory = 0;
 int verbose = 0;
 
 /* Keep the output file.  */
-int keep_it = 0;
+static int keep_it = 0;
 
 segT reg_section;
 segT expr_section;
@@ -626,7 +626,7 @@ parse_args (int * pargc, char *** pargv)
        case OPTION_VERSION:
          /* This output is intended to follow the GNU standards document.  */
          printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
-         printf (_("Copyright 2014 Free Software Foundation, Inc.\n"));
+         printf (_("Copyright (C) 2015 Free Software Foundation, Inc.\n"));
          printf (_("\
 This program is free software; you may redistribute it under the terms of\n\
 the GNU General Public License version 3 or later.\n\
@@ -1107,32 +1107,6 @@ perform_an_assembly_pass (int argc, char ** argv)
     read_a_source_file ("");
 }
 \f
-#ifdef OBJ_ELF
-static void
-create_obj_attrs_section (void)
-{
-  segT s;
-  char *p;
-  offsetT size;
-  const char *name;
-
-  size = bfd_elf_obj_attr_size (stdoutput);
-  if (size)
-    {
-      name = get_elf_backend_data (stdoutput)->obj_attrs_section;
-      if (!name)
-       name = ".gnu.attributes";
-      s = subseg_new (name, 0);
-      elf_section_type (s)
-       = get_elf_backend_data (stdoutput)->obj_attrs_section_type;
-      bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA);
-      frag_now_fix ();
-      p = frag_more (size);
-      bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size);
-    }
-}
-#endif
-\f
 
 int
 main (int argc, char ** argv)
@@ -1257,11 +1231,6 @@ main (int argc, char ** argv)
   md_end ();
 #endif
 
-#ifdef OBJ_ELF
-  if (IS_ELF)
-    create_obj_attrs_section ();
-#endif
-
 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
   if ((flag_execstack || flag_noexecstack)
       && OUTPUT_FLAVOR == bfd_target_elf_flavour)
@@ -1283,20 +1252,45 @@ main (int argc, char ** argv)
      directives from the user or by the backend, emit it now.  */
   cfi_finish ();
 
-  if (seen_at_least_1_file ()
-      && (flag_always_generate_output || had_errors () == 0))
-    keep_it = 1;
-  else
-    keep_it = 0;
+  keep_it = 0;
+  if (seen_at_least_1_file ())
+    {
+      int n_warns, n_errs;
+      char warn_msg[50];
+      char err_msg[50];
 
-  /* This used to be done at the start of write_object_file in
-     write.c, but that caused problems when doing listings when
-     keep_it was zero.  This could probably be moved above md_end, but
-     I didn't want to risk the change.  */
-  subsegs_finish ();
+      write_object_file ();
 
-  if (keep_it)
-    write_object_file ();
+      n_warns = had_warnings ();
+      n_errs = had_errors ();
+
+      if (n_warns == 1)
+       sprintf (warn_msg, _("%d warning"), n_warns);
+      else
+       sprintf (warn_msg, _("%d warnings"), n_warns);
+      if (n_errs == 1)
+       sprintf (err_msg, _("%d error"), n_errs);
+      else
+       sprintf (err_msg, _("%d errors"), n_errs);
+
+      if (flag_fatal_warnings && n_warns != 0)
+       {
+         if (n_errs == 0)
+           as_bad (_("%s, treating warnings as errors"), warn_msg);
+         n_errs += n_warns;
+       }
+
+      if (n_errs == 0)
+       keep_it = 1;
+      else if (flag_always_generate_output)
+       {
+         /* The -Z flag indicates that an object file should be generated,
+            regardless of warnings and errors.  */
+         keep_it = 1;
+         fprintf (stderr, _("%s, %s, generating bad object file\n"),
+                  err_msg, warn_msg);
+       }
+    }
 
   fflush (stderr);
 
@@ -1304,19 +1298,13 @@ main (int argc, char ** argv)
   listing_print (listing_filename, argv_orig);
 #endif
 
-  if (flag_fatal_warnings && had_warnings () > 0 && had_errors () == 0)
-    as_bad (_("%d warnings, treating warnings as errors"), had_warnings ());
-
-  if (had_errors () > 0 && ! flag_always_generate_output)
-    keep_it = 0;
-
   input_scrub_end ();
 
   END_PROGRESS (myname);
 
   /* Use xexit instead of return, because under VMS environments they
      may not place the same interpretation on the value given.  */
-  if (had_errors () > 0)
+  if (had_errors () != 0)
     xexit (EXIT_FAILURE);
 
   /* Only generate dependency file if assembler was successful.  */
This page took 0.025582 seconds and 4 git commands to generate.