Currently, for clang-cl, -Wall is treated identically as /Wall and is aliased to -Weverything.
This patch allows to expose -Wall to clang-cl while keeping the order of warning arguments, which the -Xclang alternative doesn't allow.
Differential D114651
[clang-cl] Expose -Wall to clang-cl by unaliasing -Wall, keeping /Wall as alias to -Weverything saudi on Nov 26 2021, 10:22 AM. Authored by
Details
Diff Detail
Event TimelineComment Actions Is the deviation from MSVC behaviour here intentional? MSVC flags allow both using a / as well as - as prefix. That means Both -Wall and /Wall are accepted by MSVC as well as clang-cl and in both compilers currently lead to ALL warnings being emitted. So this patch would deviate from that behaviour as well as add confusion as every other option behaves the same in MSVC and clang-cl, regardless of whether - or / is used as prefix. Comment Actions +1, while it's annoying with -Wall not doing the expected thing when using (clang-)cl, that's to be expected - cl and gcc style drivers have entirely different options overall, so one generally have to take care and use the right kind of options for them (and it's just a bit inconvenient that some options overlap but differ). So specialcasing an exception for this particular option doesn't seem worth it. Even in the context of cl-only options, I tend to always use the slash form, because there's less risk of mixups. Comment Actions I understand, making clang-cl -Wall behave differently than `/Wall' is indeed confusing. Comment Actions I will add that multiple users have run into this problem, and I think it might be more practical to consider unaliasing Wall altogether. Clang doesn't emit the same set of warnings as MSVC. Anyone seriously using clang-cl /Wall is going to receive a pile of -WcxxNN-compat warnings that are self-contradictory, and they are going to need to curate a set of clang-specific warning flags anyway. Comment Actions One possible downside with that, is that you'd easily end up making cl-compatible build files that works nicely with clang-cl but spew warnings with cl.exe. (Although maybe cl.exe's -Wall produce a much safer/saner set of warnings?) But I don't feel strongly about it.. Comment Actions It looks like this Wall -> Weverything alias is from my 2017 change: The commit message doesn't link to any bugs or any other motivating material. All I said is that this is being done for MSVC compatibility. I remember having some motivating reason, but it looks like I won't be able to find it. I see Hans thanked me for the behavior change, maybe he recalls. Anyway, I would approve a patch to remove the alias, but I'd want to confirm with Hans that he is also on board with it, since I suspect he was the one who talked me into adding the alias. I don't have more time to follow up on this at the moment. |