Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wchar-subscript warnings #15

Open
sanjayankur31 opened this issue Nov 17, 2019 · 1 comment
Open

-Wchar-subscript warnings #15

sanjayankur31 opened this issue Nov 17, 2019 · 1 comment

Comments

@sanjayankur31
Copy link
Contributor

While building iv for NeuroFedora, we saw a few -Wchar-subscript warnings:

make[2]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
make[2]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I. -I../include -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c InterViews/fbrowser.cpp  -fPIC -DPIC -o InterViews/.libs/fbrowser.o
InterViews/fbrowser.cpp: In constructor 'ivFileBrowser::ivFileBrowser(ivWidgetKit*, ivAction*, ivAction*)':
InterViews/fbrowser.cpp:145:13: warning: array subscript has type 'char' [-Wchar-subscripts]
  145 |  fb.key_[k->key] = k->func;
      |          ~~~^~~
InterViews/fbrowser.cpp: In member function 'virtual void ivFileBrowser::keystroke(const ivEvent&)':
InterViews/fbrowser.cpp:256:33: warning: array subscript has type 'char' [-Wchar-subscripts]
  256 |  FileBrowserKeyFunc f = fb.key_[c];
      |                                 ^
make[2]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
make[2]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
--
make[2]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
make[2]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
gcc -DHAVE_CONFIG_H -I. -I. -I../include   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DCOLORIMETRY_SUPPORT -DJPEG_SUPPORT -DYCBCR_SUPPORT -DCMYK_SUPPORT -DHAVE_IEEEFP=1 -DUSE_VARARGS=0 -DUSE_PROTOTYPES=1 -DUSE_CONST=1 -I../include/TIFF TIFF/mkg3states.c -o TIFF/mkg3states
TIFF/mkg3states.c: In function 'find_horiz_mode_prefix':
TIFF/mkg3states.c:492:41: warning: array subscript has type 'char' [-Wchar-subscripts]
  492 |      (int) horiz_mode_prefix_count, "WB"[color], prefix);
      |                                         ^
At top level:
TIFF/mkg3states.c:5:13: warning: 'rcsid' defined but not used [-Wunused-variable]
--
make[2]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
make[2]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I. -I../include -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c Unidraw/catalog.cpp  -fPIC -DPIC -o Unidraw/.libs/catalog.o
Unidraw/catalog.cpp: In function 'void HexDecode(const char*, ivColorIntensity&, ivColorIntensity&, ivColorIntensity&)':
Unidraw/catalog.cpp:138:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  138 |     r  = hexintmap[enc[0]] << 4;
      |                    ~~~~~^
Unidraw/catalog.cpp:139:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  139 |     r |= hexintmap[enc[1]];
      |                    ~~~~~^
Unidraw/catalog.cpp:140:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  140 |     g  = hexintmap[enc[2]] << 4;
      |                    ~~~~~^
Unidraw/catalog.cpp:141:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  141 |     g |= hexintmap[enc[3]];
      |                    ~~~~~^
Unidraw/catalog.cpp:142:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  142 |     b  = hexintmap[enc[4]] << 4;
      |                    ~~~~~^
Unidraw/catalog.cpp:143:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  143 |     b |= hexintmap[enc[5]];
      |                    ~~~~~^
Unidraw/catalog.cpp: In function 'void HexGrayDecode(const char*, ivColorIntensity&)':
Unidraw/catalog.cpp:168:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  168 |     g  = hexintmap[enc[0]] << 4;
      |                    ~~~~~^
Unidraw/catalog.cpp:169:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  169 |     g |= hexintmap[enc[1]];
      |                    ~~~~~^
Unidraw/catalog.cpp: In member function 'void ivCatalog::ReadBitmapData(ivBitmap*, std::istream&)':
Unidraw/catalog.cpp:1699:42: warning: array subscript has type 'char' [-Wchar-subscripts]
 1699 |             unsigned int val = hexintmap[hexchar];
      |                                          ^~~~~~~
make[2]: Leaving directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'
make[2]: Entering directory '/builddir/build/BUILD/iv-74f120781bc2def0cc4d1f9f547c07037e8a7a74/src/lib'

Since char maybe signed on some machines, this may result in undefined behaviour, so worth looking into too.

@sanjayankur31
Copy link
Contributor Author

build-log.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant