On 20.11.2024 19:24, Matthieu Longo wrote:
> --- a/gas/as.h
> +++ b/gas/as.h
> @@ -323,6 +323,9 @@ COMMON int flag_no_warnings; /* -W, --no-warn */
> /* True if warnings count as errors. */
> COMMON int flag_fatal_warnings; /* --fatal-warnings */
>
> +/* True if infos should be inhibited. */
> +COMMON int flag_no_information; /* --no-info */
While I understand most pre-existing boolean flag_* variables use int, a
few already properly use bool (and then true/false when writing to them).
I think this should be followed for all new such variables.
> --- a/gas/doc/as.texi
> +++ b/gas/doc/as.texi
> @@ -243,6 +243,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
> [@b{--gsframe}]
> [@b{--hash-size}=@var{N}]
> [@b{--help}] [@b{--target-help}]
> + [@b{--info}] [@b{--no-info}]
> [@b{-I} @var{dir}]
> [@b{-J}]
> [@b{-K}]
> @@ -873,6 +874,12 @@ Print a summary of the command-line options and exit.
> @item --target-help
> Print a summary of all target specific options and exit.
>
> +@item --info
> +Don't suppress information messages.
> +
> +@item --no-info
> +Suppress information messages.
While I'm not a native speaker, I think throughout from here onwards you want
to replace "information" by "informational" and ...
> @@ -2558,6 +2566,32 @@ preprocessed (if they contain comments, for example), @command{@value{AS}} does
> not work correctly.
> @end quotation
>
> +@node info
> +@section Control Information Messages: @option{--info}, @option{--no-info}
> +
> +In some cases, @command{@value{AS}} might give an additional information message
> +associated to a context that generated a warning or error message when assembling.
> +The information message provides additional details about an earlier diagnostic
> +message, usually in the form of some context (such as when the earlier diagnostic
> +was within a macro).
> +All such informations are directed to the standard error file.
... "informations" by "information" (afaik there's no plural of this word).
Further, in the first sentence of this paragraph I think you want to switch
"message" to plural (dropping "an").
With respective adjustments: Okay.
Jan
@@ -382,6 +382,10 @@ Options:\n\
--warn don't suppress warnings\n"));
fprintf (stream, _("\
--fatal-warnings treat warnings as errors\n"));
+ fprintf (stream, _("\
+ --no-info suppress information messages\n"));
+ fprintf (stream, _("\
+ --info don't suppress information messages\n"));
#ifdef HAVE_ITBL_CPU
fprintf (stream, _("\
--itbl INSTTBL extend instruction set to include instructions\n\
@@ -499,7 +503,9 @@ parse_args (int * pargc, char *** pargv)
OPTION_NO_PAD_SECTIONS,
OPTION_MULTIBYTE_HANDLING, /* = STD_BASE + 40 */
OPTION_SFRAME,
- OPTION_SCFI
+ OPTION_SCFI,
+ OPTION_INFO,
+ OPTION_NOINFO
/* When you add options here, check that they do
not collide with OPTION_MD_BASE. See as.h. */
};
@@ -575,6 +581,7 @@ parse_args (int * pargc, char *** pargv)
,{"mri", no_argument, NULL, 'M'}
,{"nocpp", no_argument, NULL, OPTION_NOCPP}
,{"no-pad-sections", no_argument, NULL, OPTION_NO_PAD_SECTIONS}
+ ,{"no-info", no_argument, NULL, OPTION_NOINFO}
,{"no-warn", no_argument, NULL, 'W'}
,{"reduce-memory-overheads", no_argument, NULL, OPTION_REDUCE_MEMORY_OVERHEADS}
,{"statistics", no_argument, NULL, OPTION_STATISTICS}
@@ -583,6 +590,7 @@ parse_args (int * pargc, char *** pargv)
,{"verbose", no_argument, NULL, 'v'}
,{"target-help", no_argument, NULL, OPTION_TARGET_HELP}
,{"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}
+ ,{"info", no_argument, NULL, OPTION_INFO}
,{"warn", no_argument, NULL, OPTION_WARN}
,{"multibyte-handling", required_argument, NULL, OPTION_MULTIBYTE_HANDLING}
};
@@ -955,6 +963,14 @@ This program has absolutely no warranty.\n"));
flag_fatal_warnings = 1;
break;
+ case OPTION_NOINFO:
+ flag_no_information = 1;
+ break;
+
+ case OPTION_INFO:
+ flag_no_information = 0;
+ break;
+
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
case OPTION_EXECSTACK:
flag_execstack = 1;
@@ -323,6 +323,9 @@ COMMON int flag_no_warnings; /* -W, --no-warn */
/* True if warnings count as errors. */
COMMON int flag_fatal_warnings; /* --fatal-warnings */
+/* True if infos should be inhibited. */
+COMMON int flag_no_information; /* --no-info */
+
/* True if we should attempt to generate output even if non-fatal errors
are detected. */
COMMON unsigned char flag_always_generate_output; /* -Z */
@@ -5667,6 +5667,9 @@ print_operands (char *buf, const aarch64_opcode *opcode,
static void
output_info (const char *format, ...)
{
+ if (flag_no_information)
+ return;
+
const char *file;
unsigned int line;
va_list args;
@@ -243,6 +243,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
[@b{--gsframe}]
[@b{--hash-size}=@var{N}]
[@b{--help}] [@b{--target-help}]
+ [@b{--info}] [@b{--no-info}]
[@b{-I} @var{dir}]
[@b{-J}]
[@b{-K}]
@@ -873,6 +874,12 @@ Print a summary of the command-line options and exit.
@item --target-help
Print a summary of all target specific options and exit.
+@item --info
+Don't suppress information messages.
+
+@item --no-info
+Suppress information messages.
+
@item -I @var{dir}
Add directory @var{dir} to the search list for @code{.include} directives.
@@ -2446,6 +2453,7 @@ assembler.)
* alternate:: --alternate enable alternate macro syntax
* D:: -D for compatibility and debugging
* f:: -f to work faster
+* info:: --info, --no-info to control information messages
* I:: -I for .include search path
@ifclear DIFF-TBL-KLUGE
* K:: -K for compatibility
@@ -2558,6 +2566,32 @@ preprocessed (if they contain comments, for example), @command{@value{AS}} does
not work correctly.
@end quotation
+@node info
+@section Control Information Messages: @option{--info}, @option{--no-info}
+
+In some cases, @command{@value{AS}} might give an additional information message
+associated to a context that generated a warning or error message when assembling.
+The information message provides additional details about an earlier diagnostic
+message, usually in the form of some context (such as when the earlier diagnostic
+was within a macro).
+All such informations are directed to the standard error file.
+This flag only affects the information messages, it does not change any particular
+of how @command{@value{AS}} assembles your file.
+
+@kindex --info
+@cindex diagnostic informations, switching on (default behavior)
+The option @option{--info} is enabled by default, and enables printing of additional
+diagnostic informations.
+
+@kindex --no-info
+@cindex diagnostic informations, switching off
+You can switch the option @option{--info} off by specifying @option{--no-info},
+which disables printing of additional information in the context of an earlier
+diagnostic.
+
+Specifying @option{--info} after @option{--no-info} will turn on again printing
+of additional diagnostic informations.
+
@node I
@section @code{.include} Search Path: @option{-I} @var{path}
@@ -138,6 +138,9 @@ void
as_info_where (const char *file, unsigned int line, unsigned int indent,
const char *format, ...)
{
+ if (flag_no_information)
+ return;
+
va_list args;
char buffer[2000];