tukaani-project / xz

XZ Utils
https://tukaani.org/xz/
Other
542 stars 101 forks source link

Problem with warming Wtype-limits #135

Open Jamaika1 opened 3 weeks ago

Jamaika1 commented 3 weeks ago
filter_decoder.c: In function 'decoder_find':
filter_decoder.c:145:30: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  145 |         for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i)
      |                              ^
filter_encoder.c: In function 'encoder_find':
filter_encoder.c:188:30: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  188 |         for (size_t i = 0; i < ARRAY_SIZE(encoders); ++i)
      |                              ^
string_conversion.c: In function 'parse_filter':
string_conversion.c:815:30: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  815 |         for (size_t i = 0; i < ARRAY_SIZE(filter_name_map); ++i) {
      |                              ^
string_conversion.c: In function 'lzma_str_list_filters':
string_conversion.c:1255:30: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
 1255 |         for (size_t i = 0; i < ARRAY_SIZE(filter_name_map); ++i) {
      |                              ^
Larhzu commented 3 weeks ago

How are you building the code?

The two filter_*.c files shouldn't be built when ARRAY_SIZE would be zero. In string_conversion.c it should never be zero.

Some #defines must be missing.

Jamaika1 commented 3 weeks ago

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116432

Larhzu commented 3 weeks ago

It's not a bug in GCC.

Once again: how are you building the code? configure? CMake? Custom build system?

Jamaika1 commented 3 weeks ago

I use: https://github.com/brechtsanders/winlibs_mingw/releases/download/11.5.0posix-12.0.0-msvcrt-r1/winlibs-x86_64-posix-seh-gcc-11.5.0-mingw-w64msvcrt-12.0.0-r1.zip gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DWINVER=0x0602 -D_WIN32_WINNT=0x0602 -DWIN32_LEAN_AND_MEAN=/"/" -DNHAVE_ENCODERS -DHAVE_STDBOOL_H=1 -DHAVE_INTTYPES_H=1 -DMYTHREAD_VISTA=1 -c filter_decoder.c -o filter_decoder.o

winlibs personal build version gcc-11.5.0-mingw-w64ucrt-12.0.0-r1

This is the winlibs Intel/AMD 64-bit standalone build of:

thesamesam commented 3 weeks ago

Please give us full context. Are you really running that command by itself out of nowhere? Or what build script are you using for xz?

Larhzu commented 3 weeks ago

That command certainly won't build the file correctly!

Assuming that you are building it in Command Prompt (not MSYS2) on Windows, I suggest using CMake. See the files windows\INSTALL-MinGW-w64_with_CMake.txt and windows\build-with-cmake.bat.

To use custom CFLAGS, edit the .bat file to add CMAKE_C_FLAGS_RELEASE to the cmake command line:

"-DCMAKE_C_FLAGS_RELEASE=-march=x86-64-v2 -O2 -ftree-vectorize -mavx -mxsave -mpclmul -maes"

So full line becomes:

cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release "-DCMAKE_C_FLAGS_RELEASE=-march=x86-64-v2 -O2 -ftree-vectorize -mavx -mxsave -mpclmul -maes" -DENABLE_NLS=OFF -DBUILD_SHARED_LIBS=%3 .... || exit /b

I didn't test it. Hopefully I didn't make silly errors.

You can use -O3 too but I haven't found it to be useful with xz. -O3 results in bigger executables that aren't faster. It might depend on compiler version and processor.

Jamaika1 commented 3 weeks ago

I'm building ffmpeg with a bunch of plugins. Should I fix these hidden warnings? I don't know. I test things sometimes. https://github.com/Jamaika1/plugins_ffmpeg701_mingw1150 Wsign-compare warnings seem to be just information. Nobody corrects it. Wtype-limits warnings occur rarely so I took the liberty of writing them.

echo off
set PATH=C:/gcc1150/bin;%PATH%
rem echo %PATH%
rem cd "C:/gcc1150/bin"
cd libavcodec
cd libtwolame
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DLIBTWOLAME_STATIC=1 -c %%f -o %%~nf.o
cd ..
cd libogg
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -c %%f -o %%~nf.o
cd ..
cd libtheora/x86
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DCAIRO_WIN32_STATIC_BUILD=1 -DHAVE_CAIRO=1 -DNOC_DUMP_IMAGES -DNOC_COLLECT_METRICS -DNHAVE_MEMORY_CONSTRAINT -DOC_STATE_USE_VTABLE=1 -DOC_X86_ASM=1 -DOC_X86_64_ASM=1 -c %%f -o %%~nf.o
cd ../..
cd libtheora
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DCAIRO_WIN32_STATIC_BUILD=1 -DHAVE_CAIRO=1 -DNOC_DUMP_IMAGES -DNOC_COLLECT_METRICS -DNHAVE_MEMORY_CONSTRAINT -DOC_STATE_USE_VTABLE=1 -DOC_X86_ASM=1 -DOC_X86_64_ASM=1 -c %%f -o %%~nf.o
cd ..
cd libsnappy
for %%f in ("%~dp1*.cc") do g++.exe -std=gnu++11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DHAVE_ATTRIBUTE_ALWAYS_INLINE=1 -DHAVE_BUILTIN_CTZ=1 -DHAVE_BUILTIN_EXPECT=1 -DHAVE_BUILTIN_PREFETCH=1 -DSNAPPY_HAVE_SSSE3=1 -DNSNAPPY_HAVE_BMI2 -c %%f -o %%~nf.o
cd ..
cd libshine
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -c %%f -o %%~nf.o
cd ..
cd libmp3lame
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DHAVE_CONFIG_H=1 -c %%f -o %%~nf.o
cd ..
cd libgsm
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DWAV49=1 -c %%f -o %%~nf.o
cd ..
cd liblc3
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DLC3_PLUS=1 -DLC3_PLUS_HR=1 -c %%f -o %%~nf.o
cd ..
cd libvorbis
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DHAVE_CONFIG_H=1 -DNUSE_MEMORY_H -DNHAVE_ERRNO_H -UHAVE_STDINT_H -DPTW32_STATIC_LIB=1 -c %%f -o %%~nf.o
cd ..
cd libcodec2
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -UFIXED_POINT -DNUSE_SIMD -DUSE_KISS_FFT="" -c %%f -o %%~nf.o
cd ..
cd libspeex
for %%f in ("%~dp1*.c") do gcc.exe -std=gnu11 -static -march=x86-64-v2 -ftree-vectorize -g0 -O3 -fPIC -mavx -mxsave -mpclmul -maes -Wcomment -Wformat -Wshift-negative-value -Wsign-compare -Wtype-limits -DHAVE_CONFIG_H=1 -DFIXED_POINT=1 -DNUSE_SIMD -DUSE_KISS_FFT="" -c %%f -o %%~nf.o
cd ..
pause
crc.c: In function 'crc_update':
crc.c:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
   39 |     for (i = 0; i < nbBit; i++) {
      |                   ^
fft.c: In function 'fht':
fft.c:1116:23: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
 1116 |         for (i = 0; i < sizeof k1k2tab / sizeof k1k2tab[0]; ++i) {
      |                       ^
psycho_2.c: In function 'twolame_psycho_2':
psycho_2.c:315:21: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
  315 |     for (ch = 0; ch < nch; ch++) {
      |                     ^
psycho_4.c: In function 'twolame_psycho_4':
psycho_4.c:356:21: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
  356 |     for (ch = 0; ch < nch; ch++) {
      |                     ^
analyze.c: In function 'oc_mode_scheme_chooser_scheme_mb_cost':
analyze.c:109:19: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  109 |     while(ri>0&&mc>=_chooser->mode_counts[_chooser->scheme0_list[ri-1]])ri--;
      |                   ^~
analyze.c: In function 'oc_enc_pipeline_set_stripe':
analyze.c:591:25: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
  591 |   notdone=_sby+mcu_nvsbs<sby_end;
      |                         ^
decode.c: In function 'oc_render_telemetry':
decode.c:2508:19: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 2508 |       if((col2>>1)>=_dec->state.nhmbs){
      |                   ^~
encode.c: In function 'oc_enc_mb_info_init':
encode.c:1031:26: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 1031 |           if(nmbx<0||nmbx>=nhmbs||nmby<0||nmby>=nvmbs)continue;
      |                          ^~
encode.c:1031:47: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 1031 |           if(nmbx<0||nmbx>=nhmbs||nmby<0||nmby>=nvmbs)continue;
      |                                               ^~
encode.c:1040:26: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 1040 |           if(nmbx<0||nmbx>=nhmbs||nmby<0||nmby>=nvmbs)continue;
      |                          ^~
encode.c:1040:47: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 1040 |           if(nmbx<0||nmbx>=nhmbs||nmby<0||nmby>=nvmbs)continue;
      |                                               ^~
encode.c: In function 'th_encode_ctl':
encode.c:1448:19: warning: comparison of integer expressions of different signedness: 'int' and 'ogg_uint32_t' {aka 'unsigned int'} [-Wsign-compare]
 1448 |       if(dup_count>=_enc->keyframe_frequency_force)return TH_EINVAL;
      |                   ^~
encode.c: In function 'oc_img_plane_copy_pad':
encode.c:1596:14: warning: comparison of integer expressions of different signedness: 'ogg_uint32_t' {aka 'unsigned int'} and 'ogg_int32_t' {aka 'int'} [-Wsign-compare]
 1596 |     for(y=0;y<_pic_height;y++){
      |              ^
encode.c:1605:16: warning: comparison of integer expressions of different signedness: 'ogg_uint32_t' {aka 'unsigned int'} and 'ogg_int32_t' {aka 'int'} [-Wsign-compare]
 1605 |       for(y=0;y<_pic_height;y++){
      |                ^
encode.c:1607:30: warning: comparison of integer expressions of different signedness: 'ogg_uint32_t' {aka 'unsigned int'} and 'ogg_int32_t' {aka 'int'} [-Wsign-compare]
 1607 |          +(dst+(dstride&-(y+1<_pic_height)))[1]+2>>2;
      |                              ^
encode.c:1614:16: warning: comparison of integer expressions of different signedness: 'ogg_uint32_t' {aka 'unsigned int'} and 'ogg_int32_t' {aka 'int'} [-Wsign-compare]
 1614 |       for(y=0;y<_pic_height;y++){
      |                ^
encode.c:1616:30: warning: comparison of integer expressions of different signedness: 'ogg_uint32_t' {aka 'unsigned int'} and 'ogg_int32_t' {aka 'int'} [-Wsign-compare]
 1616 |          +(dst+(dstride&-(y+1<_pic_height)))[0]+2>>2;
      |                              ^
mcenc.c: In function 'oc_mcenc_ysatd_halfpel_mbrefine':
mcenc.c:657:11: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  657 |     if(err<_best_err){
      |           ^
In file included from internal.h:26,
                 from state.h:19,
                 from encint.h:20,
                 from rate.c:19:
rate.c: In function 'oc_enc_rc_reset':
ocintrin.h:51:52: warning: comparison of integer expressions of different signedness: 'int' and 'ogg_uint32_t' {aka 'unsigned int'} [-Wsign-compare]
   51 | #define OC_MINI(_a,_b)      ((_a)+((_b)-(_a)&-((_b)<(_a))))
      |                                                    ^
rate.c:268:4: note: in expansion of macro 'OC_MINI'
  268 |    OC_MINI(_enc->keyframe_frequency_force,_enc->rc.buf_delay);
      |    ^~~~~~~
rate.c:306:47: warning: operand of '?:' changes signedness from 'int' to 'ogg_uint32_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
  306 |    OC_MAXI(_enc->keyframe_frequency_force,12):_enc->rc.buf_delay)>>1;
      |                                               ^~~~~~~~~~~~~~~~~~
In file included from internal.h:26,
                 from state.h:19,
                 from encint.h:20,
                 from rate.c:19:
rate.c: In function 'oc_enc_rc_resize':
ocintrin.h:51:52: warning: comparison of integer expressions of different signedness: 'int' and 'ogg_uint32_t' {aka 'unsigned int'} [-Wsign-compare]
   51 | #define OC_MINI(_a,_b)      ((_a)+((_b)-(_a)&-((_b)<(_a))))
      |                                                    ^
rate.c:365:6: note: in expansion of macro 'OC_MINI'
  365 |      OC_MINI(_enc->keyframe_frequency_force,_enc->rc.buf_delay);
      |      ^~~~~~~
rate.c:384:15: warning: comparison of integer expressions of different signedness: 'int' and 'ogg_uint32_t' {aka 'unsigned int'} [-Wsign-compare]
  384 |      buf_delay<_enc->rc.frames_total[0]+_enc->rc.frames_total[1]
      |               ^
rate.c:403:10: warning: operand of '?:' changes signedness from 'int' to 'ogg_uint32_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
  403 |          cfm:_enc->rc.frames_total[0]+_enc->rc.frames_total[1]
      |          ^~~
In file included from internal.h:26,
                 from state.h:19,
                 from encint.h:20,
                 from rate.c:19:
rate.c: In function 'oc_enc_select_qi':
ocintrin.h:51:52: warning: comparison of integer expressions of different signedness: 'int' and 'ogg_uint32_t' {aka 'unsigned int'} [-Wsign-compare]
   51 | #define OC_MINI(_a,_b)      ((_a)+((_b)-(_a)&-((_b)<(_a))))
      |                                                    ^
rate.c:489:38: note: in expansion of macro 'OC_MINI'
  489 |       nframes[0]=(_enc->rc.buf_delay-OC_MINI(next_key_frame,_enc->rc.buf_delay)
      |                                      ^~~~~~~
rate.c: In function 'oc_rc_buffer_fill':
rate.c:932:33: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long long unsigned int'} [-Wsign-compare]
  932 |   while(_rc->twopass_buffer_fill<_goal&&_consumed<_bytes){
      |                                 ^
In file included from internal.h:26,
                 from state.h:19,
                 from encint.h:20,
                 from rate.c:19:
rate.c: In function 'oc_enc_rc_2pass_in':
ocintrin.h:51:52: warning: comparison of integer expressions of different signedness: 'ogg_uint32_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
   51 | #define OC_MINI(_a,_b)      ((_a)+((_b)-(_a)&-((_b)<(_a))))
      |                                                    ^
rate.c:1079:23: note: in expansion of macro 'OC_MINI'
 1079 |         frames_needed=OC_MINI(_enc->rc.buf_delay-OC_MINI(_enc->rc.buf_delay,
      |                       ^~~~~~~
ocintrin.h:51:52: warning: comparison of integer expressions of different signedness: 'ogg_uint32_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
   51 | #define OC_MINI(_a,_b)      ((_a)+((_b)-(_a)&-((_b)<(_a))))
      |                                                    ^
rate.c:1117:27: note: in expansion of macro 'OC_MINI'
 1117 |             frames_needed=OC_MINI(_enc->rc.buf_delay-OC_MINI(_enc->rc.buf_delay,
      |                           ^~~~~~~
snappy.cc:333:70: warning: ignoring attributes on template argument 'snappy::internal::V128' {aka '__m128i'} [-Wignored-attributes]
  333 | static inline std::pair<V128 /* pattern */, V128 /* reshuffle_mask */>
      |                                                                      ^
snappy.cc:333:70: warning: ignoring attributes on template argument 'snappy::internal::V128' {aka '__m128i'} [-Wignored-attributes]
bitstream.c: In function 'shine_putbits':
bitstream.c:48:22: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
   48 |   if (bs->cache_bits > N) {
      |                      ^
bitstream.c:52:50: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'in ' [-Wsign-compare]
   52 |     if (bs->data_position + sizeof(unsigned int) >= bs->data_size) {
      |                                                  ^~
l3loop.c: In function 'ix_max':
l3loop.c:417:21: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  417 |   for (i = begin; i < end; i++)
      |                     ^
l3loop.c: In function 'count1_bitcount':
l3loop.c:459:48: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  459 |   for (i = cod_info->big_values << 1, k = 0; k < cod_info->count1;
      |                                                ^
l3loop.c: In function 'new_choose_table':
l3loop.c:616:39: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
  616 |       if (shine_huffman_table[i].xlen > max) {
      |                                       ^
l3loop.c:669:41: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
  669 |       if (shine_huffman_table[i].linmax >= max) {
      |                                         ^~
l3loop.c:675:41: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
  675 |       if (shine_huffman_table[i].linmax >= max) {
      |                                         ^~
l3loop.c: In function 'count_bit':
l3loop.c:728:23: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  728 |     for (i = start; i < end; i += 2) {
      |                       ^
l3loop.c:747:23: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  747 |     for (i = start; i < end; i += 2) {
      |                       ^
In file included from preprocess.c:12:
preprocess.c: In function 'Gsm_Preprocess':
private.h:110:23: warning: operand of '?:' changes signedness from 'longword' {aka 'long int'} to 'long unsigned int' due to unsignedness of other operand [-Wsign-compare]
  110 |         : ((b) <= 0 ? (a) + (b)   \
      |                       ^~~~~~~~~
preprocess.c:96:26: note: in expansion of macro 'GSM_L_ADD'
   96 |                 L_z2   = GSM_L_ADD( L_temp, L_s2 );
      |                          ^~~~~~~~~
private.h:107:22: warning: operand of '?:' changes signedness from 'long int' to 'long unsigned int' due to unsignedness of other operand [-Wsign-compare]
  107 |         ( (a) <  0 ? ( (b) >= 0 ? (a) + (b)     \
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108 |                  : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  109 |                    >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 )   \
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
preprocess.c:96:26: note: in expansion of macro 'GSM_L_ADD'
   96 |                 L_z2   = GSM_L_ADD( L_temp, L_s2 );
      |                          ^~~~~~~~~
private.h:110:23: warning: operand of '?:' changes signedness from 'long int' to 'long unsigned int' due to unsignedness of other operand [-Wsign-compare]
  110 |         : ((b) <= 0 ? (a) + (b)   \
      |                       ^~~~~~~~~
preprocess.c:100:26: note: in expansion of macro 'GSM_L_ADD'
  100 |                 L_temp = GSM_L_ADD( L_z2, 16384 );
      |                          ^~~~~~~~~
private.h:107:22: warning: operand of '?:' changes signedness from 'long int' to 'long unsigned int' due to unsignedness of other operand [-Wsign-compare]
  107 |         ( (a) <  0 ? ( (b) >= 0 ? (a) + (b)     \
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108 |                  : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  109 |                    >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 )   \
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
preprocess.c:100:26: note: in expansion of macro 'GSM_L_ADD'
  100 |                 L_temp = GSM_L_ADD( L_z2, 16384 );
      |                          ^~~~~~~~~
In file included from codec2_fft.h:11,
                 from fdmdv.c:41:
fdmdv.c: In function 'fdmdv_create':
fdmdv.c:89:44: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'int' [-Wsign-compare]
   89 |   assert((sizeof(test_bits) / sizeof(int)) >= f->ntest_bits);
      |                                            ^~
freedv_data_channel.c: In function 'freedv_data_channel_rx_frame':
freedv_data_channel.c:193:30: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long long unsigned int'} [-Wsign-compare]
  193 |       if (fdc->packet_rx_cnt == size) {
      |                              ^~
freedv_data_channel.c: In function 'freedv_data_channel_tx_frame':
freedv_data_channel.c:278:14: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long long unsigned int'} [-Wsign-compare]
  278 |     if (copy > size) {
      |              ^
freedv_fsk.c: In function 'freedv_rx_fsk_ldpc_data':
freedv_fsk.c:517:29: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  517 |           for (int u = 0; u < sizeof(fsk_ldpc_uw); u++)
      |                             ^
freedv_fsk.c:536:27: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  536 |         for (int u = 0; u < sizeof(fsk_ldpc_uw); u++)
      |                           ^
fsk.c: In function 'fsk_generate_hann_table':
fsk.c:92:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
   92 |   for (i = 0; i < Ndft; i++) {
      |                 ^
fsk.c: In function 'fsk_mod':
fsk.c:298:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  298 |   for (m = 0; m < M; m++) {
      |                 ^
fsk.c:305:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  305 |   for (i = 0; i < nsym; i++) {
      |                 ^
fsk.c:317:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  317 |     for (j = 0; j < Ts; j++) {
      |                   ^
fsk.c: In function 'fsk_mod_c':
fsk.c:364:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  364 |   for (i = 0; i < nsym; i++) {
      |                 ^
fsk.c:376:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  376 |     for (j = 0; j < Ts; j++) {
      |                   ^
fsk.c: In function 'fsk_demod_freq_est':
fsk.c:491:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  491 |   for (j = 0; j < numffts; j++) {
      |                 ^
fsk.c:495:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  495 |     for (i = 0; i < Ndft; i++) {
      |                   ^
fsk.c:510:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  510 |     for (i = 0; i < Ndft / 2; i++) {
      |                   ^
fsk.c:517:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  517 |     for (i = 0; i < Ndft; i++) {
      |                   ^
fsk.c:524:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  524 |     for (i = 0; i < Ndft; i++) {
      |                   ^
fsk.c:534:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  534 |   for (i = 0; i < M; i++) {
      |                 ^
fsk.c:537:20: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  537 |     for (j = st; j < en; j++) {
      |                    ^
fsk.c:549:23: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  549 |     for (j = f_min; j < f_max; j++) fftout[j].i = 0;
      |                       ^
fsk.c:558:12: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  558 |   while (i < M) {
      |            ^
fsk.c:570:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  570 |   for (i = 0; i < M; i++) {
      |                 ^
fsk.c:579:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  579 |   for (i = 0; i < Ndft; i++) mask[i] = 0.0;
      |                 ^
fsk.c:584:21: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  584 |     for (i = bin; i <= bin + 2; i++) mask[i] = 1.0;
      |                     ^~
fsk.c:598:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  598 |     for (i = 0; i < len_mask; i++) corr += mask[i] * Sf[b + i];
      |                   ^
fsk.c: In function 'fsk_demod_core':
fsk.c:663:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  663 |   for (m = 0; m < M; m++) {
      |                 ^
fsk.c:664:36: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  664 |     for (i = 0, j = Nmem - nold; i < nold; i++, j++)
      |                                    ^
fsk.c:670:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  670 |   for (m = 0; m < M; m++) {
      |                 ^
fsk.c:672:29: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  672 |     for (i = nold, j = 0; i < Nmem; i++, j++) {
      |                             ^
fsk.c:685:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  685 |   for (i = 0; i < (nsym + 1) * P; i++) {
      |                 ^
fsk.c:688:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  688 |     for (m = 0; m < M; m++) {
      |                   ^
fsk.c:690:22: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  690 |       for (j = st; j <= en; j++)
      |                      ^~
fsk.c:712:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  712 |   for (i = 0; i < (nsym + 1) * P; i++) {
      |                 ^
fsk.c:715:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  715 |     for (m = 0; m < M; m++) {
      |                   ^
fsk.c:778:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  778 |   for (i = 0; i < nsym; i++) {
      |                 ^
fsk.c:781:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  781 |     for (m = 0; m < M; m++) {
      |                   ^
fsk.c:792:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  792 |     for (m = 0; m < M; m++) {
      |                   ^
fsk.c:816:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  816 |     for (m = 0; m < M; m++) {
      |                   ^
fsk.c:897:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  897 |   for (i = 0; i < eye_traces; i++) {
      |                 ^
fsk.c:898:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  898 |     for (m = 0; m < M; m++) {
      |                   ^
fsk.c:899:21: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  899 |       for (j = 0; j < neyesamp; j++) {
      |                     ^
fsk.c:919:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  919 |     for (i = 0; i < M * eye_traces; i++)
      |                   ^
fsk.c:920:21: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  920 |       for (j = 0; j < neyesamp; j++)
      |                     ^
fsk.c:924:19: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  924 |     for (i = 0; i < M * eye_traces; i++)
      |                   ^
fsk.c:925:21: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  925 |       for (j = 0; j < neyesamp; j++)
      |                     ^
fsk.c:932:17: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  932 |   for (i = 0; i < M; i++) fsk->stats->f_est[i] = f_est[i];
      |                 ^
mpdecode_core.c: In function 'encode':
mpdecode_core.c:73:17: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
   73 |   for (p = 0; p < ldpc->NumberParityBits; p++) {
      |                 ^
mpdecode_core.c:76:19: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
   76 |     for (i = 0; i < ldpc->max_row_weight; i++) {
      |                   ^
ofdm.c: In function 'ofdm_hilbert_clipper':
ofdm.c:1074:21: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long long unsigned int'} [-Wsign-compare]
 1074 |   for (int i = 0; i < n; i++) tx[i] *= ofdm->amp_scale;
      |                     ^
ofdm.c:1078:23: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long long unsigned int'} [-Wsign-compare]
 1078 |     for (int i = 0; i < n; i++) tx[i] *= ofdm->clip_gain1;
      |                       ^
ofdm.c:1093:23: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long long unsigned int'} [-Wsign-compare]
 1093 |     for (int i = 0; i < n; i++) tx[i] *= ofdm->clip_gain2;
      |                       ^
ofdm_demod.c: In function 'main':
ofdm_demod.c:437:59: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  437 |   while ((fread(rx_scaled, sizeof(short), nin_frame, fin) == nin_frame) &&
      |                                                           ^~
In file included from ofdm_demod.c:31:
ofdm_demod.c:668:68: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  668 |         assert(fread(rx_scaled, sizeof(short), nin_frame / 2, fin) ==
      |                                                                    ^~
reliable_text.c: In function 'convert_callsign_to_ota_string_':
reliable_text.c:89:32: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
   89 |   for (size_t index = 0; index < maxLength; index++) {
      |                                ^
reliable_text.c: In function 'convert_ota_string_to_callsign_':
reliable_text.c:112:32: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  112 |   for (size_t index = 0; index < maxLength; index++) {
      |                                ^
Larhzu commented 3 weeks ago

I'm building ffmpeg with a bunch of plugins. Should I fix these hidden warnings?

That's not xz. Each project has a different style. If adding a warning option produces a ton of warnings, probably that project doesn't care about such warnings. There are always pros and cons. For example, xz is far from clean with -Wconversion but I'm not ready to fix it yet.

With many projects, your way of building files directly without the build system will cause more problems than you perhaps realize. The issue you had with ARRAY_SIZE in xz was just one of many such situations. So use the build system and add the warnings to CFLAGS as needed.

Jamaika1 commented 1 week ago

https://github.com/Jamaika1/plugins_ffmpeg701_mingw1150/commit/97cb82cc9b9873305119491fcc476719bf020edf#diff-7637ea832ded623746a8b9d16093cdcbef7eb8559050f4787dcc0504e261264b

Larhzu commented 1 week ago

It is very logical that ARRAY_SIZE returns the same type as sizeof. Changing that isn't acceptable.

The xz package builds cleanly with -Wtype-limits. Thus, I don't see what you are trying to fix. The way you got warnings due to ARRAY_SIZE in your earlier message was because you built the .c files in an incorrect way that wouldn't produce a working liblzma anyway.