glassechidna / zxing-cpp

ZXing C++ Library
Apache License 2.0
597 stars 435 forks source link

warning: shifting a negative signed value is undefined #85

Open yurivict opened 5 years ago

yurivict commented 5 years ago

clang-6 prints these warnings that seem important:

/usr/ports/textproc/zxing-cpp/work/zxing-cpp-e0e40dd/cli/src/jpgd.cpp:568:170: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                     ~~~~^
/usr/ports/textproc/zxing-cpp/work/zxing-cpp-e0e40dd/cli/src/jpgd.cpp:568:185: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                    ~~~~^
/usr/ports/textproc/zxing-cpp/work/zxing-cpp-e0e40dd/cli/src/jpgd.cpp:568:201: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                    ~~~~^
/usr/ports/textproc/zxing-cpp/work/zxing-cpp-e0e40dd/cli/src/jpgd.cpp:568:217: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                                    ~~~~^
/usr/ports/textproc/zxing-cpp/work/zxing-cpp-e0e40dd/cli/src/jpgd.cpp:568:233: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
                                                                                                                                                                                                                                    ~~~~^

FreeBSD