qt6-bb10/src/tools/bootstrap
Marc Mutz 0eab6aac05 Introduce QT_NO_QSNPRINTF and mark QtCore as qsnprintf-free
... except, of course, the implementation file, which therefore has to
be excluded from PCH'ed builds.

Remove qvsnprintf.cpp from libbootstrap, as it's no longer needed
after porting all five uses of qsnprintf() in QtCore to C++11's
std::snprintf(), which even Windows implements with std behavior.

The reason we're removing the function is that std::snprintf() is the
better alternative: qsnprintf() just introduces even more platform
variance than any implementation-defined behavior of C or C++
snprintf().

To wit:

- On Windows, the return value is sometimes "wrong"
  (cf. Windows-specific qsnprintf() tests in tst_qbytearray.cpp)

- On WASM and at least some Android configurations, it is incorrectly
  implmented using the QString::asprintf().toLocal8Bit() work-around,
  even though both platforms have a working snprintf().
  QString::asprintf() is implemented in Qt itself, so has some
  differences:

  - the `a` format for hex floats is not supported

  - %ls expects char16_t*, not wchar_t* (these are, in general, not
     the same width)

We will deprecate these functions in 6.9, but before we do, we need to
get the Qt code in order, and that's where this macro comes in.

[ChangeLog][QtCore] Added the QT_NO_QSNPRINTF macro to disable
qsnprintf() and qvsnprintf(), which will also be deprecated in 6.9.
See the documentation for details why we take this step.

Task-number: QTBUG-127110
Change-Id: I4e1c1f213bcfd615f83387f5f51e77fa1ff2062e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bd7d54249e3f2b6a9dd6b759c892d7c97d26c0aa)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-08-05 18:22:44 +02:00
..
CMakeLists.txt Introduce QT_NO_QSNPRINTF and mark QtCore as qsnprintf-free 2024-08-05 18:22:44 +02:00