在 2024-02-29 01:14, Martin Storsjö 写道:
It would be much more understandable, if the message would start with some 
context like this:

---8<---

WinSDK's strsafe.h also tries to discourage users from calling a bunch of its internal functions. This is done in two different ways; if DEPRECATE_SUPPORTED is defined (it gets defined by winnt.h), the functions are marked deprecated via e.g. "#pragma deprecated(StringLengthWorkerA)". If that isn't defined, those symbols are redefined to a missing name instead, e.g. "#define StringLengthWorkerA StringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA"


This contradicts my understanding:

I don't think that `DEPRECATE_SUPPORTED` is a macro that is to be defined by users. Its conditional definition in 'winnt.h' is protected by `DECLSPEC_DEPRECATED`, and if a user defines it on themselves, they will get warnings about redefinition.


As GCC doesn't support #pragma deprecated, our version doesn't use that, so we only redirect/rename uses of these functions if DEPRECATE_SUPPORTED isn't defined - to match the effect on the WinSDK headers (where the names are usable but gets warned about, if DEPRECATE_SUPPORTED is defined).

---8<---

That, IMO, is more understandable by people just looking at the patch in isolation, and/or looking at our headers.

Alternatively, we could just skip adding this ifdef in this patch, as we don't have the alternative way of marking the deprecation - that would get the message across to the users even more clearly?

There is a difference about these two approaches: `#pragma deprecated` effects warnings, while defining those names to non-exitent ones effects hard errors.

Including 'dontuse.h' and getting hard errors might be expected, but including 'strsafe.h' and getting accidental hard errors is probably unwanted.

However that's already how Microsoft headers behave.


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to