https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65445

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
There is a trivial fix, which is to use the appropriate OPT_Wx flag when
calling warning().

However, Joseph and I think that if the warning was enabled via a group option,
then it would be better to print both, such as:

[-Wformat=,-Wformat-contains-null]

This should be feasible now that options relationships are encoded in the *.opt
files. One would need to build in the opt*.awk scripts a static data-structure
that given OPT_Wx gives a list of OPT_Wy options that enable it. Something
like:

static int opts_enable_opt_table [] = {
...
2, OPT_Wall, OPT_Wc++-compat, /* OPT_Wenum_compare */
1, OPT_Wformat,               /* OPT_Wformat_contains_nul */
...
};

static int opts_enable_opt_index [] = {
...
/* OPT_Wenum_compare */ 50,
/* OPT_Wformat_contains_nul */ 53,
/* OPT_Wall */ -1,
....
};

such that opts_enable_opt_table[opts_enable_opt_index[OPT_Wformat_contains_nul]
+ 1] == OPT_Wformat

Then add a function that given an OPT_Wx, returns which OPT_Wy options that
enable it are enabled at this moment. Then, use this function when printing the
warning in diagnostics.c.

Reply via email to