nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
27.08k stars 7.72k forks source link

stb_image_write.h warnings #1709

Open 1vanK opened 1 month ago

1vanK commented 1 month ago

GCC 13, Clang 16, MinGW with -Wall -Wextra -Wpedantic

/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h: In function ‘int stbi_write_bmp_to_func(void (*)(void*, void*, int), void*, int, int, int, const void*)’:
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:514:32: warning: missing initializer for member ‘stbi__write_context::context’ [-Wmissing-field-initializers]
  514 |    stbi__write_context s = { 0 };
      |                                ^
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:514:32: warning: missing initializer for member ‘stbi__write_context::buffer’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:514:32: warning: missing initializer for member ‘stbi__write_context::buf_used’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h: In function ‘int stbi_write_bmp(const char*, int, int, int, const void*)’:
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:522:32: warning: missing initializer for member ‘stbi__write_context::context’ [-Wmissing-field-initializers]
  522 |    stbi__write_context s = { 0 };
      |                                ^
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:522:32: warning: missing initializer for member ‘stbi__write_context::buffer’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:522:32: warning: missing initializer for member ‘stbi__write_context::buf_used’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h: In function ‘int stbi_write_tga_to_func(void (*)(void*, void*, int), void*, int, int, int, const void*)’:
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:613:32: warning: missing initializer for member ‘stbi__write_context::context’ [-Wmissing-field-initializers]
  613 |    stbi__write_context s = { 0 };
      |                                ^
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:613:32: warning: missing initializer for member ‘stbi__write_context::buffer’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:613:32: warning: missing initializer for member ‘stbi__write_context::buf_used’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h: In function ‘int stbi_write_tga(const char*, int, int, int, const void*)’:
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:621:32: warning: missing initializer for member ‘stbi__write_context::context’ [-Wmissing-field-initializers]
  621 |    stbi__write_context s = { 0 };
      |                                ^
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:621:32: warning: missing initializer for member ‘stbi__write_context::buffer’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:621:32: warning: missing initializer for member ‘stbi__write_context::buf_used’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h: In function ‘int stbi_write_hdr_to_func(void (*)(void*, void*, int), void*, int, int, int, const float*)’:
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:789:32: warning: missing initializer for member ‘stbi__write_context::context’ [-Wmissing-field-initializers]
  789 |    stbi__write_context s = { 0 };
      |                                ^
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:789:32: warning: missing initializer for member ‘stbi__write_context::buffer’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:789:32: warning: missing initializer for member ‘stbi__write_context::buf_used’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h: In function ‘int stbi_write_hdr(const char*, int, int, int, const float*)’:
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:796:32: warning: missing initializer for member ‘stbi__write_context::context’ [-Wmissing-field-initializers]
  796 |    stbi__write_context s = { 0 };
      |                                ^
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:796:32: warning: missing initializer for member ‘stbi__write_context::buffer’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:796:32: warning: missing initializer for member ‘stbi__write_context::buf_used’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h: In function ‘int stbi_write_jpg_to_func(void (*)(void*, void*, int), void*, int, int, int, const void*, int)’:
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:1609:32: warning: missing initializer for member ‘stbi__write_context::context’ [-Wmissing-field-initializers]
 1609 |    stbi__write_context s = { 0 };
      |                                ^
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:1609:32: warning: missing initializer for member ‘stbi__write_context::buffer’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:1609:32: warning: missing initializer for member ‘stbi__write_context::buf_used’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h: In function ‘int stbi_write_jpg(const char*, int, int, int, const void*, int)’:
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:1618:32: warning: missing initializer for member ‘stbi__write_context::context’ [-Wmissing-field-initializers]
 1618 |    stbi__write_context s = { 0 };
      |                                ^
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:1618:32: warning: missing initializer for member ‘stbi__write_context::buffer’ [-Wmissing-field-initializers]
/home/runner/work/dviglo2d/dviglo2d/engine_repo/libs/third_party/stb/repo/stb_image_write.h:1618:32: warning: missing initializer for member ‘stbi__write_context::buf_used’ [-Wmissing-field-initializers]

https://stackoverflow.com/questions/6891720/initialize-reset-struct-to-zero-null

N-R-K commented 1 month ago

Duplicate of https://github.com/nothings/stb/issues/1099

1vanK commented 1 month ago

Use any method, and then spend another 10 years choosing the ideal one.