From 2bdd6cf5996b717fe7539ab07b6b0aec10f38934 Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Mon, 11 Oct 1999 04:07:10 +0000 Subject: [PATCH] * 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. --- gas/ChangeLog | 10 ++++++++++ gas/as.c | 24 ++++++++++++++++++++++-- gas/as.h | 3 +++ gas/doc/as.1 | 10 ++++++++-- gas/doc/as.texinfo | 41 +++++++++++++++++++++++++++++++---------- 5 files changed, 74 insertions(+), 14 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 164c893e2a5..c3dd0526c5a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +Mon Oct 11 14:02:40 1999 Geoffrey Keating + + * 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. + Sun Oct 10 01:47:23 1999 Jerry Quinn * config/tc-hppa.c (pa_ip): Add new codes 'cc', 'cd', 'cC', 'co', diff --git a/gas/as.c b/gas/as.c index 59d9b831fad..cda77cadbf0 100644 --- a/gas/as.c +++ b/gas/as.c @@ -170,7 +170,9 @@ Options:\n\ --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 program has absolutely no warranty.\n")); 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; @@ -834,6 +851,9 @@ main (argc, argv) 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; diff --git a/gas/as.h b/gas/as.h index e72902bf6b1..62ef3761112 100644 --- a/gas/as.h +++ b/gas/as.h @@ -427,6 +427,9 @@ COMMON unsigned char flag_readonly_data_in_text; /* -R */ /* 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 */ diff --git a/gas/doc/as.1 b/gas/doc/as.1 index adf28868eac..08d5805f37c 100644 --- a/gas/doc/as.1 +++ b/gas/doc/as.1 @@ -195,8 +195,14 @@ Announce \c .B as\c \& version .TP -.B \-W -Suppress warning messages +.B \-W, \-\-no-warn +Suppress warning messages. +.TP +.B \-\-fatal\-warnings +Consider warnings to be fatal. +.TP +.B \-\-warn +Just warn on warnings. .TP .IR "\-\^\-" "\ |\ " "files\|.\|.\|." Source files to assemble, or standard input (\c diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 546acaf0929..330a8b23419 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -204,7 +204,8 @@ Here is a brief summary of how to invoke @code{@value{AS}}. For details, @value{AS} [ -a[cdhlns][=file] ] [ -D ] [ --defsym @var{sym}=@var{val} ] [ -f ] [ --gstabs ] [ --gdwarf2 ] [ --help ] [ -I @var{dir} ] [ -J ] [ -K ] [ -L ] [ --keep-locals ] [ -o @var{objfile} ] [ -R ] [ --statistics ] [ -v ] - [ -version ] [ --version ] [ -W ] [ -w ] [ -x ] [ -Z ] + [ -version ] [ --version ] [ -W ] [ --warn ] [ --fatal-warnings ] + [ -w ] [ -x ] [ -Z ] @ifset A29K @c am29k has no machine-dependent assembler options @end ifset @@ -370,8 +371,15 @@ Print the @code{as} version. Print the @code{as} version and exit. @item -W +@itemx --no-warn Suppress warning messages. +@item --fatal-warnings +Treat warnings as errors. + +@item --warn +Don't suppress warning messages or treat them as errors. + @item -w Ignored. @@ -1024,7 +1032,7 @@ assembler.) * statistics:: --statistics to see statistics about assembly * traditional-format:: --traditional-format for compatible output * v:: -v to announce version -* W:: -W to suppress warnings +* W:: -W, --no-warn, --warn, --fatal-warnings to control warnings * Z:: -Z to make object file even after errors @end menu @@ -1400,19 +1408,32 @@ option @samp{-v} (which you can also spell as @samp{-version}) on the command line. @node W -@section Suppress Warnings: @code{-W} +@section Control Warnings: @code{-W}, @code{--warn}, @code{--no-warn}, @code{--fatal-warnings} -@kindex -W -@cindex suppressing warnings -@cindex warnings, suppressing @code{@value{AS}} should never give a warning or error message when assembling compiler output. But programs written by people often cause @code{@value{AS}} to give a warning that a particular assumption was made. All such warnings are directed to the standard error file. -If you use this option, no warnings are issued. This option only -affects the warning messages: it does not change any particular of how -@code{@value{AS}} assembles your file. Errors, which stop the assembly, are -still reported. + +@kindex @samp{-W} +@kindex @samp{--no-warn} +@cindex suppressing warnings +@cindex warnings, suppressing +If you use the @code{-W} and @code{--no-warn} options, no warnings are issued. +This only affects the warning messages: it does not change any particular of +how @code{@value{AS}} assembles your file. Errors, which stop the assembly, +are still reported. + +@kindex @samp{--fatal-warnings} +@cindex errors, caused by warnings +@cindex warnings, causing error +If you use the @code{--fatal-warnings} option, @code{@value{AS}} considers +files that generate warnings to be in error. + +@kindex @samp{--warn} +@cindex warnings, switching on +You can switch these options off again by specifying @code{--warn}, which +causes warnings to be output as usual. @node Z @section Generate Object File in Spite of Errors: @code{-Z} -- 2.30.2