Define Q_OS_WINDOWS, make it an alias to Q_OS_WIN

As seen in several occasions, both in user code and in Qt proper,
people make these mistakes. What makes it harder to spot is that it doesn't
look like a typo, and feels natural (natural as Q_OS_LINUX instead of Q_OS_LIN feels).

There's been a P1 in qtdeclarative/ and currently there's a Q_OS_WINDOWS usage
in qtwebengine.

This is a recurring problem, no matter how much people test and review
these errors will happen, so the alias is justified.

Change-Id: If6943b52e17f0c8b238c36bb1f7834802123f12a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Sergio Martins 2019-05-06 15:44:49 +01:00 committed by Sérgio Martins
parent c6bee8e4b2
commit 9444416a46
2 changed files with 8 additions and 0 deletions

View File

@ -1400,6 +1400,13 @@ bool qSharedBuild() Q_DECL_NOTHROW
\l Q_OS_WIN32, \l Q_OS_WIN64, or \l Q_OS_WINRT is defined.
*/
/*!
\macro Q_OS_WINDOWS
\relates <QtGlobal>
This is a synonym for Q_OS_WIN.
*/
/*!
\macro Q_OS_WIN32
\relates <QtGlobal>

View File

@ -176,6 +176,7 @@
#endif
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT)
# define Q_OS_WINDOWS
# define Q_OS_WIN
#endif