headers: Move some macros about deprecated functions from 'strsafe.h' into 'dontuse.h'

Since Windows SDK 8.0, `STRSAFE_NO_DEPRECATE` no longer has an effect. It's
still defined by some headers, but the check in 'strsafe.h' has been removed.
Those macros that match POSIX names have been moved to 'dontuse.h', so we do
the same.

Previously, inclusion of <strsafe.h> before <windows.h> could cause errors like

   In file included from C:/msys64/mingw64/include/windows.h:70,
                    from test.c:2:
   C:/msys64/mingw64/include/winbase.h:1499:37: error: expected identifier or '(' before 'LPSTR'
    1499 |   WINBASEAPI LPSTR WINAPI lstrcpyA (LPSTR lpString1, LPCSTR lpString2);
         |                                     ^~~~~

because the semicolon in the macro `lstrcpyA` affects not only invocations, but
also declarations. Those semicolons have been removed since Windows SDK 8.0, so
we remove them as well. This allows including 'strsafe.h' before 'windows.h'.

The macro `DEPRECATE_SUPPORTED` controls how deprecated functions are to be
deprecated. In Microsoft headers, existence of it deprecates those functions
with `#pragma deprecated`, and absense of it exposes macros which rename them
to non-existent ones, so any use of them results in errors such as

   ccYRG0RL.o:test.c:(.text+0x1c): undefined reference to `strcpy_instead_use_StringCbCopyA_or_StringCchCopyA'
   collect2.exe: error: ld returned 1 exit status

To match the behavior of Windows SDK, we define those renaming macros only if
`DEPRECATE_SUPPORTED` isn't defined, like in 'pathcch.h'. Unfortunately, GCC
does not support `#pragma deprecated`, so no warning will be issued if
`DEPRECATE_SUPPORTED` is defined by including 'winnt.h' or 'windows.h' before
'strsafe.h'. This may be improved in the future.

Reported-by: Julian Waters <tanksherman27@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2 files changed