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

[MinGW] Disable GCC warning about using MS format specifiers in ISO C conformant code #1362

Merged
merged 1 commit into from
Oct 23, 2022

Conversation

mtl1979
Copy link
Collaborator

@mtl1979 mtl1979 commented Oct 13, 2022

-Wno-pedantic-ms-format was introduced in GCC 4.5 for MinGW, so we don't need to test if that is supported as minimum we support is GCC 4.8.

@codecov
Copy link

codecov bot commented Oct 13, 2022

Codecov Report

Base: 83.26% // Head: 83.25% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (4ec54ac) compared to base (e3a34f2).
Patch has no changes to coverable lines.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1362      +/-   ##
===========================================
- Coverage    83.26%   83.25%   -0.01%     
===========================================
  Files          128      128              
  Lines        10639    10639              
  Branches      2712     2712              
===========================================
- Hits          8859     8858       -1     
  Misses        1115     1115              
- Partials       665      666       +1     
Flag Coverage Δ
macos_clang 41.94% <ø> (ø)
macos_gcc 73.04% <ø> (ø)
ubuntu_clang 82.72% <ø> (ø)
ubuntu_clang_debug 82.36% <ø> (+0.18%) ⬆️
ubuntu_clang_inflate_allow_invalid_dist 82.38% <ø> (+0.18%) ⬆️
ubuntu_clang_inflate_strict 82.71% <ø> (+0.18%) ⬆️
ubuntu_clang_mmap 83.04% <ø> (ø)
ubuntu_clang_pigz 39.53% <ø> (ø)
ubuntu_clang_pigz_no_optim 41.60% <ø> (ø)
ubuntu_clang_pigz_no_threads 39.15% <ø> (ø)
ubuntu_clang_reduced_mem 83.21% <ø> (ø)
ubuntu_gcc 74.91% <ø> (+0.06%) ⬆️
ubuntu_gcc_aarch64 77.40% <ø> (ø)
ubuntu_gcc_aarch64_compat_no_opt 75.56% <ø> (+0.02%) ⬆️
ubuntu_gcc_aarch64_no_acle 76.12% <ø> (ø)
ubuntu_gcc_aarch64_no_neon 76.12% <ø> (ø)
ubuntu_gcc_armhf 77.45% <ø> (ø)
ubuntu_gcc_armhf_compat_no_opt 75.53% <ø> (+0.01%) ⬆️
ubuntu_gcc_armhf_no_acle 77.48% <ø> (ø)
ubuntu_gcc_armhf_no_neon 77.38% <ø> (ø)
ubuntu_gcc_armsf 77.28% <ø> (ø)
ubuntu_gcc_armsf_compat_no_opt 75.45% <ø> (+0.02%) ⬆️
ubuntu_gcc_benchmark 73.78% <ø> (ø)
ubuntu_gcc_compat_no_opt 76.92% <ø> (ø)
ubuntu_gcc_compat_sprefix 73.84% <ø> (+0.14%) ⬆️
ubuntu_gcc_m32 73.44% <ø> (+0.14%) ⬆️
ubuntu_gcc_mingw_i686 0.00% <ø> (ø)
ubuntu_gcc_mingw_x86_64 0.00% <ø> (ø)
ubuntu_gcc_no_avx2 73.94% <ø> (ø)
ubuntu_gcc_no_ctz 74.94% <ø> (ø)
ubuntu_gcc_no_ctzll 74.96% <ø> (ø)
ubuntu_gcc_no_pclmulqdq 73.85% <ø> (-0.06%) ⬇️
ubuntu_gcc_no_sse2 74.14% <ø> (ø)
ubuntu_gcc_no_sse4 73.83% <ø> (ø)
ubuntu_gcc_o1 73.71% <ø> (ø)
ubuntu_gcc_osb ∅ <ø> (∅)
ubuntu_gcc_pigz 37.67% <ø> (-0.06%) ⬇️
ubuntu_gcc_pigz_aarch64 38.95% <ø> (ø)
ubuntu_gcc_ppc 73.80% <ø> (ø)
ubuntu_gcc_ppc64 74.57% <ø> (ø)
ubuntu_gcc_ppc64le 74.51% <ø> (ø)
ubuntu_gcc_ppc_no_power8 74.74% <ø> (ø)
ubuntu_gcc_s390x 74.96% <ø> (ø)
ubuntu_gcc_s390x_dfltcc 72.18% <ø> (ø)
ubuntu_gcc_s390x_dfltcc_compat 73.71% <ø> (ø)
ubuntu_gcc_s390x_no_crc32 74.75% <ø> (ø)
ubuntu_gcc_sparc64 74.86% <ø> (ø)
ubuntu_gcc_sprefix 73.36% <ø> (ø)
win64_gcc 73.74% <ø> (+0.04%) ⬆️
win64_gcc_compat_no_opt 74.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
adler32_p.h 96.42% <0.00%> (-3.58%) ⬇️
arch/x86/adler32_sse42.c 98.46% <0.00%> (-1.54%) ⬇️
gzlib.c 70.60% <0.00%> (ø)
test/minideflate.c 45.22% <0.00%> (ø)
trees.c 92.51% <0.00%> (+0.24%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@nmoinvaz
Copy link
Member

nmoinvaz commented Oct 22, 2022

I kind of think we should change the printf statements to use inttypes.h definitions instead.

@mtl1979
Copy link
Collaborator Author

mtl1979 commented Oct 22, 2022

inttypes.h

ll format specifier isn't supported on Windows, so using inttypes.h doesn't fix anything.

@nmoinvaz
Copy link
Member

nmoinvaz commented Oct 22, 2022

Looks like we already do use inttypes.h. Here are the warnings.

zlib-ng/test/infcover.c: In functionmem_used’:
zlib-ng/test/infcover.c:1[83](https://github.com/zlib-ng/zlib-ng/actions/runs/3289136191/jobs/5420314359#step:11:84):21: warning: ISO C does not support the ‘I64’ ms_printf length modifier [-Wformat=]
  183 |     fprintf(stderr, "%s: %" PRIu64 " allocated\n", prefix, (uint64_t)zone->total);
      |                     ^~~~~~~
zlib-ng/test/infcover.c:183:21: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]
zlib-ng/test/infcover.c: In functionmem_high’:
zlib-ng/test/infcover.c:190:21: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]
  190 |     fprintf(stderr, "%s: %" PRIu64 " high water mark\n", prefix, (uint64_t)zone->highwater);
      |                     ^~~~~~~
zlib-ng/test/infcover.c:190:21: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]
zlib-ng/test/infcover.c: In functionmem_done’:
zlib-ng/test/infcover.c:214:25: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]
  214 |         fprintf(stderr, "** %s: %" PRIu64 " bytes in %d blocks not freed\n",
      |                         ^~~~~~~~~~
zlib-ng/test/infcover.c:214:25: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]

zlib-ng/tools/makecrct.c: In functionwrite_table64’:
zlib-ng/tools/makecrct.c:143:16: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]
  143 |         printf("%s0x%016" PRIx64 "%s", n == 0 || n % 3 ? "" : "    ",
      |                ^~~~~~~~~~
zlib-ng/tools/makecrct.c:143:16: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]
zlib-ng/test/fuzz/fuzzer_example_large.c: In functiontest_large_inflate’:
zlib-ng/test/fuzz/fuzzer_example_large.c:108:25: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]
  108 |         fprintf(stderr, "bad large inflate: %" PRIu64 "\n", (uint64_t)d_stream.total_out);
      |                         ^~~~~~~~~~~~~~~~~~~~~~
zlib-ng/test/fuzz/fuzzer_example_large.c:108:25: warning: ISO C does not support theI64ms_printf length modifier [-Wformat=]

@nmoinvaz
Copy link
Member

nmoinvaz commented Oct 22, 2022

Looks good. I'm not so sure we need the -D_POSIX_C_SOURCE=200809L on the CFLAGS anymore - looks like we already have it in zbuild.h. But that's a separate issue..

@mtl1979
Copy link
Collaborator Author

mtl1979 commented Oct 22, 2022

Looks good. I'm not so sure we need the -D_POSIX_C_SOURCE=200809L on the CFLAGS anymore - looks like we already have it in zbuild.h. But that's a separate issue..

We should only need to specify values on command-line that are higher than the defaults we assume in headers. The most common reason is when one operating system or toolset requires higher version than others, as we need to make sure the definition is correct before including any system headers. I try to make cleanup related pull requests once in a while so we have as little warnings emitted as possible when we are preparing a new release.

My main focus has been VC++, MinGW, MSYS and Cygwin since the early days, but I will also participate in some arch-dependent issues and features.

@Dead2 Dead2 merged commit 185f636 into zlib-ng:develop Oct 23, 2022
@Dead2 Dead2 mentioned this pull request Dec 27, 2022
Dead2 added a commit that referenced this pull request Mar 7, 2023
Changes since 2.0.6:
- Fix CVE-2022-37434 #1328
- Fix chunkmemset #1196
- Fix deflateBound too small #1236
- Fix Z_SOLO #1263
- Fix ACLE variant of crc32 #1274
- Fix inflateBack #1311
- Fix deflate_quick windowsize #1431
- Fix DFLTCC bugs related to adler32 #1349 and #1390
- Fix warnings #1194 #1312 #1362
- MacOS build fix #1198
- Add invalid windowBits handling #1293
- Support for Force TZCNT #1186
- Support for aligned_alloc() #1360
- Minideflate improvements #1175 #1238
- Dont use unaligned access for memcpy #1309
- Build system #1209 #1233 #1267 #1273 #1278 #1292 #1316 #1318 #1365
- Test improvements #1208 #1227 #1241 #1353
- Cleanup #1266
- Documentation #1205 #1359
- Misc improvements #1294 #1297 #1306 #1344 #1348
- Backported zlib fixes
- Backported CI workflows from Develop branch
Dead2 added a commit that referenced this pull request Mar 17, 2023
Changes since 2.0.6:
- Fix CVE-2022-37434 #1328
- Fix chunkmemset #1196
- Fix deflateBound too small #1236
- Fix Z_SOLO #1263
- Fix ACLE variant of crc32 #1274
- Fix inflateBack #1311
- Fix deflate_quick windowsize #1431
- Fix DFLTCC bugs related to adler32 #1349 and #1390
- Fix warnings #1194 #1312 #1362
- MacOS build fix #1198
- Add invalid windowBits handling #1293
- Support for Force TZCNT #1186
- Support for aligned_alloc() #1360
- Minideflate improvements #1175 #1238
- Dont use unaligned access for memcpy #1309
- Build system #1209 #1233 #1267 #1273 #1278 #1292 #1316 #1318 #1365
- Test improvements #1208 #1227 #1241 #1353
- Cleanup #1266
- Documentation #1205 #1359
- Misc improvements #1294 #1297 #1306 #1344 #1348
- Backported zlib fixes
- Backported CI workflows from Develop branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants