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

Compiler warnings when building on Windows with clang + cmake #932

Closed
pmqs opened this issue Feb 8, 2024 · 25 comments
Closed

Compiler warnings when building on Windows with clang + cmake #932

pmqs opened this issue Feb 8, 2024 · 25 comments

Comments

@pmqs
Copy link
Contributor

pmqs commented Feb 8, 2024

Not sure if this is intended to be a supported combination, but a Windows build using clang & cmake spits out plenty of Compiler warnings

D:\Linux\develop\zlib>cmake -B build -S . -DCMAKE_C_COMPILER="clang" -G Ninja
-- The C compiler identification is Clang 16.0.5 with GNU-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/Llvm/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for fseeko
-- Looking for fseeko - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Configuring done (3.7s)
-- Generating done (0.1s)
-- Build files have been written to: D:/Linux/develop/zlib/build

D:\Linux\develop\zlib>cmake --build build
[1/37] Building C object CMakeFiles/zlib.dir/compress.c.obj
[2/37] Building C object CMakeFiles/zlib.dir/adler32.c.obj
[3/37] Building C object CMakeFiles/zlib.dir/crc32.c.obj
[4/37] Building C object CMakeFiles/zlib.dir/gzread.c.obj
D:/Linux/develop/zlib/gzread.c:22:15: warning: 'read' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _read. See online help for details. [-Wdeprecated-declarations]
        ret = read(state->fd, buf + *have, get);
              ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:524:9: note: 'read' has been explicitly marked deprecated here
        _CRT_NONSTDC_DEPRECATE(_read)
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzread.c:28:34: warning: 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
        gz_error(state, Z_ERRNO, zstrerror());
                                 ^
D:/Linux/develop/zlib/gzguts.h:127:25: note: expanded from macro 'zstrerror'
#    define zstrerror() strerror(errno)
                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:177:16: note: 'strerror' has been explicitly marked deprecated here
_Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s)
               ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzread.c:599:11: warning: 'close' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. [-Wdeprecated-declarations]
    ret = close(state->fd);
          ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:460:28: note: 'close' has been explicitly marked deprecated here
        _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_close)
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
3 warnings generated.
[5/37] Building C object CMakeFiles/zlib.dir/gzclose.c.obj
[6/37] Building C object CMakeFiles/zlib.dir/gzwrite.c.obj
D:/Linux/develop/zlib/gzwrite.c:78:20: warning: 'write' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. [-Wdeprecated-declarations]
            writ = write(state->fd, strm->next_in, put);
                   ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:559:24: note: 'write' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_write)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzwrite.c:80:42: warning: 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
                gz_error(state, Z_ERRNO, zstrerror());
                                         ^
D:/Linux/develop/zlib/gzguts.h:127:25: note: expanded from macro 'zstrerror'
#    define zstrerror() strerror(errno)
                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:177:16: note: 'strerror' has been explicitly marked deprecated here
_Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s)
               ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzwrite.c:108:24: warning: 'write' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. [-Wdeprecated-declarations]
                writ = write(state->fd, state->x.next, put);
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:559:24: note: 'write' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_write)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzwrite.c:110:46: warning: 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
                    gz_error(state, Z_ERRNO, zstrerror());
                                             ^
D:/Linux/develop/zlib/gzguts.h:127:25: note: expanded from macro 'zstrerror'
#    define zstrerror() strerror(errno)
                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:177:16: note: 'strerror' has been explicitly marked deprecated here
_Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s)
               ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzwrite.c:627:9: warning: 'close' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. [-Wdeprecated-declarations]
    if (close(state->fd) == -1)
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:460:28: note: 'close' has been explicitly marked deprecated here
        _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_close)
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
5 warnings generated.
[7/37] Building C object CMakeFiles/zlib.dir/deflate.c.obj
[8/37] Building C object CMakeFiles/zlib.dir/inflate.c.obj
[9/37] Building C object CMakeFiles/zlib.dir/infback.c.obj
[10/37] Building C object CMakeFiles/zlib.dir/inftrees.c.obj
[11/37] Building C object CMakeFiles/zlib.dir/inffast.c.obj
[12/37] Building C object CMakeFiles/zlib.dir/uncompr.c.obj
[13/37] Building C object CMakeFiles/zlib.dir/gzlib.c.obj
D:/Linux/develop/zlib/gzlib.c:183:15: warning: 'wcstombs' is deprecated: This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
        len = wcstombs(NULL, path, 0);
              ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdlib.h:1012:1: note: 'wcstombs' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:891:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE'
    __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1962:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzlib.c:198:13: warning: 'wcstombs' is deprecated: This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
            wcstombs(state->path, path, len + 1);
            ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdlib.h:1012:1: note: 'wcstombs' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:891:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE'
    __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1962:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzlib.c:233:20: warning: '_wopen' is deprecated: This function or variable may be unsafe. Consider using _wsopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
        fd == -2 ? _wopen(path, oflag, 0666) :
                   ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_wio.h:253:20: note: '_wopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(_wsopen_s)
                   ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzlib.c:235:9: warning: 'open' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. [-Wdeprecated-declarations]
        open((const char *)path, oflag, 0666));
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:517:24: note: 'open' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_open) _CRT_INSECURE_DEPRECATE(_sopen_s)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
4 warnings generated.
[14/37] Building RC object CMakeFiles/zlib.dir/win32/zlib1.rc.res
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.

[15/37] Building C object CMakeFiles/zlib.dir/trees.c.obj
[16/37] Building C object CMakeFiles/zlibstatic.dir/compress.c.obj
[17/37] Building C object CMakeFiles/zlibstatic.dir/adler32.c.obj
[18/37] Building C object CMakeFiles/zlib.dir/zutil.c.obj
[19/37] Building C object CMakeFiles/zlibstatic.dir/crc32.c.obj
[20/37] Building C object CMakeFiles/zlibstatic.dir/gzclose.c.obj
[21/37] Building C object CMakeFiles/zlibstatic.dir/deflate.c.obj
[22/37] Building C object CMakeFiles/zlibstatic.dir/gzread.c.obj
D:/Linux/develop/zlib/gzread.c:22:15: warning: 'read' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _read. See online help for details. [-Wdeprecated-declarations]
        ret = read(state->fd, buf + *have, get);
              ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:524:9: note: 'read' has been explicitly marked deprecated here
        _CRT_NONSTDC_DEPRECATE(_read)
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzread.c:28:34: warning: 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
        gz_error(state, Z_ERRNO, zstrerror());
                                 ^
D:/Linux/develop/zlib/gzguts.h:127:25: note: expanded from macro 'zstrerror'
#    define zstrerror() strerror(errno)
                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:177:16: note: 'strerror' has been explicitly marked deprecated here
_Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s)
               ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzread.c:599:11: warning: 'close' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. [-Wdeprecated-declarations]
    ret = close(state->fd);
          ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:460:28: note: 'close' has been explicitly marked deprecated here
        _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_close)
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
3 warnings generated.
[23/37] Building C object CMakeFiles/zlibstatic.dir/infback.c.obj
[24/37] Building C object CMakeFiles/zlibstatic.dir/inftrees.c.obj
[25/37] Building C object CMakeFiles/zlibstatic.dir/inflate.c.obj
[26/37] Building C object CMakeFiles/zlibstatic.dir/gzwrite.c.obj
D:/Linux/develop/zlib/gzwrite.c:78:20: warning: 'write' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. [-Wdeprecated-declarations]
            writ = write(state->fd, strm->next_in, put);
                   ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:559:24: note: 'write' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_write)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzwrite.c:80:42: warning: 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
                gz_error(state, Z_ERRNO, zstrerror());
                                         ^
D:/Linux/develop/zlib/gzguts.h:127:25: note: expanded from macro 'zstrerror'
#    define zstrerror() strerror(errno)
                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:177:16: note: 'strerror' has been explicitly marked deprecated here
_Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s)
               ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzwrite.c:108:24: warning: 'write' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. [-Wdeprecated-declarations]
                writ = write(state->fd, state->x.next, put);
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:559:24: note: 'write' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_write)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzwrite.c:110:46: warning: 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
                    gz_error(state, Z_ERRNO, zstrerror());
                                             ^
D:/Linux/develop/zlib/gzguts.h:127:25: note: expanded from macro 'zstrerror'
#    define zstrerror() strerror(errno)
                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:177:16: note: 'strerror' has been explicitly marked deprecated here
_Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s)
               ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzwrite.c:627:9: warning: 'close' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. [-Wdeprecated-declarations]
    if (close(state->fd) == -1)
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:460:28: note: 'close' has been explicitly marked deprecated here
        _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_close)
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
5 warnings generated.
[27/37] Building C object CMakeFiles/zlibstatic.dir/gzlib.c.obj
D:/Linux/develop/zlib/gzlib.c:183:15: warning: 'wcstombs' is deprecated: This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
        len = wcstombs(NULL, path, 0);
              ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdlib.h:1012:1: note: 'wcstombs' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:891:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE'
    __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1962:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzlib.c:198:13: warning: 'wcstombs' is deprecated: This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
            wcstombs(state->path, path, len + 1);
            ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdlib.h:1012:1: note: 'wcstombs' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:891:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE'
    __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1962:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzlib.c:233:20: warning: '_wopen' is deprecated: This function or variable may be unsafe. Consider using _wsopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
        fd == -2 ? _wopen(path, oflag, 0666) :
                   ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_wio.h:253:20: note: '_wopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(_wsopen_s)
                   ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/gzlib.c:235:9: warning: 'open' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. [-Wdeprecated-declarations]
        open((const char *)path, oflag, 0666));
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:517:24: note: 'open' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_open) _CRT_INSECURE_DEPRECATE(_sopen_s)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
4 warnings generated.
[28/37] Building C object CMakeFiles/zlibstatic.dir/inffast.c.obj
[29/37] Building C object CMakeFiles/zlibstatic.dir/uncompr.c.obj
[30/37] Building C object CMakeFiles/zlibstatic.dir/trees.c.obj
[31/37] Building C object CMakeFiles/zlibstatic.dir/zutil.c.obj
[32/37] Building C object CMakeFiles/example.dir/test/example.c.obj
D:/Linux/develop/zlib/test/example.c:70:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:117:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:208:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:300:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:374:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:449:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
6 warnings generated.
[33/37] Building C object CMakeFiles/minigzip.dir/test/minigzip.c.obj
D:/Linux/develop/zlib/test/minigzip.c:427:10: warning: 'fopen' is deprecated: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    in = fopen(file, "rb");
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:212:20: note: 'fopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(fopen_s)
                   ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:439:5: warning: 'unlink' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details. [-Wdeprecated-declarations]
    unlink(file);
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:554:9: note: 'unlink' has been explicitly marked deprecated here
        _CRT_NONSTDC_DEPRECATE(_unlink)
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:474:11: warning: 'fopen' is deprecated: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    out = fopen(outfile, "wb");
          ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:212:20: note: 'fopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(fopen_s)
                   ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:482:5: warning: 'unlink' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details. [-Wdeprecated-declarations]
    unlink(infile);
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:554:9: note: 'unlink' has been explicitly marked deprecated here
        _CRT_NONSTDC_DEPRECATE(_unlink)
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:537:9: warning: 'setmode' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _setmode. See online help for details. [-Wdeprecated-declarations]
        SET_BINARY_MODE(stdin);
        ^
D:/Linux/develop/zlib/test/minigzip.c:42:33: note: expanded from macro 'SET_BINARY_MODE'
#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
                                ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:531:24: note: 'setmode' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_setmode)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:537:9: warning: 'fileno' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. See online help for details. [-Wdeprecated-declarations]
        SET_BINARY_MODE(stdin);
        ^
D:/Linux/develop/zlib/test/minigzip.c:42:41: note: expanded from macro 'SET_BINARY_MODE'
#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
                                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:2433:28: note: 'fileno' has been explicitly marked deprecated here
        _Check_return_     _CRT_NONSTDC_DEPRECATE(_fileno)    _ACRTIMP int   __cdecl fileno(_In_ FILE* _Stream);
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:538:9: warning: 'setmode' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _setmode. See online help for details. [-Wdeprecated-declarations]
        SET_BINARY_MODE(stdout);
        ^
D:/Linux/develop/zlib/test/minigzip.c:42:33: note: expanded from macro 'SET_BINARY_MODE'
#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
                                ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:531:24: note: 'setmode' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_setmode)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:538:9: warning: 'fileno' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. See online help for details. [-Wdeprecated-declarations]
        SET_BINARY_MODE(stdout);
        ^
D:/Linux/develop/zlib/test/minigzip.c:42:41: note: expanded from macro 'SET_BINARY_MODE'
#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
                                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:2433:28: note: 'fileno' has been explicitly marked deprecated here
        _Check_return_     _CRT_NONSTDC_DEPRECATE(_fileno)    _ACRTIMP int   __cdecl fileno(_In_ FILE* _Stream);
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:540:28: warning: 'fileno' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. See online help for details. [-Wdeprecated-declarations]
            file = gzdopen(fileno(stdin), "rb");
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:2433:28: note: 'fileno' has been explicitly marked deprecated here
        _Check_return_     _CRT_NONSTDC_DEPRECATE(_fileno)    _ACRTIMP int   __cdecl fileno(_In_ FILE* _Stream);
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:544:28: warning: 'fileno' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. See online help for details. [-Wdeprecated-declarations]
            file = gzdopen(fileno(stdout), outmode);
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:2433:28: note: 'fileno' has been explicitly marked deprecated here
        _Check_return_     _CRT_NONSTDC_DEPRECATE(_fileno)    _ACRTIMP int   __cdecl fileno(_In_ FILE* _Stream);
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:550:13: warning: 'setmode' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _setmode. See online help for details. [-Wdeprecated-declarations]
            SET_BINARY_MODE(stdout);
            ^
D:/Linux/develop/zlib/test/minigzip.c:42:33: note: expanded from macro 'SET_BINARY_MODE'
#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
                                ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_io.h:531:24: note: 'setmode' has been explicitly marked deprecated here
        _Check_return_ _CRT_NONSTDC_DEPRECATE(_setmode)
                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:550:13: warning: 'fileno' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. See online help for details. [-Wdeprecated-declarations]
            SET_BINARY_MODE(stdout);
            ^
D:/Linux/develop/zlib/test/minigzip.c:42:41: note: expanded from macro 'SET_BINARY_MODE'
#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
                                        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:2433:28: note: 'fileno' has been explicitly marked deprecated here
        _Check_return_     _CRT_NONSTDC_DEPRECATE(_fileno)    _ACRTIMP int   __cdecl fileno(_In_ FILE* _Stream);
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:565:33: warning: 'fopen' is deprecated: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
                    FILE * in = fopen(*argv, "rb");
                                ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:212:20: note: 'fopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(fopen_s)
                   ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:570:40: warning: 'fileno' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. See online help for details. [-Wdeprecated-declarations]
                        file = gzdopen(fileno(stdout), outmode);
                                       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:2433:28: note: 'fileno' has been explicitly marked deprecated here
        _Check_return_     _CRT_NONSTDC_DEPRECATE(_fileno)    _ACRTIMP int   __cdecl fileno(_In_ FILE* _Stream);
                           ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:428:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE'
        #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT(             \
                                                 ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
14 warnings generated.
[34/37] Linking C shared library zlib.dll
[35/37] Linking C static library zlibstatic.lib
[36/37] Linking C executable minigzip.exe
[37/37] Linking C executable example.exe
@madler
Copy link
Owner

madler commented Feb 9, 2024

I pushed a commit on the develop branch that should address all of those. Then again, maybe not, since I don't have a way to test it. Please give it try. Thanks.

@sezero
Copy link

sezero commented Feb 9, 2024

Commit 985a62d is broken:

  • wcstombs_s is not available in every toolchain
  • wcstombs_s is most possibly not available in WinCE-targeting toolchains
  • _SH_DENYNO needs including share.h, and might not be in every toolchain
  • _setmode is not available in DJGPP (i.e. the change in minigzip.c, etc)
  • (maybe more, didn't fully check..)

Can it be reverted, please?

@madler
Copy link
Owner

madler commented Feb 9, 2024

  • (maybe more, didn't fully check..)

@sezero Please complete your examination and let me know what else you believe is broken. Thanks.

@sezero
Copy link

sezero commented Feb 9, 2024

  • (maybe more, didn't fully check..)

@sezero Please complete your examination and let me know what else you believe is broken. Thanks.

Verified that DJGPP build of test/minigzip.c is broken:

test/minigzip.c: In function `file_compress':
test/minigzip.c:429: warning: passing arg 3 of `string_copy' as unsigned due to prototype
test/minigzip.c: In function `main':
test/minigzip.c:541: warning: implicit declaration of function `_setmode'
test/minigzip.c:541: warning: implicit declaration of function `_fileno'

Same will be true whereever _fileno and _setmode are used: Those
underscore prepended versions of libc calls are for windows-only and
not others.


Speaking of djgpp, building libz already has warnings (not related to
this particular ticket, but still:)

gzlib.c: In function `gz_open':
gzlib.c:245: warning: implicit declaration of function `lseek'
i586-pc-msdosdjgpp-gcc -MMD -O3  -Wall -Wwrite-strings -Wpointer-arith -Wconversion -Wstrict-prototypes -Wmissing-prototypes -c gzread.c -o gzread.o
gzread.c: In function `gz_load':
gzread.c:22: warning: implicit declaration of function `read'
gzread.c: In function `gzclose_r':
gzread.c:599: warning: implicit declaration of function `close'
i586-pc-msdosdjgpp-gcc -MMD -O3  -Wall -Wwrite-strings -Wpointer-arith -Wconversion -Wstrict-prototypes -Wmissing-prototypes -c gzwrite.c -o gzwrite.o
gzwrite.c: In function `gz_comp':
gzwrite.c:78: warning: implicit declaration of function `write'
gzwrite.c: In function `gzclose_w':
gzwrite.c:627: warning: implicit declaration of function `close'
deflate.c: In function `deflate_stored':
deflate.c:1671: warning: passing arg 4 of `_tr_stored_block' as signed due to prototype
deflate.c:1795: warning: passing arg 4 of `_tr_stored_block' as signed due to prototype

Including unistd.h fixes the posix file io functions' prototype warnings,
only the last warning from deflate.c remains.

diff --git a/gzguts.h b/gzguts.h
index bd0a6fe..afb14f1 100644
--- a/gzguts.h
+++ b/gzguts.h
@@ -44,6 +44,10 @@
 #  include <sys/stat.h>
 #endif
 
+#if defined __DJGPP__
+#  include <unistd.h>
+#endif
+
 #if defined(_WIN32) && !defined(WIDECHAR)
 #  define WIDECHAR
 #endif

Verified that WinCE build is broken. Using a mingw-based toolchain, for e.g.:

$ make -f win32/Makefile.gcc PREFIX=arm-mingw32ce-
[...]
gzlib.c: In function 'gz_strwinerror':
gzlib.c:56:9: warning: implicit declaration of function 'wcstombs_s'; did you mean 'wcstombs'? [-Wimplicit-function-declaration]
   56 |         wcstombs_s(&len, buf, sizeof(buf), msgbuf, chars + 1);
      |         ^~~~~~~~~~
      |         wcstombs
gzlib.c: In function 'gz_open':
gzlib.c:235:9: warning: implicit declaration of function '_wsopen_s'; did you mean '_wopen'? [-Wimplicit-function-declaration]
  235 |         _wsopen_s(&state->fd, path, oflag, _SH_DENYNO, _S_IREAD | _S_IWRITE);
      |         ^~~~~~~~~
      |         _wopen
gzlib.c:9:17: warning: implicit declaration of function '_lseeki64'; did you mean 'gzseek64'? [-Wimplicit-function-declaration]
    9 | #  define LSEEK _lseeki64
      |                 ^~~~~~~~~
gzlib.c:245:9: note: in expansion of macro 'LSEEK'
  245 |         LSEEK(state->fd, 0, SEEK_END);  /* so gzoffset() is correct */
      |         ^~~~~
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0x3c8): undefined reference to `wcstombs_s'
gzlib.o:gzlib.c:(.text+0x3c8): relocation truncated to fit: ARM_26 against undefined symbol `wcstombs_s'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0x430): undefined reference to `_wsopen_s'
gzlib.o:gzlib.c:(.text+0x430): relocation truncated to fit: ARM_26 against undefined symbol `_wsopen_s'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0x448): undefined reference to `_lseeki64'
gzlib.o:gzlib.c:(.text+0x448): relocation truncated to fit: ARM_26 against undefined symbol `_lseeki64'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0x494): undefined reference to `_lseeki64'
gzlib.o:gzlib.c:(.text+0x494): relocation truncated to fit: ARM_26 against undefined symbol `_lseeki64'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0x4d8): undefined reference to `wcstombs_s'
gzlib.o:gzlib.c:(.text+0x4d8): relocation truncated to fit: ARM_26 against undefined symbol `wcstombs_s'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0x5a4): undefined reference to `wcstombs_s'
gzlib.o:gzlib.c:(.text+0x5a4): relocation truncated to fit: ARM_26 against undefined symbol `wcstombs_s'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0x704): undefined reference to `_lseeki64'
gzlib.o:gzlib.c:(.text+0x704): relocation truncated to fit: ARM_26 against undefined symbol `_lseeki64'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0x8cc): undefined reference to `_lseeki64'
gzlib.o:gzlib.c:(.text+0x8cc): relocation truncated to fit: ARM_26 against undefined symbol `_lseeki64'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0xa7c): undefined reference to `_lseeki64'
gzlib.o:gzlib.c:(.text+0xa7c): relocation truncated to fit: ARM_26 against undefined symbol `_lseeki64'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0xba0): undefined reference to `_lseeki64'
gzlib.o:gzlib.c:(.text+0xba0): relocation truncated to fit: ARM_26 against undefined symbol `_lseeki64'
/opt/cross_wince-arm/bin/../lib/gcc/arm-mingw32ce/9.3.0/../../../../arm-mingw32ce/bin/ld: gzlib.o:gzlib.c:(.text+0xc04): undefined reference to `_lseeki64'
gzlib.o:gzlib.c:(.text+0xc04): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
make: *** [win32/Makefile.gcc:91: zlib1.dll] Error 1

However, even if I back out the changes from that commit, it's still
broken because _lseeki64 isn't available.


I have nothing else, at the moment.

@pmqs
Copy link
Contributor Author

pmqs commented Feb 9, 2024

I pushed a commit on the develop branch that should address all of those. Then again, maybe not, since I don't have a way to test it. Please give it try. Thanks.

Sorry, still seeing warnings with clang 16 on Windows -- it ships with Visual Studio.

All is fine on Linux with clang 16.

[33/37] Building C object CMakeFiles/minigzip.dir/test/minigzip.c.obj
D:/Linux/develop/zlib/test/minigzip.c:431:10: warning: 'fopen' is deprecated: This function or variable may 
be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    in = fopen(file, "rb");
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:212:20: note: 'fopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(fopen_s)
                   ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:478:11: warning: 'fopen' is deprecated: This function or variable may 
be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    out = fopen(outfile, "wb");
          ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:212:20: note: 'fopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(fopen_s)
                   ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/minigzip.c:569:33: warning: 'fopen' is deprecated: This function or variable may 
be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
                    FILE * in = fopen(*argv, "rb");
                                ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h:212:20: note: 'fopen' has been explicitly marked deprecated here
    _Check_return_ _CRT_INSECURE_DEPRECATE(fopen_s)
                   ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
3 warnings generated.
[34/37] Building C object CMakeFiles/example.dir/test/example.c.obj
D:/Linux/develop/zlib/test/example.c:70:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro 
'__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:117:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro 
'__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:208:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro 
'__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:300:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro 
'__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:374:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro 
'__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
D:/Linux/develop/zlib/test/example.c:449:5: warning: 'strcpy' is deprecated: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    strcpy((char*)uncompr, "garbage");
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h:130:1: note: 'strcpy' has been explicitly marked deprecated here
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:835:5: note: expanded from macro 
'__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1'
    __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1894:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'
                _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
                ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:355:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
        #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
                                                      ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\vcruntime.h:345:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
                                              ^
6 warnings generated.

@sezero
Copy link

sezero commented Feb 9, 2024

Sorry, still seeing warnings with clang 16 on Windows -- it ships with Visual Studio.

Possibly the best solution for those warnings is disabling them, like:

#if defined _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

If, e.g. fopen, is used correctly then those MSVC warnings are just annoying noise.

@madler
Copy link
Owner

madler commented Feb 10, 2024

Verified that DJGPP build of test/minigzip.c is broken:
...
Those underscore prepended versions of libc calls are for windows-only and not others.

Yet it appears that DJGPP is definining _WIN32. Is that correct?

@madler
Copy link
Owner

madler commented Feb 10, 2024

Possibly the best solution for those warnings is disabling them, like:
...
#define _CRT_SECURE_NO_WARNINGS

Yes, that's what I did for the library, but I missed example.c and minigzip.c.

@madler
Copy link
Owner

madler commented Feb 10, 2024

@pmqs Ok, how about now?

@sezero
Copy link

sezero commented Feb 10, 2024

Verified that DJGPP build of test/minigzip.c is broken:
...
Those underscore prepended versions of libc calls are for windows-only and not others.

Yet it appears that DJGPP is definining _WIN32. Is that correct?

Most certainly not

@pmqs
Copy link
Contributor Author

pmqs commented Feb 10, 2024

@pmqs Ok, how about now?

That's fine now. Updating the workflow to use this clang + cmake on MSVC

@madler
Copy link
Owner

madler commented Feb 10, 2024

@sezero Can you provide the output on DJGPP of gcc -dM -E empty.c, where empty.c is a zero-length file? Thanks.

@sezero
Copy link

sezero commented Feb 10, 2024

@sezero Can you provide the output on DJGPP of gcc -dM -E empty.c, where empty.c is a zero-length file?

$  i586-pc-msdosdjgpp-gcc -E -dM -xc /dev/null
#define __GO32 1
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 65535U
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __FLT_EVAL_METHOD__ 2
#define __DBL_MIN_10_EXP__ (-307)
#define __FINITE_MATH_ONLY__ 0
#define __GNUC_PATCHLEVEL__ 6
#define __SHRT_MAX__ 32767
#define __LDBL_MAX__ 1.18973149535723176502e+4932L
#define __unix 1
#define __LDBL_MAX_EXP__ 16384
#define __DJGPP 2
#define __SCHAR_MAX__ 127
#define __USER_LABEL_PREFIX__ _
#define __STDC_HOSTED__ 1
#define __LDBL_HAS_INFINITY__ 1
#define __MSDOS__ 1
#define __DBL_DIG__ 15
#define __FLT_EPSILON__ 1.19209290e-7F
#define __LDBL_MIN__ 3.36210314311209350626e-4932L
#define __DJGPP__ 2
#define __unix__ 1
#define __DECIMAL_DIG__ 21
#define __LDBL_HAS_QUIET_NAN__ 1
#define __GNUC__ 3
#define __tune_i586__ 1
#define __DBL_MAX__ 1.7976931348623157e+308
#define __DBL_HAS_INFINITY__ 1
#define __DJGPP_MINOR__ 5
#define __DBL_MAX_EXP__ 1024
#define __LONG_LONG_MAX__ 9223372036854775807LL
#define __GXX_ABI_VERSION 1002
#define __FLT_MIN_EXP__ (-125)
#define __GO32__ 1
#define GO32 1
#define DJGPP_MINOR 5
#define __DBL_MIN__ 2.2250738585072014e-308
#define MSDOS 1
#define __DBL_HAS_QUIET_NAN__ 1
#define __REGISTER_PREFIX__ 
#define __NO_INLINE__ 1
#define __i386 1
#define __FLT_MANT_DIG__ 24
#define __VERSION__ "3.4.6"
#define i386 1
#define unix 1
#define __i386__ 1
#define __SIZE_TYPE__ long unsigned int
#define __FLT_RADIX__ 2
#define __LDBL_EPSILON__ 1.08420217248550443401e-19L
#define __FLT_HAS_QUIET_NAN__ 1
#define __FLT_MAX_10_EXP__ 38
#define __LONG_MAX__ 2147483647L
#define __FLT_HAS_INFINITY__ 1
#define __tune_pentium__ 1
#define DJGPP 2
#define __LDBL_MANT_DIG__ 64
#define __WCHAR_TYPE__ short unsigned int
#define __FLT_DIG__ 6
#define __INT_MAX__ 2147483647
#define __FLT_MAX_EXP__ 128
#define __DBL_MANT_DIG__ 53
#define __WINT_TYPE__ int
#define __LDBL_MIN_EXP__ (-16381)
#define __LDBL_MAX_10_EXP__ 4932
#define __DBL_EPSILON__ 2.2204460492503131e-16
#define __FLT_DENORM_MIN__ 1.40129846e-45F
#define __MSDOS 1
#define __FLT_MAX__ 3.40282347e+38F
#define __FLT_MIN_10_EXP__ (-37)
#define __GNUC_MINOR__ 4
#define __DBL_MAX_10_EXP__ 308
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
#define __PTRDIFF_TYPE__ int
#define __LDBL_MIN_10_EXP__ (-4931)
#define __DJGPP_MINOR 5
#define __LDBL_DIG__ 18

@madler
Copy link
Owner

madler commented Feb 11, 2024

@sezero Please give the develop branch a try on DJGPP.

@sezero
Copy link

sezero commented Feb 11, 2024

$ make -f msdos/Makefile.dj2 CC=i586-pc-msdosdjgpp-gcc AR="i586-pc-msdosdjgpp-ar rcs" libz.a
[...]
i586-pc-msdosdjgpp-gcc -MMD -O3  -Wall -Wwrite-strings -Wpointer-arith -Wconversion -Wstrict-prototypes -Wmissing-prototypes -c gzlib.c -o gzlib.o
gzlib.c: In function `gz_open':
gzlib.c:247: warning: passing arg 2 of `llseek' with different width due to prototype
gzlib.c:253: warning: passing arg 2 of `llseek' with different width due to prototype
gzlib.c: In function `gzrewind':
gzlib.c:337: warning: passing arg 2 of `llseek' with different width due to prototype
gzlib.c: In function `gzseek64':
gzlib.c:374: warning: passing arg 2 of `llseek' with different width due to prototype
gzlib.c: In function `gzoffset64':
gzlib.c:460: warning: passing arg 2 of `llseek' with different width due to prototype

llseek is prototyped like this:

offset_t	llseek(int _fildes, offset_t _offset, int _whence);

And offset_t is typedef'ed as long long

The warnings are due to -Wconversion and I think that warning flag
can be dropped.

@madler
Copy link
Owner

madler commented Feb 11, 2024

@sezero Please try applying this diff:

diff --git a/zconf.h b/zconf.h
index 0a9f22c..fbe7a79 100644
--- a/zconf.h
+++ b/zconf.h
@@ -511,12 +511,12 @@ typedef uLong FAR uLongf;
 
 #if !defined(_WIN32) && defined(Z_LARGE64)
 #  define z_off64_t off64_t
+#elif defined(_WIN32) && !defined(__GNUC__)
+#  define z_off64_t __int64
+#elif defined(__GO32__)
+#  define z_off64_t offset_t
 #else
-#  if defined(_WIN32) && !defined(__GNUC__)
-#    define z_off64_t __int64
-#  else
-#    define z_off64_t z_off_t
-#  endif
+#  define z_off64_t z_off_t
 #endif
 
 /* MVS linker does not support external names larger than 8 bytes */

and if you're using configure or cmake, then also apply it to zconf.h.in or zconf.h.cmakein respectively.

@sezero
Copy link

sezero commented Feb 11, 2024

@sezero Please try applying this diff:

$  make -f msdos/Makefile.dj2 CC=i586-pc-msdosdjgpp-gcc AR="i586-pc-msdosdjgpp-ar rcs" libz.a
i586-pc-msdosdjgpp-gcc -MMD -O3  -Wall -Wwrite-strings -Wpointer-arith -Wconversion -Wstrict-prototypes -Wmissing-prototypes -c adler32.c -o adler32.o
adler32.c: In function `adler32_combine':
adler32.c:159: warning: passing arg 3 of `adler32_combine_' with different width due to prototype
adler32.c: At top level:
adler32.c:162: error: conflicting types for 'adler32_combine64'
zutil.h:173: error: previous declaration of 'adler32_combine64' was here
adler32.c:162: error: conflicting types for 'adler32_combine64'
zutil.h:173: error: previous declaration of 'adler32_combine64' was here
make: *** [adler32.o] Error 1

and if you're using configure or cmake, then also apply it to zconf.h.in or zconf.h.cmakein respectively.

No, I am trying with the plain makefile

@madler
Copy link
Owner

madler commented Feb 12, 2024

@sezero Thanks. That exposed an inconsistency between header files which has been corrected. Please try the develop branch on DJGPP and let me know how it goes. Thanks.

@sezero
Copy link

sezero commented Feb 12, 2024

@sezero Thanks. That exposed an inconsistency between header files which has been corrected. Please try the develop branch on DJGPP and let me know how it goes. Thanks.

Thanks for working on this.

With current HEAD, I get the following warnings now:

$ make -f msdos/Makefile.dj2 CC=i586-pc-msdosdjgpp-gcc AR="i586-pc-msdosdjgpp-ar rcs" libz.a
i586-pc-msdosdjgpp-gcc -MMD -O3  -Wall -Wwrite-strings -Wpointer-arith -Wconversion -Wstrict-prototypes -Wmissing-prototypes -c gzlib.c -o gzlib.o
gzlib.c: In function `gz_open':
gzlib.c:247: warning: passing arg 2 of `llseek' with different width due to prototype
gzlib.c:253: warning: passing arg 2 of `llseek' with different width due to prototype
gzlib.c: In function `gzoffset64':
gzlib.c:460: warning: passing arg 2 of `llseek' with different width due to prototype

@madler
Copy link
Owner

madler commented Feb 12, 2024

Are you giving me all of the warnings each time? I was surprised to see those warnings about the type of a 0 disappear, since I wasn't expecting them to. But now they're back. That's actually a pretty dumb warning — the constant 0 should match any numeric type. That's a compiler bug. So, yes, at this point you should simply not activate that warning, I believe -Wconversion.

@sezero
Copy link

sezero commented Feb 12, 2024

Are you giving me all of the warnings each time?

Yes

I was surprised to see those warnings about the type of a 0 disappear, since I wasn't expecting them to. But now they're back. That's actually a pretty dumb warning — the constant 0 should match any numeric type. That's a compiler bug. So, yes, at this point you should simply not activate that warning, I believe -Wconversion.

Yes, and I am not activating it myself: -Wconversion is in msdos/Makefile.dj2, removing it was my original suggestion.

@madler
Copy link
Owner

madler commented Feb 12, 2024

Ah, ok. I will remove that warning option.

It is truly odd that nothing changed to make those llseek(..., 0, ...) warnings go away, and nothing changed to make them come back. I guess it will forever remain a mystery.

@madler madler closed this as completed Feb 12, 2024
@sezero
Copy link

sezero commented Feb 12, 2024

Question about _wcelseek change of commit fd5fe8b:
Does zlib require the wcecompat library somehow: https://github.com/mauricek/wcecompat ?
AFAIK, _wcelseek is not part of WinCE api. (There is also the wince code in unzip,
e.g. https://github.com/LuaDist/unzip. I guess, unlike MinGW, posix file io is not part of Microsoft
WinCE SDKs?..)

@madler
Copy link
Owner

madler commented Feb 13, 2024

@sezero Thanks. Is there an alternative to _lseeki64() in WinCE? Is there a way to look in your MinGW tool chain?

@sezero
Copy link

sezero commented Feb 13, 2024

Is there a way to look in your MinGW tool chain?

I tried with the one from here: https://max.kellermann.name/projects/cegcc/

@sezero Thanks. Is there an alternative to _lseeki64() in WinCE?

As I understand it (not sure though) after looking at non-microsoft solutions,
there is no posix io (open, read,write, lseek..) in microsoft wince toolchains,
so people provide custom (but trivial) ones like mingw does: see e.g. the
mingwrt sources on the page I linked above

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

3 participants