From b6a55283690dd2579d249652100a5a28a6baccf8 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 11 Mar 2024 22:39:09 +0200 Subject: [PATCH] tst_qfile: fix GCC 13.2.1 compiler warning [-Wenum-compare] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By using "wt" for all OS's; according to Thiago the 't' is ignored everywhere except on Windows. tests/auto/corelib/io/qfile/tst_qfile.cpp:2846:70: warning: comparison between ‘enum QOperatingSystemVersionBase::OSType’ and ‘enum QOperatingSystemVersion::OSType’ [-Wenum-compare] 2846 | const char *openMode = QOperatingSystemVersion::current().type() != QOperatingSystemVersion::Windows | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Amends 3446313c7a5cd6005089866a7b20c9f28e132a0a Pick-to: 6.6 6.5 6.2 Change-Id: I310d7d6ce3833756ffdc47b000e052ef3afdfdef Reviewed-by: Thiago Macieira (cherry picked from commit d7340d5c31c8ce79724af9592453d3cf55262fa4) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 39533749aa5..9cf267be1f4 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2843,9 +2843,8 @@ void tst_QFile::socketPair() void tst_QFile::textFile() { - const char *openMode = QOperatingSystemVersion::current().type() != QOperatingSystemVersion::Windows - ? "w" : "wt"; - StdioFileGuard fs(fopen("writeabletextfile", openMode)); + // The "t" is ignored everywhere except on Windows + StdioFileGuard fs(fopen("writeabletextfile", "wt")); QVERIFY(fs); QFile f; QByteArray part1("This\nis\na\nfile\nwith\nnewlines\n");