[PATCH] D58896: Suppress -Wchar-subscripts if the index is a literal char

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 12:42:08 PST 2019


Quuxplusone added a comment.

In D58896#1737242 <https://reviews.llvm.org/D58896#1737242>, @edward-jones wrote:

> In D58896#1737200 <https://reviews.llvm.org/D58896#1737200>, @xbolva00 wrote:
>
> > Well, i am not sure if one twitter report is good motivation to criple warning.
>
>
> The motivation for suppressing the warning was that it is not uncommon to use a character literal in lookup tables. In addition in brings the warning inline with the behaviour of `-Wchar-subscripts` in GCC.


Peanut gallery says: If it's "not uncommon," then {when,if} you resubmit this for review, it should be easy and therefore mandatory to provide at least one example of someone actually using a character literal as a lookup table index. I've never seen such a construct in my life, so real-world examples (e.g. GitHub links) would be useful.

Especially useful would be links to GitHub examples of `'i'[arr]` or `arr['i']` where the //most appropriate fix// is legitimately "upgrade your Clang thus suppressing the diagnostic" as opposed to "rewrite the expression as `arr[int('i')]` or `arr[105]` depending on what you actually mean it to do."


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58896/new/

https://reviews.llvm.org/D58896





More information about the cfe-commits mailing list