This is the mail archive of the binutils@sourceware.cygnus.com 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]

--fatal-warnings patch for gas



This lets you specify that warnings are fatal for GAS.

--no-warn and --fatal-warnings are apparently standard GNU names.

Now, if only there was some easy way to get gcc to specify
--fatal-warnings whenever it was using GAS...

-- 
Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/tx49-bin-fatalwarn.patch===========
md5sum: 162b8e570a929c49 4ab2acca217fb4b2 164130
Index: binutils/gas/ChangeLog
0a
Sun Oct 10 15:12:10 1999  Geoffrey Keating  <geoffk@cygnus.com>

	* as.c (show_usage): Document new options.
	(parse_args): Add --no-warn, --warn, --fatal-warnings,
	which become 'W', OPTION_WARN, and OPTION_WARN_FATAL.
	(parse_args): Parse the new options.
	(main): If there were warnings, and --fatal-warnings
	was specified, print an error.

	* as.h: New variable, flag_fatal_warnings, for new option.

.
Changed files:
binutils/gas/ChangeLog
binutils/gas/as.c
binutils/gas/as.h
md5sum: e0b4c2e6470fda4f 4eb249d5f313c235 26666
--- /sloth/disk0/co/binutils-mainline/binutils/gas/as.c	Tue Sep  7 12:23:44 1999
+++ binutils/gas/as.c	Sun Oct 10 16:08:38 1999
@@ -170,7 +170,9 @@ show_usage (stream)
   --strip-local-absolute  strip local absolute symbols\n\
   --traditional-format	  Use same format as native assembler when possible\n\
   --version		  print assembler version number and exit\n\
-  -W			  suppress warnings\n\
+  -W  --no-warn		  suppress warnings\n\
+  --warn		  don't suppress warnings\n\
+  --fatal-warnings	  treat warnings as errors\n\
   --itbl INSTTBL	  extend instruction set to include instructions\n\
 			  matching the specifications defined in file INSTTBL\n\
   -w			  ignored\n\
@@ -371,7 +373,12 @@ parse_args (pargc, pargv)
 #define OPTION_TRADITIONAL_FORMAT (OPTION_STD_BASE + 16)
     {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT},
 #define OPTION_GDWARF2 (OPTION_STD_BASE + 17)
-    {"gdwarf2", no_argument, NULL, OPTION_GDWARF2}
+    {"gdwarf2", no_argument, NULL, OPTION_GDWARF2},
+    {"no-warn", no_argument, NULL, 'W'},
+#define OPTION_WARN (OPTION_STD_BASE + 18)
+    {"warn", no_argument, NULL, OPTION_WARN},
+#define OPTION_WARN_FATAL (OPTION_STD_BASE + 19)
+    {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
   };
 
   /* Construct the option lists from the standard list and the
@@ -604,6 +611,16 @@ the GNU General Public License.  This pr
 	  flag_no_warnings = 1;
 	  break;
 
+	case OPTION_WARN:
+	  flag_no_warnings = 0;
+	  flag_fatal_warnings = 0;
+	  break;
+
+	case OPTION_WARN_FATAL:
+	  flag_no_warnings = 0;
+	  flag_fatal_warnings = 1;
+	  break;
+
 	case 'Z':
 	  flag_always_generate_output = 1;
 	  break;
@@ -833,6 +850,9 @@ main (argc, argv)
 #endif
     output_file_close (out_file_name);
 #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;
md5sum: fc54ed880a7eea37 6f62f7a7fcff7a0a 17803
--- /sloth/disk0/co/binutils-mainline/binutils/gas/as.h	Sun Jun 13 02:49:42 1999
+++ binutils/gas/as.h	Sun Oct 10 16:08:38 1999
@@ -427,6 +427,9 @@ COMMON unsigned char flag_readonly_data_
 /* True if warnings should be inhibited.  */
 COMMON int flag_no_warnings; /* -W */
 
+/* True if warnings count as errors.  */
+COMMON int flag_fatal_warnings; /* --fatal-warnings */
+
 /* True if we should attempt to generate output even if non-fatal errors
    are detected.  */
 COMMON unsigned char flag_always_generate_output; /* -Z */
============================================================

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