Fix array-subscript-is-char warning for Clang on Windows
andrewhayden opened this issue · 0 comments
As seen here:
https://codereview.chromium.org/1426873002/
It looks like CLD2 generates some warnings on Windows under some Clang configurations on Windows:
FAILED: ninja -t msvc -e environment.x64 --
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo
/showIncludes /FC @obj/third_party/cld_2/cld2_static/offsetmap.obj.rsp
/c
../../third_party/cld_2/src/internal/offsetmap.cc
/Foobj/third_party/cld_2/cld2_static/offsetmap.obj
/Fdobj/third_party/cld_2/cld2_static_cc.pdb
../../third_party/cld_2/src/internal/offsetmap.cc(84,36) : error: array subscript is of type 'char'
[-Werror,-Wchar-subscripts]
fprintf(fout, "%c%02d", "&=+-"[OpPart(diffs_[i])], LenPart(diffs_[i]));
^~~~~~~~~~~~~~~~~~
../../third_party/cld_2/src/internal/offsetmap.cc(210,38) :
error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
fprintf(stderr, "%c%02d ", "&=+-"[OpPart(diffs_[i])], LenPart(diffs_[i]));
^~~~~~~~~~~~~~~~~~
2 errors generated.