Separate warning/error thresholds for -Wfoo=<n>
Alexander Monakov
amonakov@ispras.ru
Tue Dec 6 16:43:56 GMT 2022
On Tue, 6 Dec 2022, Richard Biener via Gcc wrote:
> Implementation-wise one could do a similar trick as we have for
> global_options vs. global_options_set - add a global_options_error copy (ick!)
> (and global_options_error_set!?) and have the logic that decides whether
> a warning is an error pick that set. Of course it's the actual pass that looks
> at flag_xyz which holds the magic number so that pass would need to be able
> to see whether it needs to look at both numbers.
I'm hoping to come up with a reasonably elegant way to implement this.
> Btw, does '-Werror=array-bounds=2' imply that =1 kinds are diagnosed as
> warning?
No, =1 kinds are diagnosed as error as well.
> Does it enable -Warray-bounds=2?
Yes, -Werror=array-bounds=2 is simply decomposed into -Warray-bounds=2
-Werror=array-bounds= (since PR 48088 was fixed).
> I think the DWIM behavior isn't all that clear and probably depends on the
> actual option we want to make it work.
Yeah, I guess there will be differences of opinion here, and I'm interested
to reach community consensus. Let's say I'm mostly interested in supporting
-Warray-bounds=2 -Werror=array-bounds=1
(errors for most certain OOB accesses, warnings otherwise).
Alexander
More information about the Gcc
mailing list